[size=x-large]
第一步 :管理节点上安装ansible环境 略
第二步 :管理节点上配置 hosts文件 /etc/ansible/hosts
testserver ansible_ssh_host=127.0.0.1 ansible_ssh_user=root
targetserver ansible_ssh_host=192.168.137.4 ansible_ssh_user=root
第三步 :管理节点上配置 ansible.cfg
touch /etc/ansible/ansible.cfg
[defaults]
inventory = /etc/ansible/hosts
library = /usr/share/ansible/
forks = 5
sudo_user = root
remote_port = 22
roles_path = /root/ansible_playbook/roles
host_key_checking = False
timeout = 20
log_path = /var/log/ansible.log
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
[accelerate]
[selinux]
[colors]
deprecation_warnings=False
host_key_checking = False
第四步 : 管理节点生成pub-key
ssh-keygen
第五步 :copy 相关Key到目标节点
#ssh-copy-id root@目标节点IP
第六步 :test
ansible -m ping all
[img]http://dl2.iteye.com/upload/attachment/0130/1653/8c0a2031-a668-327f-a8cd-010ca7374737.png[/img]
[/size]
第一步 :管理节点上安装ansible环境 略
第二步 :管理节点上配置 hosts文件 /etc/ansible/hosts
testserver ansible_ssh_host=127.0.0.1 ansible_ssh_user=root
targetserver ansible_ssh_host=192.168.137.4 ansible_ssh_user=root
第三步 :管理节点上配置 ansible.cfg
touch /etc/ansible/ansible.cfg
[defaults]
inventory = /etc/ansible/hosts
library = /usr/share/ansible/
forks = 5
sudo_user = root
remote_port = 22
roles_path = /root/ansible_playbook/roles
host_key_checking = False
timeout = 20
log_path = /var/log/ansible.log
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
[accelerate]
[selinux]
[colors]
deprecation_warnings=False
host_key_checking = False
第四步 : 管理节点生成pub-key
ssh-keygen
第五步 :copy 相关Key到目标节点
#ssh-copy-id root@目标节点IP
第六步 :test
ansible -m ping all
[img]http://dl2.iteye.com/upload/attachment/0130/1653/8c0a2031-a668-327f-a8cd-010ca7374737.png[/img]
[/size]