The following are the terms and tools within the overall principles described above that successful DevOps engineers need to know
USING A PLAYBOOK TO COPY A PROGRAM AND
CUSTOMIZE IT FOR THE TARGET HOST
We are going to create a play book to copy a program from local server to target servers .
Lets create play book ,
[ansible@ansible1 ~]$ vi mainapp1.yml
Here I have used different variables ,
• One is copy file from local server given path and destination path to past that file.
• Second is to add in that file “hostname”
• Third is shell script to run that program in that file
Use debug command to get output of program.
Then create program1.sh file in local server,
[ansible@ansible1 ~]$ sudo vi /opt/program1.sh
In this file I have added hostname output , lets give a permission access for this file ,
[ansible@ansible1 ~]$ sudo chmod 0755 /opt/program1.sh
lets run the playbook now ,
[ansible@ansible1 ~]$ ansible-playbook mainapp1.yml
Go and check the target server ..
[ansible@ansible2 ~]$ ls
There is our program1.sh file found. It is given exact output !!!