From the course: Ansible Essential Training
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Specifying variables in the inventory file - Ansible Tutorial
From the course: Ansible Essential Training
Specifying variables in the inventory file
- [Instructor] Just like in any full blown programming language, variables allow us to really start playing with power in our automation with Ansible. There are many different flexible ways in which we can pass variables using the inventory file. This really adds even more value to the inventory file which is already a critical component in Ansible. So let's take a look at some of the ways in which we can do this. Again remember, there are many ways to do things in Ansible, so we were just seeing some of the most popular methodologies. But let's first go ahead and take a look at our inventory file. So we're going to cat to our etc Ansible hosts location. Notice we are using the default inventory location in this demonstration and here's our inventory file. And if you look under the backup servers, you will see that target6 has a variable specified for the backup file. And notice the backup file is going to be test1…
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)
-
-
-
-
-