ansible-collections / mellanox.onyx

onyx
GNU General Public License v3.0
10 stars 14 forks source link

Onyx modules appear to not be idempotent #6

Open velomatt opened 4 years ago

velomatt commented 4 years ago
SUMMARY

I'm opening this as a documentation report because I don't know if this is a documentation issue, or if it is truly a defect with the Onyx modules.

It appears that several Onyx modules do not behave in an idempotent way. The active configuration is changed even if there are no changes that need to be made.

I am currently experiencing this behavior with the onyx_config and onyx_pfc_interface modules. Looking at the onyx_config documentation, it is possible that I am not understanding how the options available can be used to make the module behave in an idempotent way, and if that's true, I would appreciate it if some more examples could be added. However, the onyx_pfc_interface module appears to not have any way of behaving in an idempotent manner.

Examples:

With dcb priority-flow-control enable force already appearing in the active running configuration:

- name: Enable PFC
  onyx_config:
    lines:
      - dcb priority-flow-control enable force

Result:

TASK [configure_onyx_vlans : Enable PFC] 
changed: [mlnx02]

With interface ethernet 1/1-1/32 dcb priority-flow-control mode on force already appearing in the active running configuration:

- name: Enable PFC for Eth1/1
  onyx_pfc_interface:
    name: Eth1/1
    state: enabled

Result:

TASK [configure_onyx_vlans : Enable PFC for Eth1/1] 
changed: [mlnx02]

Additionally, I can confirm that the active running configuration is actually changing, as I can see the Generated at timestamp changing.

I can query the active running config myself and make changes only when I determine they are necessary, but it would be a lot simpler if the module could do it for me. Also, determining if a change needs to be made from a playbook perspective is a bit complicated, as config lines are often consolidated into a range with neighboring ports, neighboring VLAN ID's, etc (as can be seen in the above PFC example)

ISSUE TYPE
COMPONENT NAME

onyx_config.py onyx_pfc_interface.py

ANSIBLE VERSION
ansible 2.9.10
  config file = /home/xxxx/ansible.cfg
  configured module search path = ['/home/xxxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.8 (default, Apr  2 2020, 13:34:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
ghost commented 3 years ago

I see the same issue with the onyx_l3_interface module.

Example task

    - name: Configure L3 interface for MLAG
      onyx_l3_interface:
        name: "Vlan 4000"
        ipv4: "1.1.1.1/30"

Result

TASK [Configure L3 interface for MLAG] ****************************************************************
changed: [hcc-swh1] => {"changed": true, "commands": ["interface vlan 4000 ip address 1.1.1.1/30"]}

TASK [debug] ******************************************************************************************
ok: [hcc-swh1] => {
    "result": {
        "changed": true,
        "commands": [
            "interface vlan 4000 ip address 1.1.1.1/30"
        ],
        "failed": false
    }
}

Switch logs

Oct  8 11:52:26 hcc-swh1 mgmtd[5865]: [mgmtd.NOTICE]: User admin (local user admin) authentication method: local
Oct  8 11:52:26 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: PORT_FWD_MODE cli module initialized.
Oct  8 11:52:26 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: UDK: cli module initialized.
Oct  8 11:52:28 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: cli store init done
Oct  8 11:52:28 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: lib_ui_api_poll_for_ui_enable UI open, HWd permission:[true]
Oct  8 11:52:28 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: lib_ui_api_poll_for_ui_enable first successful query from hwd for this UI after:[15761:45], User access allowed yet:[true].
Oct  8 11:52:28 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: ports_lib_init_current_state(), ports_lib.c:1822, build 1: Enter ports_lib_init_current_state
Oct  8 11:52:28 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: ports_lib_init_current_state(), ports_lib.c:1836, build 1: Exit ports_lib_init_current_state, 34 bindings
Oct  8 11:52:28 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: : Fetched System RAM: 7990, System RAM: 3, Chip Type : 8
Oct  8 11:52:29 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Executing command: enable (Node command: enable)
Oct  8 11:52:29 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Entering enable mode
Oct  8 11:52:29 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Executing command: no cli session paging enable (Node command: no cli session paging enable)
Oct  8 11:52:30 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Executing command: show version | json-print (Node command: show version)
Oct  8 11:52:30 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Executing command: show hosts | include Hostname (Node command: show hosts)
Oct  8 11:52:30 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Executing command: show interfaces vlan | json-print (Node command: show interfaces vlan)
Oct  8 11:52:30 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Executing command: configure terminal (Node command: configure terminal)
Oct  8 11:52:30 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Entering configuration mode
Oct  8 11:52:30 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Executing command: interface vlan 4000 ip address 1.1.1.1/30 (Node command: interface vlan * ip address *)
Oct  8 11:52:31 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Executing command: exit (Node command: exit)
Oct  8 11:52:31 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: Leaving configuration mode
Oct  8 11:52:31 hcc-swh1 cli[6809]: [cli.NOTICE]: user admin: CLI exiting
mariolenz commented 1 year ago

This collection is currently unmaintained, so nobody will work on your issue. See ansible-community/community-topics#136 for more information.

If you're interested in mainting this collection yourself, please read the maintainer guidelines and let us know if you want to take over on Matrix: #community:ansible.com or on irc.libera.chat: #ansible-community.