Hello All,
I'm an ansible newbie and have what is probably a very basic question but I'm not sure how to best ask it. If I execute a show vlan command via ansible, I'll get back a big chunk of data. How do I pull items out or refer to items in that chunk. For example, the following ansible stuff:
- name: Run Show VLAN
ios_command:
commands:
- "sho vlan"
register: get_vlan
- name: Display the config2
debug:
msg: "The vlan list is {{ get_vlan }}"
returns this:
TASK [Display the config2] **********************************************************************************************************************************************************************************ok: [test01] => {
"msg": "The vlan list is {'failed': False, u'changed': False, u'stdout_lines': [[u'VLAN Name Status Ports', u'---- -------------------------------- --------- -------------------------------', u'1 default active Gi1/0/48, Ap1/0/1', u'5 VLAN0005 active Gi1/0/2, Gi1/0/3, Gi1/0/4, Gi1/0/5, Gi1/0/6, Gi1/0/7, Gi1/0/8, Gi1/0/9, Gi1/0/10, Gi1/0/11, Gi1/0/12, Gi1/0/13, Gi1/0/14, Gi1/0/15, Gi1/0/16, Gi1/0/17, Gi1/0/18, Gi1/0/19, Gi1/0/20, Gi1/0/21, Gi1/0/22, Gi1/0/23, Gi1/0/24, Gi1/0/25, Gi1/0/26, Gi1/0/27, Gi1/0/28, Gi1/0/29, Gi1/0/30, Gi1/0/31, Gi1/0/32, Gi1/0/33, Gi1/0/34, Gi1/0/35, Gi1/0/36, Gi1/0/37, Gi1/0/38, Gi1/0/39, Gi1/0/40, Gi1/0/41, Gi1/0/42, Gi1/0/43, Gi1/0/44, Gi1/0/45, Gi1/0/46, Gi1/0/47', u'215 voice active Gi1/0/2, Gi1/0/3, Gi1/0/4, Gi1/0/5, Gi1/0/6, Gi1/0/7, Gi1/0/8, Gi1/0/9, Gi1/0/10, Gi1/0/11, Gi1/0/12, Gi1/0/13, Gi1/0/14, Gi1/0/15, Gi1/0/16, Gi1/0/17, Gi1/0/18, Gi1/0/19, Gi1/0/20, Gi1/0/21, Gi1/0/22, Gi1/0/23, Gi1/0/24, Gi1/0/25, Gi1/0/26, Gi1/0/27, Gi1/0/28, Gi1/0/29, Gi1/0/30, Gi1/0/31, Gi1/0/32, Gi1/0/33, Gi1/0/34, Gi1/0/35, Gi1/0/36, Gi1/0/37, Gi1/0/38, Gi1/0/39, Gi1/0/40, Gi1/0/41, Gi1/0/42, Gi1/0/43, Gi1/0/44, Gi1/0/45, Gi1/0/46, Gi1/0/47',
How do I pull out those interface names and do something to them. How are they referred to? It's like I need to act on the data as an array but I'm not sure how to get it to be an array.
What am I missing?
Thanks very much for any help.
Steve