学乐的技能树

ansible安装(源码、centos6)

2017-04-08  本文已影响130人  快乐的涨姿势

github安装(还有其他安装方法)

git clone git://github.com/ansible/ansible.git --recursive

cd ./ansible
cp examples/ansible.cfg /etc/ansible/
vim /etc/ansible/hosts
sudo pip install paramiko PyYAML Jinja2 httplib2 six
source ./hacking/env-setup
$ echo "127.0.0.1" > ~/ansible_hosts
$ export ANSIBLE_HOSTS=~/ansible_hosts

SSH认证

ssh-keygen
# 然后一直回车
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.100
ssh root@192.168.1.100
chown username: /home/username/.ssh
chown username: /home/username/.ssh/*
chmod 700 /home/username/.ssh
chmod 600 /home/username.ssh/*

验证

ansible 192.168.1.100 -u root -m ping
192.168.1.100 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
上一篇下一篇

猜你喜欢

热点阅读