ansible-collections / cisco.ios

Ansible Network Collection for Cisco IOS
GNU General Public License v3.0
260 stars 160 forks source link

cisco.ios.ios_config IPv6 bug #1048

Open brunopeter opened 1 month ago

brunopeter commented 1 month ago
SUMMARY

Unable to update configuration when using IPv6 addresses. Confirmed issue occurs with both "ipv6 address" and "ipv6 dhcp relay destination" commands. Idempotency warning are triggered the first time commands are run on cisco switch. Commands are accepted and show in running config.

ISSUE TYPE
COMPONENT NAME

cisco.ios.ios_config

ANSIBLE VERSION
ansible --version
ansible [core 2.14.9]
  config file = /home/peterb/ansible/ansible.cfg
  configured module search path = ['/home/peterb/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/peterb/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.6 (main, Oct  8 2023, 05:06:43) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
Collection                    Version
----------------------------- -------
ansible.netcommon             4.1.0  
ansible.utils                 2.10.3 
cisco.ios                     4.6.1  
CONFIGURATION
OS / ENVIRONMENT

Verified against: Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500es8-UNIVERSALK9-M), Version 03.11.08.E RELEASE SOFTWARE (fc1)

Cisco IOS Software, C3560CX Software (C3560CX-UNIVERSALK9-M), Version 15.2(7)E9, RELEASE SOFTWARE (fc1)

STEPS TO REPRODUCE
- name: "Update interface"
cisco.ios.ios_config:
lines:
- "ip helper-address 192.168.1.1"
- "ip helper-address 192.168.2.2"
- "ipv6 dhcp relay destination 2001::1"
parents:
"interface Vlan99"
EXPECTED RESULTS

Vlan interface updated with IPv6 relay address(s).

ACTUAL RESULTS

Idempotency is always triggered on first run. Completes successfully on subsequent runs but changed is not triggered and configuration not saved though present in running.

ANSIBLE_NETWORK_IMPORT_MODULES: Result: {'changed': True, 'warnings': ['To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device'], 'commands': ['interface Vlan99', 'ipv6 dhcp relay destination 2001::1'], 'updates': ['interface Vlan99', 'ipv6 dhcp relay destination 2001::1'], 'banners': {}, 'invocation': {'module_args': {'lines': ['ip helper-address [192.168.1.1](https://192.168.1.1/)', 'ip helper-address [192.168.2.2](https://192.168.2.2/)', 'ipv6 dhcp relay destination 2001::1'], 'parents': ['interface Vlan99'], 'match': 'line', 'replace': 'line', 'multiline_delimiter': '@', 'defaults': False, 'backup': False, 'save_when': 'never', 'src': None, 'before': None, 'after': None, 'running_config': None, 'intended_config': None, 'backup_options': None, 'diff_against': None, 'diff_ignore_lines': None}}, '_ansible_parsed': True}

[WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device
brunopeter commented 1 month ago

It would appear that the same thing is now happening with 'ip helper-address' commands since updating to the latest collection (6.1.4).

- name: "Update interfaces DHCP"
  cisco.ios.ios_config:
    lines:
      - ip helper-address 192.168.1.1
      - ip helper-address 192.168.2.2
    parents: 
      interface Vlan99
"msg": [
        "-----STEP-1-----------------------------------------------",
        {
            "banners": {},
            "changed": true,
            "commands": [
                "interface Vlan99",
                "ip helper-address 192.168.1.1",
                "ip helper-address 192.168.2.2"
            ],
            "failed": false,
            "updates": [
                "interface Vlan99",
                "ip helper-address 192.168.1.1",
                "ip helper-address 192.168.2.2"
            ],
            "warnings": [
                "To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device"
            ]
        }
    ]
}