Demo: Creating and running an Ansible Playbook

Ivan Westen
A free video tutorial from Ivan Westen
World Class IT Education
3.9 instructor rating • 45 courses • 59,841 students

Learn more from the full course

Ansible 30 Minutes Overview

Learn the fundamentals of Ansible and start automating tasks in a DevOps environment in 30 minutes!

35:29 of on-demand video • Updated March 2018

  • Learn what Ansible is and how you can use it to automate in a DevOps environment.
  • Learn how to install and configure Ansible
  • How to create and run Ansible Playbooks
  • More...
English [Auto] Temo how to write a simple play book you can copy and save as shall talk and try to learn the playbook which you can copy it by simply by random ansible play Pokemon and then find a task. What are the tasks been done successfully by trunked. So ISTM this last company and you can access to the web server and want to put some command in there to verify further. Now let's try to write a simple playbook I specified a target host local because I just want one in this particular machine and become a pseudo finder friable company name is IBC. Prompt for prompt. Which called Name First Name First Name. And define a new section which starts a new task which to run simple command. I use shell module which run a code for us and freshening up will work and in company thing ever done. So I asked him Please list company and then I find a new target which called for a pseudo defined in the U.S. which called Task Name itself. It's toll Marea D.B. I using them onto yum to install packages which packages itself is a Marriott and I want to be on these. That's right. TTYS and I prefer to use the Ferber's option too. So you can see the was famous for as you can see this summary step by step which talks. It's been running on and on we will to be tosses. And you can see scheduling fax cowpoke state is called. Ok it's means spend. Didn't do any changes on target host. It's installing. Yep it's installed. It's a recap of host and no simple dot.com turn could change. Which we're in yellow color. It's been verified. Now let's verify the status of the debt. It's not active. So it's been installed in this particular mission here since tolt playbooks have a bezerk Even system that can be used to respond to change. That's not if my actions are triggered at the end of each block of tasks in a play and will only be triggered once even if notified by multiple different tasks. For instance what of resources maybe indicate that a PC. I bet she needs to be restarted because of change of conflict file but Apache will only be Baum's ones on one side to avoid unnecessary restarts. Let's try using a handler module on a playbook. First we create a simple web page to be copied to our server and then copy and serve it as Hendler example. And then run the playbook and then we verify what are the web pages that points with different sex Avali with the following command. Ok I'll show you how to make this script. First let's define a play name which calls handler example. Yeah. Here defiant Holst's name husband target which only the web server out become a pseudo and his tasks. Remember to structure a little bit of space. Here's the name of the task is to let us to be. And I use a yum module which I could use to be in a state is the one I want to install it this one version and I used to find what do you start taught to be the and then I copy indexers copy Modu I defined the source this source directory and destination top 3 so typical Duckman wrote in it the OK to restart the PD and then I will define new tasks which code start service I use a surface model which is the surface and I want to be started in next thoughts I want to enable at boot. So to make atonement tickly example to boot the surface is really the same. Yes it's a structure. And then will make the humbler six Hendler section. It's called Restart TPD take notice that I already defined not defined in the above so it restructure the body not the high module we refer to this or kids territory was called T.M. this page is deployed using common simple k and storing it using a command C and C will run the task in order from top to bottom to bottom so you can see does change change. It means in simple. Did something change about our regard. We didn't do on Siebel client. Let's verify it or it's successful. The point was called Yep the content is the same. Let's run it once again. As you can see no blue and this state is OK and green. So it meant it means it's already done before. So unseeable didn't any haven't any create any changes. No we modified the content of the index. The whole copy. As you can see it's changed because the content is already change. And that's the summary pretty simple. Starflight you have this page. Did you sing on unsuitable.