Step :1 Set EPEL repository
Ansible package is not available in the default yum repositories, so we will enable epel repository for Oracle Linux 7 using below commands
Step:2 Install Anisble using yum command
Once the installation is completed, check the ansible version :
Step:3 Setup keys based SSH authentication with Nodes.
Generate keys on the Ansible server and copy public key to the nodes.
Use ssh-copy-id command to copy public key of Ansible server to its nodes.
Step:4 Define the nodes or inventory of servers for Ansible.
File ‘/etc/ansible/hosts‘ maintains the inventory of servers for Ansible
Step:5 Now try to run the Commands from Ansible Server.
Check the connectivity of ‘test-servers’ or ansible nodes using ping
Executing Shell commands :
Example :1 Check the uptime of Ansible nodes
Example:2 Check Kernel Version of nodes
Example:3 Adding a user to the nodes
Example:4 Redirecting the output of command to a file