June 2017
Intermediate to advanced
446 pages
10h 10m
English
By default, Ansible will look for group variables in the same directory as the playbook called group_vars for variables that can be applied to the group. By default, it will look for the file name that matches the group name. For example, if we have a group called [nexus-devices] in the inventory file, we can have a file under group_vars named nexus-devices to house all the variables applied to the group.
We can also use a file called all to include variables applied to all the groups.
We will utilize this feature for our username and password variables:
$ mkdir group_vars
Then, we can create a YAML file called all to include the username and password:
$ cat group_vars/all---username: ciscopassword: cisco
We can then use variables ...
Read now
Unlock full access