Every playbook needs to start with the following header:
- name: Get Uptime Low Reason hosts: - "localhost" gather_facts: False |
name: The playbook friendly name that will be shown in the UI
hosts: Should always set to localhost
gather_facts: Should always set to False
Indeni platform will provide the device Credentials. In order to do so, need to use the proper macros:
panos_op: ip_address: '{{ ip_address }}' username: '{{ username }}' password: '{{ password }}' cmd: 'show interface all' |
{{ip_address}}: The device IP
{{username}}: The ssh user name
{{password}}: The ssh user password
Indeni platform pass the playbook all of the tags collected for the device during the interrogation process. The playbook can use it under the field device_tags
{{device_tags}}: The dictionary which contains all device tags
- name: Found vendor!!! debug: msg: "{{ device_tags.vendor }}" when: device_tags.vendor is defined - name: Found version!!! debug: msg: {{ device_tags['os.version'] }}" when: device_tags['os.version'] is defined |
Each task should have a proper name, in order to visualize the results in a clear way
tasks: - name: run show interface panos_op: ip_address: '{{ ip_address }}' username: '{{ user_name }}' password: '{{ password }}' cmd: 'show interface all' register: result - name: result show interface debug: msg='{{ result.stdout }}' |
Adding the name for each task should be enforced as part of the code reviews.