June 2017
Intermediate to advanced
446 pages
10h 10m
English
We discussed variables a bit in the inventory section. Because our managed nodes are not exactly alike, we need to accommodate the differences via variables. Variable names should be letters, numbers, and underscores and always start with a letter. Variables are commonly defined in three locations:
Let's look at an example of defining variables in a playbook, cisco_1.yml:
--- - name: Configure SNMP Contact hosts: "nexus" gather_facts: false connection: local vars: cli: host: "{{ inventory_hostname }}" username: cisco password: cisco transport: cli tasks: - name: configure snmp contact nxos_snmp_contact: contact: TEST_1 state: present provider: ...Read now
Unlock full access