-
Notifications
You must be signed in to change notification settings - Fork 9
/
ios-genie-collection-sho-ver.yml
51 lines (44 loc) · 1.45 KB
/
ios-genie-collection-sho-ver.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
- name: IOS show version genie example
hosts: ios
connection: network_cli
gather_facts: no
tasks:
- name: show version
cisco.ios.ios_command:
commands:
- show version
register: version
- name: Run command and parse with pyats
ansible.utils.cli_parse:
command: "show version"
parser:
name: ansible.netcommon.pyats
register: parser_output
- name: Show Version - all
ansible.builtin.debug:
var: parser_output
- name: Show Version Details
ansible.builtin.debug:
msg:
- "Hostname: {{ parser_output.parsed.version.hostname }}"
- "Model: {{ parser_output.parsed.version.chassis }}"
- "Operating System: {{ parser_output.parsed.version.os }}"
- "OS Version: {{ parser_output.parsed.version.version }}"
- "Serial Number: {{ parser_output.parsed.version.chassis_sn }}"
- "Configuration Register: {{ parser_output.parsed.version.curr_config_register }}"
# - name: Set Fact Genie Filter
# ansible.builtin.set_fact:
# pyats_version: "{{ version['stdout'][0] | clay584.genie.parse_genie(command='show version', os='ios') }}"
#
# - name: Debug Pyats facts - all
# ansible.builtin.debug:
# var: pyats_version.version
#
# - name: Debug Pyats facts - version
# ansible.builtin.debug:
# var: pyats_version.version.version
#
# - name: Debug Pyats facts - uptime
# ansible.builtin.debug:
# var: pyats_version.version.uptime