Posts

Showing posts from 2017

Installing and Configuring Ansible

Installing and Configuring Ansible


1. Enable EPEL Repository

wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
     # rpm -ivh epel-release-6-8.noarch.rpm

2. Install Ansible

sudo yum install ansible

3. Setup Passwordless access to remote machines

ssh-keygen -t rsa -b 4096
       ssh-copy-id essadmin@10.201.32.127

   Now test pass-wordless access.

4. Creating Inventory File for Remote Hosts with below entry 

sudo vim /etc/ansible/hosts
[webservers]
          10.201.32.127

5. Test ansible using the ping module with -m option

$ ansible -m ping webservers
10.201.32.127 | SUCCESS => {
                    "changed": false,
                          "ping": "pong"
                    }

           $ ansible -m ping all
  10.201.32.127 | SUCCESS => {
               changed": false,
               "ping": "pong"
            }


6. Use command module to execute any command on remote hosts

     $ ansible -m command -a "…