Professional Documents
Culture Documents
2- On Master :
[root@workstation ~]# yum clean all
[root@workstation ~]# yum repolist
[root@workstation ~]# yum epel-release
[root@workstation ~]# yum install ansible -y
[root@workstation ~]# su - devops
[devops@workstation ~]$ ssh-keygen
[devops@workstation ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub
devops@172.25.250.129
[devops@workstation ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub
devops@172.25.250.130
[devops@workstation ~]$ mkdir /project1
[devops@workstation ~]$ cd project1/
[devops@workstation project1]$ vi /tmp/inventory and add
172.25.250.130
172.25.250.129
4- On Master :
[devops@workstation project1]$ ansible all --list-hosts you should
see the ips you added in /tmp/inventory
[devops@workstation project1]$ ansible all -m command -a idwill execute id
command on the servers and return the answers
explore
[devops@workstation project1]$ ansible all -m command -a id -v will
show you where the conf file used to connect to hosts + execute the command
[devops@workstation project1]$ ansible all -m command -a id --become will
force become = true when executing ( when become = false in ansible.cfg )