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

[lag_interfaces] #819

Open
Egor-Ozhmegoff opened this issue Feb 20, 2024 · 0 comments
Open

[lag_interfaces] #819

Egor-Ozhmegoff opened this issue Feb 20, 2024 · 0 comments

Comments

@Egor-Ozhmegoff
Copy link

Egor-Ozhmegoff commented Feb 20, 2024

SUMMARY

I tried to create lag interfaces but i got an error.

FAILED! => {"changed": false, "module_stderr": "'NoneType' object is not iterable", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"}

I round the reason for this bug. That happened because i created port-channel without any child interfaces. I manually added one ethernet interface to port-channel and problem had gone.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.nxos.nxos_lag_interfaces

ANSIBLE VERSION
ansible [core 2.16.2]
  config file = /home/eozhmegov/nautobot-device-config/ansible.cfg
  configured module search path = ['/home/eozhmegov/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/eozhmegov/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/eozhmegov/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/eozhmegov/.local/bin/ansible
  python version = 3.10.6 (main, Aug  2 2022, 15:11:03) [GCC 7.5.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
cisco.nxos  5.3.0
CONFIGURATION

OS / ENVIRONMENT

Ubuntu 20.04

STEPS TO REPRODUCE

variables:

lacp_interfaces:
  - group: 100
    ip: 192.168.0.0/31
    children:
      - Ethernet1/47
      - Ethernet1/48

role:

---
- name: Interfaces base config
  cisco.nxos.nxos_interfaces:
    config: >-
      [
        {% for item in lacp_interfaces %}
        {
          "name": "port-channel{{ item.group }}",
          "description": "{{ item.description | default(omit)}}",
          "enabled": "{{ item.state | default(true) }}",
          "mtu": "{{ item.mtu | default("9216") }}",
          {% if item.ip is defined %}
          "mode": "layer3",
          {% else %}
          "mode": "layer2",
          {% endif %}
        },
        {% if item.children is defined %}
        {% for child in item.children %}
        {
          "name": "{{ child }}",
          "description": "{{ item.description | default(omit)}}",
          "enabled": "{{ item.state | default(true) }}",
          "mtu": "{{ item.mtu | default("9216") }}",
          {% if item.ip is defined %}
          "mode": "layer3",
          {% else %}
          "mode": "layer2",
          {% endif %}
        },
        {% endfor %}
        {% endif %}
        {% endfor %}
      ]
    state: replaced
  register: output
  notify: debug

- meta: flush_handlers


- name: L2 interface mode
  cisco.nxos.nxos_l2_interfaces:
    config: >-
      [
        {% if 'leaf' in group_names %}
        {% set native_vlan = 331 %}
        {% endif %}
        {% for item in lacp_interfaces %}
        {% if item.ip is undefined %}
          {
            "name": "port-channel{{ item.group }}",
          {% if item.vlan is defined %}
            "mode": "access",
            "access": { "vlan": "{{ item.vlan }}",
          {% else %}
            "mode": "trunk",
            "trunk": { "native_vlan": "{{ native_vlan | default(omit) }}" },
          {% endif %}
          },
        {% if item.children is defined %}
        {% for child in item.children %}
          {
            "name": "port-channel{{ item.group }}",
          {% if item.vlan is defined %}
            "mode": "access",
            "access": { "vlan": "{{ item.vlan }}",
          {% else %}
            "mode": "trunk",
            "trunk": { "native_vlan": "{{ native_vlan | default(omit) }}" },
          {% endif %}
          },
        {% endfor %}
        {% endif %}
        {% endif %}
        {% endfor %}
      ]
    state: replaced
  register: output
  ignore_errors: True
  notify: debug

- meta: flush_handlers

- name: LACP interface
  cisco.nxos.nxos_lag_interfaces:
    config: >-
      [ 
        {% for item in lacp_interfaces %}
        {
          "name": "port-channel{{ item.group }}",
          "members": [ 
            {% if item.children is defined %}
            {% for child in item.children %}
            { 
              "member": "{{ child }}",
              "mode": "active" 
            }, 
            {% endfor %}
            {% else %}
            { 
              "member": "Ethernet1/{{ item.group }}",
              "mode": "active"
            }
            {% endif %}
          ]
        },
        {% endfor %}
      ]
    state: replaced
  register: output
  notify: debug

- meta: flush_handlers

- name: L3 interface mode
  cisco.nxos.nxos_l3_interfaces:
    config: >-
      [
        {% for item in lacp_interfaces %}
        {% if item.ip is defined %}
        {
          "name": "port-channel{{ item.group }}",
          "ipv4": [
            { "address": "{{ item.ip }}" }
          ]
        },
        {% endif %}
        {% endfor %}
      ]
    state: replaced
  register: output
  ignore_errors: True
  notify: debug

- meta: flush_handlers

- name: LACP mode
  cisco.nxos.nxos_lacp_interfaces:
    config: >-
      [
        {% for item in lacp_interfaces %}
        {
          "name": "port-channel{{ item.group }}",
          "mode": "delay",
        },
        {% endfor %}
      ]
    state: replaced
  when: "'leaf' in group_names"
  register: output
  notify: debug

- meta: flush_handlers

- name: VPC
  cisco.nxos.nxos_vpc_interface:
    portchannel: "{{ item.group }}"
    vpc: "{{ item.group }}"
  loop: "{{ lacp_interfaces }}"
  when:
    - vpc is defined
    - vpc == 'True'
  register: output
  notify: debug_loop

- meta: flush_handlers
EXPECTED RESULTS

Interfaces should be added to port-channel

ACTUAL RESULTS
Tuesday 20 February 2024  08:00:51 +0000 (0:00:00.010)       0:00:14.700 ******
Loading collection ansible.utils from /home/eozhmegov/.local/lib/python3.10/site-packages/ansible_collections/ansible/utils
redirecting (type: action) cisco.nxos.nxos_lag_interfaces to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_lag_interfaces to cisco.nxos.nxos
<bgw01> attempting to start connection
<bgw01> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /home/eozhmegov/.local/bin/ansible-connection
<bgw01> found existing local domain socket, using it!
<bgw01> updating play_context for connection
<bgw01> Loading collection ansible.builtin from
<bgw01> local domain socket path is /home/eozhmegov/.ansible/pc/c0bc4a5c49
redirecting (type: action) cisco.nxos.nxos_lag_interfaces to cisco.nxos.nxos
<bgw01> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<bgw01> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.nxos.nxos_lag_interfaces  at /home/eozhmegov/.local/lib/python3.10/site-packages/ansible_collections/cisco/nxos/plugins/modules/nxos_lag_interfaces.py
<bgw01> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.nxos.nxos_lag_interfaces
<bgw01> ANSIBLE_NETWORK_IMPORT_MODULES: complete
<bgw01> ANSIBLE_NETWORK_IMPORT_MODULES: Result: {'failed': True, '_ansible_parsed': False, 'module_stdout': '', 'module_stderr': "'NoneType' object is not iterable", 'msg': 'MODULE FAILURE\nSee stdout/stderr for the exact error'}
fatal: [bgw01]: FAILED! => {
    "changed": false,
    "module_stderr": "'NoneType' object is not iterable",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"
}
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