0% found this document useful (0 votes)
46 views

Ansible Resume

This document provides instructions for creating an Ansible role and playbook. It outlines creating task files to install, configure, and start services. It also describes adding handler tasks to restart services, checking syntax, and executing the playbook with roles on remote machines. The role is used to install and configure Apache on a server. Creating reusable roles allows applying common configurations across multiple systems through playbooks.

Uploaded by

ahdy kefi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Ansible Resume

This document provides instructions for creating an Ansible role and playbook. It outlines creating task files to install, configure, and start services. It also describes adding handler tasks to restart services, checking syntax, and executing the playbook with roles on remote machines. The role is used to install and configure Apache on a server. Creating reusable roles allows applying common configurations across multiple systems through playbooks.

Uploaded by

ahdy kefi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

anilsharma6991@gmail.

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!

You have successfully created Ansible Role.


NowletusseehowtousethisAnsiblerolethatwe’vejustcreatedalongwithothertasksin a Ansible Playbook.
Step 3: Check for syntax error and execute the playbook withroles.
Congratulations!

You have successfully integrated Ansible roles with Ansible playbook


[email protected]

You might also like