@ -19,7 +19,7 @@ Avoid spaces, hyphens, and preceding numbers (use ``floor_19``, not ``19th_floor
This tiny example data center illustrates a basic group structure. You can group groups using the syntax ``[metagroupname:children]`` and listing groups as members of the metagroup. Here, the group ``network`` includes all leafs and all spines; the group ``datacenter`` includes all network devices plus all webservers.
..code-block::yaml
..code-block::ini
[leafs]
leaf01
@ -47,7 +47,7 @@ Add Variables to Inventory
Next, you can set values for many of the variables you needed in your first Ansible command in the inventory, so you can skip them in the ansible-playbook command. In this example, the inventory includes each network device's IP, OS, and SSH user. If your network devices are only accessible by IP, you must add the IP to the inventory file. If you access your network devices using hostnames, the IP is not necessary.
When devices in a group share the same variable values, such as OS or SSH user, you can reduce duplication and simplify maintenance by consolidating these into group variables:
..code-block::yaml
..code-block::ini
[leafs]
leaf01 ansible_host=10.16.10.11
@ -123,7 +123,7 @@ Group Inventory by Platform
As your inventory grows, you may want to group devices by platform. This allows you to specify platform-specific variables easily for all devices on that platform:
..code-block::yaml
..code-block::ini
[vyos_leafs]
leaf01 ansible_host=10.16.10.11
@ -155,7 +155,7 @@ As your inventory grows, you may want to group devices by platform. This allows
With this setup, you can run first_playbook.yml with only two flags:
@ -191,7 +191,7 @@ and type in the vault password for ``my_user``.
The :option:`--vault-id <ansible-playbook --vault-id>` flag allows different vault passwords for different users or different levels of access. The output includes the user name ``my_user`` from your ``ansible-vault`` command and uses the YAML syntax ``key: value``:
..code-block::bash
..code-block::yaml
ansible_ssh_pass: !vault |
$ANSIBLE_VAULT;1.2;AES256;my_user
@ -202,31 +202,39 @@ The :option:`--vault-id <ansible-playbook --vault-id>` flag allows different vau