Ansible Copy Module

Ansible Copy Module

ยท

1 min read

Task :

  • On jump host create an inventory file in "/home/thor/ansible/inventory" and add all application servers as managed nodes.

  • On jump host create a playbook "/home/thor/ansible/playbook.yml" to copy "/usr/src/sysops/index.html" file to all application servers at location "/opt/sysops".

  • Run the playbook using command "ansible-playbook -i inventory playbook.yml", so please make sure the playbook works this way without passing any extra arguments.

Execution :

Navigate to the "/home/thor/ansible/" directory to create inventory file and the playbook. cd /home/thor/ansible/ vi inventory

  • Add the following lines into the inventory for each node.

hostname ansible_host=ip-address ansible_ssh_pass=password ansible_user=username

hostname ansible_host=ip-address ansible_ssh_pass=password ansible_user=username

hostname ansible_host=ip-address ansible_ssh_pass=password ansible_user=username

Create the playbook.yml to copy the file to other nodes.

ย