100-Days-Of-DevOps-Challenge-KodeKloud

Copy Data to App Servers using Ansible

The Nautilus DevOps team needs to copy data from the jump host to all application servers in Stratos DC using Ansible. Execute the task with the following details:

a. Create an inventory file /home/thor/ansible/inventory on jump_host and add all application servers as managed nodes.

b. Create a playbook /home/thor/ansible/playbook.yml on the jump host to copy the /usr/src/sysops/index.html file to all application servers, placing it at /opt/sysops.

Note: Validation will run the playbook using the command ansible-playbook -i inventory playbook.yml. Ensure the playbook functions properly without any extra arguments.

Steps

  1. Move into ansible directory

     cd ansible
    
  2. Create an inventory file and copy-paste the contents:

     [app]
     stapp01 ansible_user=tony ansible_ssh_password=Ir0nM@n
     stapp02 ansible_user=steve ansible_ssh_password=Am3ric@
     stapp03 ansible_user=banner ansible_ssh_password=BigGr33n
    
     [all:vars]
     ansible_ssh_common_args='-o StrictHostKeyChecking=no'
    
  3. Create an playbook.yml file and copy-paste the contents from this playbook file

  4. Run the playbook command:

     ansible-playbook -i inventory playbook.yml
    

Good to Know?

Ansible File Management

File Copy Operations

Multi-Server Management

Best Practices