Ansible-build

Ansible deployment
System environment: CentOs7.2
Server: 192.168.4.183
Server: 192.168.4.184
Server: 192.168.4.185
1. The client and server need to have unified openssl and ssh versions
[root@localhost ~]# yum -y install openssl openssh
2. Ansible installation#server
[root@localhost ~]# yum -y install epel-release #Install epel source
[root@localhost ~]# yum -y install ansible #Install components
3. Configure the host group
[root@localhost ~]# vim /etc/ansible/hosts
[cwg]
192.168.4.183
192.168.4.184
192.168.4.185
4. Generate public key and private key
[root@localhost ~]# ssh-keygen -t rsa -P ''
5. Public key distribution on the client
[root@localhost ~]# cd /root/.ssh/
[root@localhost ~]# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys ---- generate a new key authorized_keys
6. Pass authorized_keys to the host to be controlled
[root@localhost ~]# cd /root/.ssh/
[root@localhost ~]# scp authorized_keys client user@client IP:/root/.ssh/
7. Client changes public key permissions#client
chmod 600 /root/.ssh/authorized_keys #Change permissions after passing
8. Use ansible to test the running status of the remote host
ansible cwg -m ping
 
This article is from http://note.youdao.com/noteshare?id=1f257f7ee3f7d3c4802863cb0d3e981b

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325944035&siteId=291194637