June 2017
Intermediate to advanced
446 pages
10h 10m
English
We can further separate out the host variables in the same format as the group variables:
$ mkdir host_vars
In our case, we execute the commands on the localhost, therefore the file under host_vars should be named accordingly, such as host_vars/localhost. Note that we kept the variables declared in group_vars.
--- "nexus_devices": "nx-osv-1": "hostname": "nx-osv-1" "username": "{{ username }}" "password": "{{ password }}" <skip> "netflow_enable": True "nx-osv-2": "hostname": "nx-osv-2" "username": "{{ username }}" "password": "{{ password }}" <skip>
After we separate out the variables, the playbook now becomes very lightweight and only consists of the logic of our operation:
$ cat chapter5_9.yml --- - name: Ansible Group ...
Read now
Unlock full access