ansible-collections / dellemc.os10

GNU General Public License v3.0
37 stars 49 forks source link

os10_interfaces fails to remove vlan interface ipv6 address #60

Open ajlitzin opened 3 years ago

ajlitzin commented 3 years ago
SUMMARY

When a vlan interface has an ipv6 address configured neither setting ipv6_and_mask to empty nor setting state_ipv6 to absent removes the configured ipv6 address from the vlan interface. In contrast, setting the ip_and_mask variable to empty does remove the ipv4 vlan interface IP as expected.

ISSUE TYPE
COMPONENT NAME

os10_interface

ANSIBLE VERSION
ansible 2.10.3
  config file = None
  configured module search path = ['/Users/alitzi000/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/alitzi000/Documents/venv/ansible-dellos10/lib/python3.8/site-packages/ansible
  executable location = /Users/alitzi000/Documents/venv/ansible-dellos10/bin/ansible
  python version = 3.8.5 (default, Jul 21 2020, 10:42:08) [Clang 11.0.0 (clang-1100.0.33.17)]
CONFIGURATION
No output generated
OS / ENVIRONMENT

Target test switch info:

show version

Dell EMC Networking OS10 Enterprise Copyright (c) 1999-2020 by Dell Inc. All Rights Reserved. OS Version: 10.5.1.2 Build Version: 10.5.1.2.167 Build Time: 2020-05-18T17:49:15+0000 System Type: S5232F-ON Architecture: x86_64 Up Time: 1 week 4 days 02:27:09

STEPS TO REPRODUCE

Start with a switch that has two existing vlan interfaces each with both an IPv4 and an IPv6 address. Make a simple group or host var file that defines the os10_interface dictionary with settings that should cause the os10_interface Ansible role (part of the dellemc.os10 Ansible collection) to delete the IPv4 and IPv6 ip addresses from the two vlan interfaces. Run the play and note that only the ipv4 address is removed.

- hosts: mleaf
  connection: network_cli
  collections:
     - dellemc.os10
  roles:
    - os10_interface
ansible_network_os: dellemc.os10.os10
ansible_user: ansible

os10_cfg_generate: False
build_dir: dellos10-cfg-gen

os10_interface:
    vlan 101:
      ip_and_mask:
      ipv6_and_mask: 
      state_ipv6: absent
    vlan 201:
      ip_and_mask:
      ipv6_and_mask:
      state_ipv6: absent
EXPECTED RESULTS

Both the ipv4 and ipv6 ip addresses are removed from the interface config for vlan interfaces 101 and 201

ACTUAL RESULTS

Only the IPv4 address was removed. The IPv6 address was not removed. Configuration before play:

interface vlan101
 description vMgmt
 no shutdown
 mtu 9216
 ip address 10.100.1.30/27
 ipv6 address 10:100:1::ffff:ffff:fffe/80
 no vrrp mode active-active
!
interface vlan201
 description vSAN
 no shutdown
 mtu 9216
 ip address 10.100.2.30/27
 ipv6 address 10:100:2::ffff:ffff:fffe/80
 no vrrp mode active-active
!

Configuration after play:

interface vlan101
 description vMgmt
 no shutdown
 mtu 9216
 ipv6 address 10:100:1::ffff:ffff:fffe/80
 no vrrp mode active-active
!
interface vlan201
 description vSAN
 no shutdown
 mtu 9216
 ipv6 address 10:100:2::ffff:ffff:fffe/80
 no vrrp mode active-active
!
$ ansible-playbook -i inventory_test.ini leaf_vxlan.yaml  --ask-pass --diff -vvvv -l leaf01
ansible-playbook 2.10.3
  config file = None
  configured module search path = ['/Users/alitzi000/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/alitzi000/Documents/venv/ansible-dellos10/lib/python3.8/site-packages/ansible
  executable location = /Users/alitzi000/Documents/venv/ansible-dellos10/bin/ansible-playbook
  python version = 3.8.5 (default, Jul 21 2020, 10:42:08) [Clang 11.0.0 (clang-1100.0.33.17)]
No config file found; using defaults
SSH password: 
setting up inventory plugins
host_list declined parsing /Users/alitzi000/Documents/git-repos/github.comcast.com/dellos-ansible-testing/inventory_test.ini as it did not pass its verify_file() method
script declined parsing /Users/alitzi000/Documents/git-repos/github.comcast.com/dellos-ansible-testing/inventory_test.ini as it did not pass its verify_file() method
auto declined parsing /Users/alitzi000/Documents/git-repos/github.comcast.com/dellos-ansible-testing/inventory_test.ini as it did not pass its verify_file() method
yaml declined parsing /Users/alitzi000/Documents/git-repos/github.comcast.com/dellos-ansible-testing/inventory_test.ini as it did not pass its verify_file() method
Parsed /Users/alitzi000/Documents/git-repos/github.comcast.com/dellos-ansible-testing/inventory_test.ini inventory source with ini plugin
Loading collection dellemc.os10 from /Users/alitzi000/.ansible/collections/ansible_collections/dellemc/os10
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
Loading callback plugin default of type stdout, v2.0 from /Users/alitzi000/Documents/venv/ansible-dellos10/lib/python3.8/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: leaf_vxlan.yaml ******************************************************************************************************
Positional arguments: leaf_vxlan.yaml
verbosity: 4
ask_pass: True
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
diff: True
inventory: ('/Users/alitzi000/Documents/git-repos/github.comcast.com/dellos-ansible-testing/inventory_test.ini',)
subset: leaf01
forks: 5
1 plays in leaf_vxlan.yaml

PLAY [mleaf_az1] ***************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************
task path: /Users/alitzi000/Documents/git-repos/github.comcast.com/dellos-ansible-testing/leaf_vxlan.yaml:1
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
Loading collection ansible.netcommon from /Users/alitzi000/.ansible/collections/ansible_collections/ansible/netcommon
<172.17.100.32> attempting to start connection
<172.17.100.32> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /Users/alitzi000/Documents/venv/ansible-dellos10/bin/ansible-connection
<172.17.100.32> local domain socket does not exist, starting it
<172.17.100.32> control socket path is /Users/alitzi000/.ansible/pc/9f44018a20
<172.17.100.32> redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
<172.17.100.32> Loading collection ansible.netcommon from /Users/alitzi000/.ansible/collections/ansible_collections/ansible/netcommon
<172.17.100.32> Loading collection dellemc.os10 from /Users/alitzi000/.ansible/collections/ansible_collections/dellemc/os10
<172.17.100.32> local domain socket listeners started successfully
<172.17.100.32> loaded cliconf plugin ansible_collections.dellemc.os10.plugins.cliconf.os10 from path /Users/alitzi000/.ansible/collections/ansible_collections/dellemc/os10/plugins/cliconf/os10.py for network_os dellemc.os10.os10
<172.17.100.32> 
<172.17.100.32> local domain socket path is /Users/alitzi000/.ansible/pc/9f44018a20
<172.17.100.32> ESTABLISH LOCAL CONNECTION FOR USER: alitzi000
<172.17.100.32> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0 `"&& mkdir "` echo /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803223.2874959-760-74144005300203 `" && echo ansible-tmp-1609803223.2874959-760-74144005300203="` echo /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803223.2874959-760-74144005300203 `" ) && sleep 0'
<leaf01> Attempting python interpreter discovery
<172.17.100.32> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<leaf01> Python interpreter discovery fallback (unsupported platform for extended discovery: darwin)
Using module file /Users/alitzi000/Documents/venv/ansible-dellos10/lib/python3.8/site-packages/ansible/modules/setup.py
<172.17.100.32> PUT /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/tmp2decnz1r TO /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803223.2874959-760-74144005300203/AnsiballZ_setup.py
<172.17.100.32> EXEC /bin/sh -c 'chmod u+x /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803223.2874959-760-74144005300203/ /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803223.2874959-760-74144005300203/AnsiballZ_setup.py && sleep 0'
<172.17.100.32> EXEC /bin/sh -c '/usr/bin/python /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803223.2874959-760-74144005300203/AnsiballZ_setup.py && sleep 0'
<172.17.100.32> EXEC /bin/sh -c 'rm -f -r /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803223.2874959-760-74144005300203/ > /dev/null 2>&1 && sleep 0'
[WARNING]: Platform darwin on host leaf01 is using the discovered Python interpreter at /usr/bin/python, but future
installation of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information.
ok: [leaf01]
META: ran handlers

TASK [dellemc.os10.os10_interface : Generating interface configuration for os10] ***********************************************
task path: /Users/alitzi000/.ansible/collections/ansible_collections/dellemc/os10/roles/os10_interface/tasks/main.yml:3
skipping: [leaf01] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
Loading collection ansible.netcommon from /Users/alitzi000/.ansible/collections/ansible_collections/ansible/netcommon

TASK [dellemc.os10.os10_interface : Provisioning interface configuration for os10] *********************************************
task path: /Users/alitzi000/.ansible/collections/ansible_collections/dellemc/os10/roles/os10_interface/tasks/main.yml:11
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
<172.17.100.32> attempting to start connection
<172.17.100.32> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /Users/alitzi000/Documents/venv/ansible-dellos10/bin/ansible-connection
<172.17.100.32> found existing local domain socket, using it!
<172.17.100.32> updating play_context for connection
<172.17.100.32> 
<172.17.100.32> local domain socket path is /Users/alitzi000/.ansible/pc/9f44018a20
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
<172.17.100.32> ESTABLISH LOCAL CONNECTION FOR USER: alitzi000
<172.17.100.32> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0 `"&& mkdir "` echo /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803235.205394-828-49030170558119 `" && echo ansible-tmp-1609803235.205394-828-49030170558119="` echo /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803235.205394-828-49030170558119 `" ) && sleep 0'
Using module file /Users/alitzi000/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<172.17.100.32> PUT /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/tmpzaasua3u TO /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803235.205394-828-49030170558119/AnsiballZ_os10_config.py
<172.17.100.32> EXEC /bin/sh -c 'chmod u+x /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803235.205394-828-49030170558119/ /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803235.205394-828-49030170558119/AnsiballZ_os10_config.py && sleep 0'
<172.17.100.32> EXEC /bin/sh -c '/usr/bin/python /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803235.205394-828-49030170558119/AnsiballZ_os10_config.py && sleep 0'
<172.17.100.32> EXEC /bin/sh -c 'rm -f -r /Users/alitzi000/.ansible/tmp/ansible-local-735g2elp9p0/ansible-tmp-1609803235.205394-828-49030170558119/ > /dev/null 2>&1 && sleep 0'
changed: [leaf01] => {
    "changed": true,
    "commands": [
        "interface vlan101",
        "no ip address",
        "interface vlan201",
        "no ip address",
        "commit"
    ],
    "invocation": {
        "module_args": {
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": null,
            "config": null,
            "lines": null,
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": false,
            "src": " \ninterface vlan101\n\n\n\n\n \n no ip address\n \n\n\n\n\n\n\n \ninterface vlan201\n\n\n\n\n \n no ip address\n \n\n\n\n\n\n\n",
            "update": "merge"
        }
    },
    "saved": false,
    "updates": [
        "interface vlan101",
        "no ip address",
        "interface vlan201",
        "no ip address",
        "commit"
    ]
}
META: ran handlers
META: ran handlers

PLAY RECAP *********************************************************************************************************************
leaf01                     : ok=2    changed=1    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   
prasadapr commented 10 months ago

Hi @ajlitzin, already its fixed. Pls can we close this issue.