Ansible Installation Steps:
Step 1 : sudo apt-get update;sudo apt-get --yes install software-properties-common;sudo apt-add-repository --yes --update ppa:ansible/ansible;sudo apt-get install --yes ansible Step 2: Check the installed Ansible version ansible --version
--- - hosts: jws tasks: - name: copying files with owner and permission copy: src: /admin/ansible/testCopyFile.txt dest: /tomcat/ansible/testCopyFile.txt owner: Modi group: bjp mode: 0777 -------------------- Copy and paste above code in your vi editor and update source, destination, owner , group , mode and hosts values.
- hosts: POC_VM tasks: - copy: src: /jboss/scripts/util/StartStopServers/stopAllRunningProcess.sh dest: /jboss/scripts/util/stopAllRunningProcess.sh - fetch: src: /jboss/scripts/util/stopAllRunningProcess_Server.log dest: /jboss/scripts/util/stopAllRunningProcess_Server.log -------------------- Syntax to run this playbook: ansible-playbook copyFiles.yml -u Unix_user_id -k --ask-pass --ask-su-pass Copy and paste above code in your vi editor and update source and destination values. This playbook will copy/fetch the file from all the host listed under "POC_VM" group. The fetched files will have their hostname at the end of the file name. An admin may need to perform this job sometime to compare multiple files or to take backup of certain files from all hosts before rolling a new change.