January 2019
Beginner to intermediate
776 pages
19h 58m
English
We discussed variables a bit in the previous 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 should 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 Contacthosts: "nexus"gather_facts: falseconnection: localvars:cli:host: "{{ inventory_hostname }}"username: ciscopassword: ciscotransport: clitasks:- name: configure snmp contactnxos_snmp_contact:contact: TEST_1state: presentprovider: "{{ cli }}" ...Read now
Unlock full access