We're going to update our inventory list to add a custom variable to each host record which defines its hardware type, and then we're going to run a playbook that selectively adds some firewall configuration, based on the value of this variable.
- Modify our inventory file in order to collect together all of the common variables under one INI-style group called [JUNOS-devices:vars].
[JUNOS-devices:vars] ansible_user=auto ansible_ssh_private_key_file=/home/user/auto/JUNOS_auto_id_rsa ansible_connection=local
- Then define the JUNOS devices themselves with the variables that actually vary per-host.
[JUNOS-devices] JUNOS1 ansible_host=10.0.201.201 hardware=vm JUNOS2 ansible_host=10.0.201.202 hardware=mx960-mpc JUNOS3 ansible_host=10.0.201.203 ...