June 2017
Intermediate to advanced
446 pages
10h 10m
English
By default, Ansible looks at the /etc/ansible/hosts file for hosts specified in your playbook. As mentioned, I find it more clear to specify the host file via the -i option as we have been doing up to this point. To expand on our previous example, we can write our inventory host file as follows:
[ubuntu] 192.168.199.170 [nexus] 192.168.199.148 192.168.199.149 [nexus:vars] username=cisco password=cisco [nexus_by_name] switch1 ansible_host=192.168.199.148 switch2 ansible_host=192.168.199.149
As you may have guessed, the square bracket headings specifies group names, so later on in the playbook, we can point to this group. For example, in cisco_1.yml and cisco_2.yml, I can act on all hosts specified under the nexus group to the ...
Read now
Unlock full access