Closed donnerhacke closed 3 years ago
ios_vlan is not the culprit. It works the same with ios_vlans.
- name: Test VLAN Bug
hosts: switch
gather_facts: no
tasks:
- name: Create VLAN
ios_vlans:
config:
- name: test vlan
vlan_id: 109
state: active
state: merged
- name: Validate VLAN
ios_command:
commands:
- show vlan brief | include _109_
register: res
- name: Show output
debug:
var: res.stdout
- name: Gather facts
ios_facts:
gather_network_resources:
- vlans
- name: Show facts
debug:
var: ansible_facts.network_resources.vlans |
selectattr('vlan_id', '==', 109)
- name: Remove VLAN
ios_vlans:
config:
- vlan_id: 109
state: deleted
Hi @donnerhacke,
PLAY [Test VLAN Bug] ***********************************************************
TASK [Create VLAN] *************************************************************
changed: [10.8.xx.76]
TASK [Validate VLAN] ***********************************************************
ok: [10.8.xx.76]
TASK [Show output] *************************************************************
ok: [10.8.xx.76] => {
"res.stdout": [
"109 test vlan active"
]
}
TASK [Gather facts] ************************************************************
ok: [10.8.xx.76]
TASK [Show facts] **************************************************************
ok: [10.8.xx.76] => {
"ansible_facts.network_resources.vlans | selectattr('vlan_id', '==', 109)": [
{
"mtu": 1500,
"name": "test",
"shutdown": "disabled",
"vlan_id": 109
}
]
}
TASK [Remove VLAN] *************************************************************
changed: [10.8.xx.76]
PLAY RECAP *********************************************************************
10.8.xx.76 : ok=6 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Sharing the output of the above play you have shared, I see this issue has been fixed over the latest version of the collection. Please pull in the latest release. Closing the issue. Thank You.
Your own output shows, that the bug is NOT fixed. So why do you close the ticket?
SUMMARY
Cisco IOS and ios_vlan can work well with VLAN, which have spaces in their names. ios_facts can not parse such names.
ISSUE TYPE
COMPONENT NAME
cisco.ios.ios_facts
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
FreeBSD 13.0-STABLE #3 stable/13-n245475-bb9dcbf1a243
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS