From the course: Ansible Essential Training
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Using tags - Ansible Tutorial
From the course: Ansible Essential Training
Using tags
- [Instructor] In the previous video, you learned how simple it can be to target specific systems for Ansible tasks, but what about being specific about what tasks you'd like to run against these systems. Well, we can use tags in our tasks within playbooks, and then reference these tags when we are running the playbook. As you might guess, tags are very easy to implement and use in Ansible. Notice, we're just going to be using a simple tags reference inside the playbook. Let's see this in action. So let's take a look at a playbook that I have called tags.yml. And inside this playbook, you can see that we have three tasks, and these tasks are to install Apache2, to install NTP and to start NTP. Notice what I've done, I've included the tags for each of these tasks. We have the Apache2 tag, the NTP tag and the NTP_start tag. Notice, also, that we could've taken the tags reference and done it higher up in the hierarchy.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
Using host groups4m 31s
-
(Locked)
Using tags4m 27s
-
(Locked)
Running tasks against localhost5m 25s
-
(Locked)
Using the command line to control execution5m 2s
-
(Locked)
Specifying variables in the inventory file5m 51s
-
(Locked)
Creating dynamic inventory files7m 5s
-
(Locked)
Using templates6m 15s
-
(Locked)
Conditional execution4m 25s
-
(Locked)
Using loops7m 45s
-
(Locked)
Testing plays with check mode3m 27s
-
(Locked)
-
-
-
-
-