Ansible Resume
Ansible Resume
com
This means our playbook is syntax error free. Let us move ahead and execute the playbook.
Great! We have successfully created our very first Ansible playbook.
Remember that using playbook we can run the same command repeatedly, but if
everything was configured on the first run, then all subsequent runs make no changes
Now let us see the structure of the role that we just created using the following command.
Now we are ready to create the tasks that our roles are supposed to
perform.
Now we will divide the tasks to be performed into three categories. Install, configure and services.
We will create three different .yml files to reduce the complexity. Include those separate task files in
the main.yml file as shown.
Rememberthat order ofthe listin ymlfile matters. So here install.yml gets executed first,then
configure.yml and thenservice.yml.
Step 4: Now inside task folder, create install.yml and add the installation tasks to be performed as
shown below.
We will install the latest version of apache2 in the remote machine with the help of apt module as
shown below.
We will configure apache2.conf file in the remote machine
Create one html file as well. My dummy html file looks like this.
Check whether our files are ready or not by using the following command.
Add the following content inside handlers file.
Add author information, role descriptions, company information etc. as shown below.
For more than one hosts following commands can be used.
Step 12: Execute the top level .yml file
Congratulations!