Ansible playbooks are the main way we utilize Ansible. Ansible playbook and the
ansible-playbook command we can define them as a yaml script that launches on one or more systems. The playbooks written
script.yml is provided on my GitHub channel.
The playbook is a row of commands executed one after the other that perform operations with simple code blocks and ansible parameters.
In this video I am connected as a localhost on my centos machine for convenience with mobaxterm. Now let’s go see the playbook created to make different jobs on the remote system, in my case a server located remotely.
You can see below parts of my playbook, where I create a timestamp file on the system, through the bash commands on the remote system I generate the use of the memory and cpu … I copy the files from remote to local in json format to subsequently evaluate them. Imagine you are copying this on 100 systems, you will probably have everything ready in 3 minutes rather than several hours.
The power of the playbook remains to automate everything on various systems, where and when we want. Be careful which hosts we run the command, better always keep a list of production hosts and others for dev or testing. Separate everything using the host file.
Now have fun with this video, where you will see the playbook launched on a remote server created on Vultr. If you have interest in it, the file is on github where you can download it. Now let’s start running the script from the terminal, I recommend you don’t do like me, use ansible-playbook command.
- Previous Post