标签:ansible自动化运维
Ansible自动化运维(一)
cd python-2.7.8
./configure --prefix=/usr/local && make && make install
#如果ansible找不到python头文件的话,将Pytho头文件复制到标准目录
cp -a /usr/local/include/python2.7/* /usr/local/include
#修改/usr/bin/yum
#!/usr/bin/python --> #!/usr/bin/python2.6
#建立python2.7软链接
mv /usr/bin/python /usr/bin/python.bk
ln -s /usr/local/bin/python2.7 /usr/bin/python
cd setuptools-7.0
python setup.py install
cd pycrypto-2.6.1
python setup.py install
cd PyYAML-3.11
python setup.py install
cd Jinja2-2.7.3
python setup.py install
cd ecdsa-0.13
python setup.py install
cd paramiko-1.15.1
python setup.py install
cd simplejson-3.6.5
python setup.py install
cd ansible-1.7.2
python setup.py install
#在所有机子执行
ssh-key-geg -t rsa -P ‘‘
#任意一台机子
cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
#将其他机子的id_rsa.pub追加到authorized_keys,然后再将该文件传送到/root/.ssh/
scp /root/.ssh/authorized_keys root@ip:/root/.ssh/
#修改/etc/ssh/sshd_config,取消以下注释并重启sshd服务
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
#更改所有主机/etc/hosts
#设置完成后效果
#设置完成后效果,master、node1、node2、node3可以相互ssh免密码登录
本文出自 “爱就行动” 博客,请务必保留此出处http://1055745601.blog.51cto.com/5003160/1761536
标签:ansible自动化运维
原文地址:http://1055745601.blog.51cto.com/5003160/1761536