ansible小试

来源:互联网 发布:易语言编程系统全书 编辑:程序博客网 时间:2024/05/17 08:08

http://docs.ansible.com/ansible/latest/index.html

http://www.ansible.com.cn/index.html

1 本机master生成ssh-kengen:id_rsa,id_ras.pub

ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ''

2 cat id_rsa.pub>>authorized_keys

 scp id_rsa.pub root@node0:/root/.ssh/

node0上执行:cat id_rsa.pub>>authorized_keys


master上安装ansible :

yum -y install ansible

修改vi /etc/ssh/sshd_config:

vi /etc/ansible/hosts

localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python2
node0 ansible_connection=local ansible_python_interpreter=/usr/bin/python2

 ansible all -m ping