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

NCLU Commands Module Broken when using any Looping #425

Open
arqteqnet opened this issue Apr 13, 2022 · 1 comment
Open

NCLU Commands Module Broken when using any Looping #425

arqteqnet opened this issue Apr 13, 2022 · 1 comment
Labels
bug This issue/PR relates to a bug

Comments

@arqteqnet
Copy link

I used this extensively in the past and verified this worked as expected, but somewhere along the line this has been broken.

SUMMARY

community.network.nclu.commands module fails to function when the commands being passed to the module is using a loop mechanism.
I have confirmed using with_items and also lines from a file with_lines.

Working Example:

  tasks:

  - name: Add config example
    community.network.nclu:
      commands:
          - add hostname leaf0-prod
          - add bond peerlink bond slaves swp16
          - add bond peerlink bond mode 802.3ad
          - add bond peerlink mtu 9216
          - add bond peerlink bond slaves swp32
          - add bond peerlink bond mode 802.3ad
          - add bond peerlink mtu 9216

Broken Example:

    - name: iterate nclu commands
      community.network.nclu:
        commands:
          "{{item}}"
      with_lines: cat "{{ config_file }}"
      when: item | length > 1

Error Output:
failed: [host] (item=add bond peerlink bond slaves swp16) => {"ansible_loop_var": "item", "changed": false, "item": "add bond peerlink bond slaves swp16", "msg": "Error in pending config. You may want to view `net pending` on this target."}

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Cumulus Linux NCLU Commands Module

ANSIBLE VERSION
Ansible Versions:
ansible [core 2.12.1]
  python version = 3.10.1 (main, Dec 18 2021, 23:53:45) [GCC 11.1.0]
  jinja version = 3.0.3
  libyaml = True

COLLECTION VERSION

-->

community.network 3.1.0

CONFIGURATION
No Output

OS / ENVIRONMENT

Cumulus Linux 4.0

STEPS TO REPRODUCE

Steps to reproduce can be performed using any looping with nclu commands module.

Working playbook
---
- name: Generate, Assemble and Config to Cumulus devices, default with no action
  hosts:
    - cumulus
  become: True
  gather_facts: yes

  vars:
    file_name: all_config
    playbook_name: all-settings.yml

  vars_prompt:
    - name: vars_prompt_username
      prompt: "Enter your Cumulus username ?"
      private: no

  tasks:

  - name: Add Config
    community.network.nclu:
      commands:
          - add bond peerlink bond slaves swp16
          - add bond peerlink bond mode 802.3ad
          - add bond peerlink mtu 9216
          - add bond peerlink bond slaves swp32
          - add bond peerlink bond mode 802.3ad
          - add bond peerlink mtu 9216
          - add bond comp0-bm-bond bond slaves swp11
          - add bond comp0-bm-bond clag id 11
          - add bond comp0-bm-bond bond mode 802.3ad
          - add bond comp0-bm-bond bridge vids 15-18
          - add bond comp0-bm-bond mtu 9000

Broken PlayBook:

---
- name: Generate, Assemble and Config to Cumulus devices, default with no action
  remote_user: cumulus
  hosts:
    - cumulus
  become: True
  roles:
    - { role: local_build,  tags: [ always ] }
    - nclu
  connection: local
  gather_facts: yes

  vars:
    file_name: all_config
    playbook_name: all-settings.yml
    file:
      - add bond peerlink bond slaves swp16
      - add bond peerlink bond mode 802.3ad
      - add bond peerlink mtu 9216
      - add bond peerlink bond slaves swp32
      - add bond peerlink bond mode 802.3ad
      - add bond peerlink mtu 9216
      - add bond comp0-bm-bond bond slaves swp11
      - add bond comp0-bm-bond clag id 11
      - add bond comp0-bm-bond bond mode 802.3ad
      - add bond comp0-bm-bond bridge vids 15-18
      - add bond comp0-bm-bond mtu 9000

  vars_prompt:
    - name: vars_prompt_username
      prompt: "Enter your Cumulus username ?"
      private: no

  tasks:
    - name: iterate nclu commands
      community.network.nclu:
        commands:
          - "{{item}}"
      with_item: {{file}}
      when: item | length > 1
EXPECTED RESULTS

The module used to work when the module was used from this repo: https://github.com/IPvSean/ansible_nclu/blob/master/push_nclu.yml

The expected outcome is that the commands can be iterated over and added to the device.
Some where along the road, this module with loops has been broken.

ACTUAL RESULTS
failed: [cumulus_test] (item=add bond peerlink bond slaves swp16) => {"ansible_loop_var": "item", "changed": false, "item": "add bond peerlink bond slaves swp16", "msg": "Error in pending config. You may want to view `net pending` on this target."}
failed: [cumulus_test] (item=add bond peerlink bond mode 802.3ad) => {"ansible_loop_var": "item", "changed": false, "item": "add bond peerlink bond mode 802.3ad", "msg": "Error in pending config. You may want to view `net pending` on this target."}
failed: [cumulus_test] (item=add bond peerlink mtu 9216) => {"ansible_loop_var": "item", "changed": false, "item": "add bond peerlink mtu 9216", "msg": "Error in pending config. You may want to view `net pending` on this target."}
failed: [cumulus_test] (item=add bond peerlink bond slaves swp32) => {"ansible_loop_var": "item", "changed": false, "item": "add bond peerlink bond slaves swp32", "msg": "Error in pending config. You may want to view `net pending` on this target."}
failed: [cumulus_test] (item=add bond peerlink bond mode 802.3ad) => {"ansible_loop_var": "item", "changed": false, "item": "add bond peerlink bond mode 802.3ad", "msg": "Error in pending config. You may want to view `net pending` on this target."}
failed: [cumulus_test] (item=add bond peerlink mtu 9216) => {"ansible_loop_var": "item", "changed": false, "item": "add bond peerlink mtu 9216", "msg": "Error in pending config. You may want to view `net pending` on this target."}
failed: [cumulus_test] (item=add bond comp0-bm-bond bond slaves swp11) => {"ansible_loop_var": "item", "changed": false, "item": "add bond comp0-bm-bond bond slaves swp11", "msg": "Error in pending config. You may want to view `net pending` on this target."}
failed: [cumulus_test] (item=add bond comp0-bm-bond clag id 11) => {"ansible_loop_var": "item", "changed": false, "item": "add bond comp0-bm-bond clag id 11", "msg": "Error in pending config. You may want to view `net pending` on this target."}
failed: [cumulus_test] (item=add bond comp0-bm-bond bond mode 802.3ad) => {"ansible_loop_var": "item", "changed": false, "item": "add bond comp0-bm-bond bond mode 802.3ad", "msg": "Error in pending config. You may want to view `net pending` on this target."}
failed: [cumulus_test] (item=add bond comp0-bm-bond bridge vids 15-18) => {"ansible_loop_var": "item", "changed": false, "item": "add bond comp0-bm-bond bridge vids 15-18", "msg": "Error in pending config. You may want to view `net pending` on this target."}


@ansibullbot
Copy link
Collaborator

Files identified in the description:
None

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added the bug This issue/PR relates to a bug label Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug
Projects
None yet
Development

No branches or pull requests

2 participants