ansible-collections / dellemc.os10

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

os10_interface does not provide for setting individual flowcontrol modes #111

Open G3rmN3rd opened 2 years ago

G3rmN3rd commented 2 years ago
SUMMARY

When using the os10_interface role, the flowcontrol.mode does not adhere to YAML syntax rules if you need to configure differing flow control modes.

ISSUE TYPE
COMPONENT NAME

os10_interface role

ANSIBLE VERSION
ansible 2.9.6
  config file = /home/khydock/code/vxrail-cluster-1/ansible.cfg
  configured module search path = ['/home/khydock/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
COLLECTION VERSION
khydock@autolinux4:~/code/vxrail-cluster-1$ sudo ansible-galaxy collection list dellemc.os10
usage: ansible-galaxy collection [-h] COLLECTION_ACTION ...
ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')
khydock@autolinux4:~/code/vxrail-cluster-1$ sudo ansible-galaxy collection install dellemc.os10
Process install dependency map
Starting collection install process
Installing 'dellemc.os10:1.1.1' to '/root/.ansible/collections/ansible_collections/dellemc/os10'
Installing 'ansible.netcommon:2.5.0' to '/root/.ansible/collections/ansible_collections/ansible/netcommon'
Installing 'ansible.utils:2.4.3' to '/root/.ansible/collections/ansible_collections/ansible/utils'
CONFIGURATION
khydock@autolinux4:~/code/vxrail-cluster-1$ ansible-config dump --only-changed
DEFAULT_HOST_LIST(/home/khydock/code/vxrail-cluster-1/ansible.cfg) = ['/home/khydock/code/vxrail-cluster-1/hosts']
NETWORK_GROUP_MODULES(/home/khydock/code/vxrail-cluster-1/ansible.cfg) = ['os10']
OS / ENVIRONMENT

Dell S5348F-ON, OS10 v10.5.2.

STEPS TO REPRODUCE

[Project Directory]

khydock@autolinux4:~/code/vxrail-cluster-1$ tree ./
./
├── ansible.cfg
├── archive
├── backup
├── hosts
├── host_vars
│   └── SW-07-VX-01.yml
├── README.md
├── temp
└── vxleaf-setup.yml

[hosts]

[all]
SW-07-VX-01 ansible_host=172.32.100.50
SW-07-VX-02 ansible_host=172.32.100.51
[vxleafs]
SW-07-VX-01

[vxleaf-setup.yml]

---
- hosts: vxleafs
  gather_facts: True
  connection: network_cli
  collections:
    - dellemc.os10
  roles:
#    - dellemc.os10.os10_system
#    - dellemc.os10.os10_vlan
    - dellemc.os10.os10_interface
#  tasks:
...

[host_vars file Try 1]

---
hostname: SW-07-VX-01
ansible_become: yes
ansible_become_method: enable
ansible_network_os: dellemc.os10.os10
build_dir: /home/khydock/code/vxrail-cluster-1/temp
os10_system:
  hostname: SW-07-VX-01

os10_vlan:
    vlan 340:
      description: Server Network
      tagged_members:
        - port: ethernet 1/1/1
          state: present
        - port: ethernet 1/1/2
          state: present
        - port: ethernet 1/1/3
          state: present
        - port: ethernet 1/1/4

os10_interface:
  ethernet 1/1/1:
    desc: 07-VX-01 Server Network Primary
    switchport: true
    portmode: trunk
    flowcontrol:
      state: "present"
      mode: "receive"
      enable: "off"
    flowcontrol:
      state: "present"
      mode: "transmit"
      enable: "on"
    admin: "up"
...

I have also tried: [host_vars file Try 2]

---
hostname: SW-07-VX-01
ansible_become: yes
ansible_become_method: enable
ansible_network_os: dellemc.os10.os10
build_dir: /home/khydock/code/vxrail-cluster-1/temp
os10_system:
  hostname: SW-07-VX-01

os10_vlan:
    vlan 340:
      description: Server Network
      tagged_members:
        - port: ethernet 1/1/1
          state: present
        - port: ethernet 1/1/2
          state: present
        - port: ethernet 1/1/3
          state: present
        - port: ethernet 1/1/4

os10_interface:
  ethernet 1/1/1:
    desc: 07-VX-01 Server Network Primary
    switchport: true
    portmode: trunk
    flowcontrol:
      - mode: "receive"
        enable: "off"
        state: present
      - mode: "transmit"
        enable: "on"
        state: present
    admin: "up"

[With host_vars file Try 1]

khydock@autolinux4:~/code/vxrail-cluster-1$ ansible-playbook -i ./hosts vxleaf-setup.yml

PLAY [vxleafs] **************************************************************************************************************************************************************************
[WARNING]: While constructing a mapping from /home/khydock/code/vxrail-cluster-1/host_vars/SW-07-VX-01.yml, line 24, column 5, found a duplicate dict key (flowcontrol). Using last
defined value only.

TASK [Gathering Facts] ******************************************************************************************************************************************************************
ok: [SW-07-VX-01]

TASK [os10_interface : Generating interface configuration for os10] *********************************************************************************************************************
skipping: [SW-07-VX-01]

TASK [os10_interface : Provisioning interface configuration for os10] *******************************************************************************************************************
ok: [SW-07-VX-01]

PLAY RECAP ******************************************************************************************************************************************************************************
SW-07-VX-01                : ok=2    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   

[With host_vars file Try 2]

khydock@autolinux4:~/code/vxrail-cluster-1$ ansible-playbook -i ./hosts vxleaf-setup.yml

PLAY [vxleafs] **************************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************
ok: [SW-07-VX-01]

TASK [os10_interface : Generating interface configuration for os10] *********************************************************************************************************************
skipping: [SW-07-VX-01]

TASK [os10_interface : Provisioning interface configuration for os10] *******************************************************************************************************************
ok: [SW-07-VX-01]

PLAY RECAP ******************************************************************************************************************************************************************************
SW-07-VX-01                : ok=2    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0  
EXPECTED RESULTS
SW-07-VX-01# show running-configuration | find ethernet1/1/1
interface ethernet1/1/1
 description "07-VX-01 Server Network Primary"
 no shutdown
 switchport mode trunk
 switchport access vlan 1
 switchport trunk allowed vlan 340
 flowcontrol receive off
 flowcontrol transmit on
!
ACTUAL RESULTS
SW-07-VX-01# show running-configuration | find ethernet1/1/1
interface ethernet1/1/1
 description "07-VX-01 Server Network Primary"
 no shutdown
 switchport mode trunk
 switchport access vlan 1
 switchport trunk allowed vlan 340
 flowcontrol receive on
 flowcontrol transmit on
!
G3rmN3rd commented 2 years ago
Update:

Granted the issue can be rectified via a direct task overwrite using os10_config: [Updated vxleaf-setup.yml]

---
- hosts: vxleafs
  gather_facts: True
  connection: network_cli
  collections:
    - dellemc.os10
  roles:
#    - dellemc.os10.os10_system
#    - dellemc.os10.os10_vlan
    - dellemc.os10.os10_interface
  tasks:
    - name: Flowcontrol ethernet 1/1/1
      os10_config:
        lines:
          - flowcontrol receive on
          - flowcontrol transmit off
        before: ['interface ethernet 1/1/1']

    - name: Flowcontrol ethernet 1/1/2
      os10_config:  
        lines:
          - flowcontrol receive on
          - flowcontrol transmit off
        before: ['interface ethernet 1/1/2']

    - name: Flowcontrol ethernet 1/1/3
      os10_config:  
        lines:
          - flowcontrol receive on
          - flowcontrol transmit off
        before: ['interface ethernet 1/1/3']

    - name: Flowcontrol ethernet 1/1/4
      os10_config:  
        lines:
          - flowcontrol receive on
          - flowcontrol transmit off
        before: ['interface ethernet 1/1/4']
...

However this workaround makes the playbook less scale-able for larger operations involving leaf-spine architecture. I still consider updating the role to allow for flow control multi-line variance, value-added work.

prasadapr commented 2 years ago

@G3rmN3rd, thanks for the complete details. As you mentioned above we can directly overwrite the configuration using os10_config:

we can achieve the good scale-able for larger operations using the below playbook. we no need to configure flow control for each interface one by one. In one shot we can configure flow control for all/multiple interfaces.

Find the playbook for the reference:

root@UBUNTU18-VM-38-024:~/os10_collections# cat OS10_flowcontromodes_issue-111.yaml

---
- hosts: datacenter
  gather_facts: true
  connection: network_cli
  collections:
   - dellemc.os10

  tasks:
    - name: create vlan 340
      os10_config:
         lines:
          - interface vlan 340

    - name: configure Flowcontrol for ethernet 1/1/1-1/1/3
      os10_config:
         lines:
          - interface range ethernet 1/1/1-1/1/3
          - no shutdown
          - switchport mode trunk
          - switchport trunk allowed vlan 340
          - flowcontrol receive off
          - flowcontrol transmit on

    - name: configure Flowcontrol for ethernet 1/1/4-1/1/6
      os10_config:
         lines:
          - interface range ethernet 1/1/4-1/1/6
          - no shutdown
          - switchport mode trunk
          - switchport trunk allowed vlan 340
          - flowcontrol receive on
          - flowcontrol transmit on
prasadapr commented 2 years ago

Find the device Output and execution logs:

Device side configuration before applying the playbook:

OS10(conf-range-eth1/1/1-1/1/6)# show configuration
!
interface ethernet1/1/1
 no shutdown
 switchport access vlan 1
 flowcontrol receive off
!
interface ethernet1/1/2
 no shutdown
 switchport access vlan 1
 flowcontrol receive off
!
interface ethernet1/1/3
 no shutdown
 switchport access vlan 1
 flowcontrol receive off
!
interface ethernet1/1/4
 no shutdown
 switchport access vlan 1
 flowcontrol receive off
!
interface ethernet1/1/5
 no shutdown
 switchport access vlan 1
 flowcontrol receive off
!
interface ethernet1/1/6
 no shutdown
 switchport access vlan 1
 flowcontrol receive off
OS10(conf-range-eth1/1/1-1/1/6)#

Playbook execution log:

root@UBUNTU18-VM-38-024:~/os10_collections# ansible-playbook -i inventory.yaml  OS10_flowcontromodes_issue-111.yaml -vvv
ansible-playbook 2.9.26
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /root/os10_collections/inventory.yaml as it did not pass its verify_file() method
script declined parsing /root/os10_collections/inventory.yaml as it did not pass its verify_file() method
Parsed /root/os10_collections/inventory.yaml inventory source with ini plugin
Skipping callback 'actionable', as we already have a stdout callback.
Skipping callback 'counter_enabled', as we already have a stdout callback.
Skipping callback 'debug', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'dense', as we already have a stdout callback.
Skipping callback 'full_skip', as we already have a stdout callback.
Skipping callback 'json', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'null', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
Skipping callback 'selective', as we already have a stdout callback.
Skipping callback 'skippy', as we already have a stdout callback.
Skipping callback 'stderr', as we already have a stdout callback.
Skipping callback 'unixy', as we already have a stdout callback.
Skipping callback 'yaml', as we already have a stdout callback.

PLAYBOOK: OS10_flowcontromodes_issue-111.yaml ***********************************************************************************************************************************************************************************
1 plays in OS10_flowcontromodes_issue-111.yaml

PLAY [datacenter] ***************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************
task path: /root/os10_collections/OS10_flowcontromodes_issue-111.yaml:2
Monday 07 February 2022  11:55:04 +0530 (0:00:01.403)       0:00:01.403 *******
<100.104.40.188> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-897knseFc `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215105.79-906-37086325873176 `" && echo ansible-tmp-1644215105.79-906-37086325873176="` echo /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215105.79-906-37086325873176 `" ) && sleep 0'
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-897knseFc/tmpMgj2Ve TO /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215105.79-906-37086325873176/AnsiballZ_setup.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215105.79-906-37086325873176/ /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215105.79-906-37086325873176/AnsiballZ_setup.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215105.79-906-37086325873176/AnsiballZ_setup.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215105.79-906-37086325873176/ > /dev/null 2>&1 && sleep 0'
ok: [spine3]
META: ran handlers

TASK [create vlan 340] **********************************************************************************************************************************************************************************************************
task path: /root/os10_collections/OS10_flowcontromodes_issue-111.yaml:9
Monday 07 February 2022  11:55:13 +0530 (0:00:08.675)       0:00:10.078 *******
<100.104.40.188> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-897knseFc `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215117.93-986-251405360466191 `" && echo ansible-tmp-1644215117.93-986-251405360466191="` echo /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215117.93-986-251405360466191 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-897knseFc/tmpSqFfnV TO /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215117.93-986-251405360466191/AnsiballZ_os10_config.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215117.93-986-251405360466191/ /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215117.93-986-251405360466191/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215117.93-986-251405360466191/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215117.93-986-251405360466191/ > /dev/null 2>&1 && sleep 0'
changed: [spine3] => {
    "changed": true,
    "commands": [
        "interface vlan 340",
        "commit"
    ],
    "invocation": {
        "module_args": {
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": null,
            "config": null,
            "lines": [
                "interface vlan 340"
            ],
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": false,
            "src": null,
            "update": "merge"
        }
    },
    "saved": false,
    "updates": [
        "interface vlan 340",
        "commit"
    ]
}

TASK [configure Flowcontrol for ethernet 1/1/1-1/1/3] ***************************************************************************************************************************************************************************
task path: /root/os10_collections/OS10_flowcontromodes_issue-111.yaml:14
Monday 07 February 2022  11:55:24 +0530 (0:00:11.078)       0:00:21.157 *******
<100.104.40.188> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-897knseFc `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215125.11-1015-230600890578880 `" && echo ansible-tmp-1644215125.11-1015-230600890578880="` echo /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215125.11-1015-230600890578880 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-897knseFc/tmpeZv1w8 TO /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215125.11-1015-230600890578880/AnsiballZ_os10_config.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215125.11-1015-230600890578880/ /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215125.11-1015-230600890578880/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215125.11-1015-230600890578880/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215125.11-1015-230600890578880/ > /dev/null 2>&1 && sleep 0'
changed: [spine3] => {
    "changed": true,
    "commands": [
        "interface range ethernet 1/1/1-1/1/3",
        "no shutdown",
        "switchport mode trunk",
        "switchport trunk allowed vlan 340",
        "flowcontrol receive off",
        "flowcontrol transmit on",
        "commit"
    ],
    "invocation": {
        "module_args": {
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": null,
            "config": null,
            "lines": [
                "interface range ethernet 1/1/1-1/1/3",
                "no shutdown",
                "switchport mode trunk",
                "switchport trunk allowed vlan 340",
                "flowcontrol receive off",
                "flowcontrol transmit on"
            ],
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": false,
            "src": null,
            "update": "merge"
        }
    },
    "saved": false,
    "updates": [
        "interface range ethernet 1/1/1-1/1/3",
        "no shutdown",
        "switchport mode trunk",
        "switchport trunk allowed vlan 340",
        "flowcontrol receive off",
        "flowcontrol transmit on",
        "commit"
    ]
}

TASK [configure Flowcontrol for ethernet 1/1/4-1/1/6] ***************************************************************************************************************************************************************************
task path: /root/os10_collections/OS10_flowcontromodes_issue-111.yaml:24
Monday 07 February 2022  11:55:32 +0530 (0:00:07.993)       0:00:29.151 *******
<100.104.40.188> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-897knseFc `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215133.15-1043-31495280295778 `" && echo ansible-tmp-1644215133.15-1043-31495280295778="` echo /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215133.15-1043-31495280295778 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-897knseFc/tmpl7tx2_ TO /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215133.15-1043-31495280295778/AnsiballZ_os10_config.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215133.15-1043-31495280295778/ /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215133.15-1043-31495280295778/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215133.15-1043-31495280295778/AnsiballZ_os10_config.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-897knseFc/ansible-tmp-1644215133.15-1043-31495280295778/ > /dev/null 2>&1 && sleep 0'
changed: [spine3] => {
    "changed": true,
    "commands": [
        "interface range ethernet 1/1/4-1/1/6",
        "no shutdown",
        "switchport mode trunk",
        "switchport trunk allowed vlan 340",
        "flowcontrol receive on",
        "flowcontrol transmit on",
        "commit"
    ],
    "invocation": {
        "module_args": {
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": null,
            "config": null,
            "lines": [
                "interface range ethernet 1/1/4-1/1/6",
                "no shutdown",
                "switchport mode trunk",
                "switchport trunk allowed vlan 340",
                "flowcontrol receive on",
                "flowcontrol transmit on"
            ],
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": false,
            "src": null,
            "update": "merge"
        }
    },
    "saved": false,
    "updates": [
        "interface range ethernet 1/1/4-1/1/6",
        "no shutdown",
        "switchport mode trunk",
        "switchport trunk allowed vlan 340",
        "flowcontrol receive on",
        "flowcontrol transmit on",
        "commit"
    ]
}
META: ran handlers
META: ran handlers

PLAY RECAP **********************************************************************************************************************************************************************************************************************
spine3                     : ok=4    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Monday 07 February 2022  11:55:40 +0530 (0:00:08.187)       0:00:37.339 *******
===============================================================================
create vlan 340 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 11.08s
/root/os10_collections/OS10_flowcontromodes_issue-111.yaml:9 -------------------------------------------------------------------------------------------------------------------------------------------------------------------
Gathering Facts ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8.68s
/root/os10_collections/OS10_flowcontromodes_issue-111.yaml:2 -------------------------------------------------------------------------------------------------------------------------------------------------------------------
configure Flowcontrol for ethernet 1/1/4-1/1/6 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8.19s
/root/os10_collections/OS10_flowcontromodes_issue-111.yaml:24 ------------------------------------------------------------------------------------------------------------------------------------------------------------------
configure Flowcontrol for ethernet 1/1/1-1/1/3 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 7.99s
/root/os10_collections/OS10_flowcontromodes_issue-111.yaml:14 ------------------------------------------------------------------------------------------------------------------------------------------------------------------
root@UBUNTU18-VM-38-024:~/os10_collections#

Device side configuration after playbook execution:

OS10(conf-range-eth1/1/1-1/1/6)# show configuration
!
interface ethernet1/1/1
 no shutdown
 switchport mode trunk
 switchport access vlan 1
 switchport trunk allowed vlan 340
 flowcontrol receive off
 flowcontrol transmit on
!
interface ethernet1/1/2
 no shutdown
 switchport mode trunk
 switchport access vlan 1
 switchport trunk allowed vlan 340
 flowcontrol receive off
 flowcontrol transmit on
!
interface ethernet1/1/3
 no shutdown
 switchport mode trunk
 switchport access vlan 1
 switchport trunk allowed vlan 340
 flowcontrol receive off
 flowcontrol transmit on
!
interface ethernet1/1/4
 no shutdown
 switchport mode trunk
 switchport access vlan 1
 switchport trunk allowed vlan 340
 flowcontrol receive on
 flowcontrol transmit on
!
interface ethernet1/1/5
 no shutdown
 switchport mode trunk
 switchport access vlan 1
 switchport trunk allowed vlan 340
 flowcontrol receive on
 flowcontrol transmit on
!
interface ethernet1/1/6
 no shutdown
 switchport mode trunk
 switchport access vlan 1
 switchport trunk allowed vlan 340
 flowcontrol receive on
 flowcontrol transmit on
OS10(conf-range-eth1/1/1-1/1/6)#
G3rmN3rd commented 2 years ago

Maybe its my lack of understanding of Ansible, but I was hoping to be able to configure each switch as a role file. Can OS10_Config be used in that capacity?

prasadapr commented 2 years ago

@G3rmN3rd, you are asking using OS10_Config, are we able to configure multiple switches/devices?

piwi3910 commented 1 year ago

When will this limitation be fixed, it's not really appropriate to have to use multiple roles to do this simple setting

bas-1988 commented 7 months ago

Hello, I would also like to see this limitation fixed. last update was over a year ago. As I'm new to Github, I'm not sure who's looking into this stuff. is it possible for myself to suggest a change under the role configuration?

Surely It can't be harder than changing it to this? From:

  {% if intf_vars.flowcontrol is defined and intf_vars.flowcontrol %}
    {% if intf_vars.flowcontrol.mode is defined %}
      {% if intf_vars.flowcontrol.mode %}
        {% if intf_vars.flowcontrol.state is defined and intf_vars.flowcontrol.state == "absent" %}
 no flowcontrol {{ intf_vars.flowcontrol.mode }}
        {% else %}
          {% if intf_vars.flowcontrol.enable is defined %}
            {% if intf_vars.flowcontrol.enable == "on" %}
 flowcontrol {{ intf_vars.flowcontrol.mode }} on
            {% else %}
 flowcontrol {{ intf_vars.flowcontrol.mode }} off
            {% endif %}
          {% endif %}
        {% endif %}
      {% endif %}
    {% endif %}
  {% endif %}

To:

  {% if intf_vars.flowcontrol is defined and intf_vars.flowcontrol %}
    {% for flowcontroloption in intf_vars.flowcontrol.keys() %}
        {% if flowcontroloption.mode is defined %}
            {% if flowcontroloption.mode %}
                {% if flowcontroloption.state is defined and flowcontroloption.state == "absent" %}
        no flowcontrol {{ flowcontroloption.mode }}
                {% else %}
                {% if flowcontroloption.enable is defined %}
                    {% if flowcontroloption.enable == "on" %}
        flowcontrol {{ flowcontroloption.mode }} on
                    {% else %}
        flowcontrol {{ flowcontroloption.mode }} off
            {% endif %}
          {% endif %}
        {% endif %}
      {% endif %}
    {% endif %}
  {% endif %}

Var file:

os10_interface:
    ethernet 1/1/32:
            flowcontrol:
              - mode: "receive"
                enable: "on"
                state: "present"
              - mode: "transmit"
                enable: "off"
                state: "present"