100-Days-Of-DevOps-Challenge-KodeKloud

Ansible Ping Module Usage

The Nautilus DevOps team is planning to test several Ansible playbooks on different app servers in Stratos DC. Before that, some pre-requisites must be met. Essentially, the team needs to set up a password-less SSH connection between Ansible controller and Ansible managed nodes. One of the tickets is assigned to you; please complete the task as per details mentioned below:

a. Jump host is our Ansible controller, and we are going to run Ansible playbooks through thor user from jump host.

b. There is an inventory file /home/thor/ansible/inventory on jump host. Using that inventory file test Ansible ping from jump host to App Server 3, make sure ping works.

Steps

  1. Update the inventory file with specific user:

     stapp01 ansible_host=172.16.238.10 ansible_user=tony ansible_ssh_pass=Ir0nM@n
     stapp02 ansible_host=172.16.238.11 ansible_user=steve ansible_ssh_pass=Am3ric@
     stapp03 ansible_host=172.16.238.12 ansible_user=banner ansible_ssh_pass=BigGr33n
    
     [all:vars]
     ansible_ssh_common_args='-o StrictHostKeyChecking=no'
    
  2. Test ping module

    • To ping all servers:

        ansible all -i inventory -m ping
      
    • To ping specific server:

        ansible stapp03 -i inventory -m ping
      

Good to Know?

Ansible Ping Module

Connection Testing

Inventory Variables

Troubleshooting Connectivity