Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to delete a VLAN on Cisco switch #1089

Open
sjwk opened this issue Jun 19, 2024 · 0 comments
Open

Unable to delete a VLAN on Cisco switch #1089

sjwk opened this issue Jun 19, 2024 · 0 comments

Comments

@sjwk
Copy link

sjwk commented Jun 19, 2024

SUMMARY

None of the methods I'd expect to delete a VLAN actually delete it from the switch.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.ios.ios_vlans

ANSIBLE VERSION
ansible [core 2.15.8]
  config file = /usr/local/keble/ansible/ansible.cfg
  configured module search path = ['/home/keble/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /venv/ansible/lib/python3.9/site-packages/ansible
  ansible collection location = /usr/local/keble/ansible/collections
  executable location = /venv/ansible/bin/ansible
  python version = 3.9.5 (default, Nov 23 2021, 15:27:38) [GCC 9.3.0] (/venv/ansible/bin/python3.9)
  jinja version = 3.1.3
  libyaml = True

COLLECTION VERSION
# /usr/local/keble/ansible/collections/ansible_collections
Collection Version
---------- -------
cisco.ios  9.0.0

# /venv/ansible/lib/python3.9/site-packages/ansible_collections
Collection Version
---------- -------
cisco.ios  4.6.1

CONFIGURATION
ANSIBLE_NOCOWS(/usr/local/keble/ansible/ansible.cfg) = True
CACHE_PLUGIN(/usr/local/keble/ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/usr/local/keble/ansible/ansible.cfg) = /usr/local/keble/ansible/cache
COLLECTIONS_PATHS(/usr/local/keble/ansible/ansible.cfg) = ['/usr/local/keble/ansible/collections']
CONFIG_FILE() = /usr/local/keble/ansible/ansible.cfg
DEFAULT_HOST_LIST(/usr/local/keble/ansible/ansible.cfg) = ['/usr/local/keble/ansible/hosts']
DEFAULT_REMOTE_USER(/usr/local/keble/ansible/ansible.cfg) = ansdeploy
DEFAULT_ROLES_PATH(/usr/local/keble/ansible/ansible.cfg) = ['/usr/local/keble/ansible/roles']
HOST_KEY_CHECKING(/usr/local/keble/ansible/ansible.cfg) = False
INTERPRETER_PYTHON(/usr/local/keble/ansible/ansible.cfg) = auto

OS / ENVIRONMENT

Ubuntu 20.04 running in venv
test switch Cisco 2960 running IOS 15.0(2)SE11

STEPS TO REPRODUCE

On switch create a VLAN, let's use ID 812.
Run the below playbook, using the different tags to try different methods.

- hosts: it-1.switch.keb
  gather_facts: true
  tasks:
          - cisco.ios.ios_vlans:
                    config:
                      - vlan_id: 812
                    state: deleted
            tags: delete1
          - cisco.ios.ios_vlans:
                    config:
                      - vlan_id: 812
                    state: purged
            tags: delete2
          - cisco.ios.ios_interfaces:
                    config:
                      - name: Vlan812
                    state: deleted
            tags: delete3
EXPECTED RESULTS

One of the methods to actually delete the VLAN.

ACTUAL RESULTS

With tag 'delete1' (state: deleted) it clears the name, state, mtu of the VLAN and shuts it down but leaves the VLAN present
With tag 'delete2' (state: purged) it runs 'no vlan configuration 812' which with an unconfigured VLAN does nothing but leaves the VLAN present.
Trying a different approach, 'delete3' (state: deleted using ios_interfaces instead, also tried this with state: purged) it doesn't even seem to detect there's a VLAN that needs deleting and does nothing at all. The documentation shows an example using a VLAN.

I don't know whether it's a bug, or simply that I'm not using the right modules. There's no documentation that I could see on the ios_vlans page to say what should happen with state: purged, and examples for state: deleted that show it actually deleting the VLAN. I'm just making the assumption here that one of these methods ought to delete the VLAN that the same module created.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant