Open G3rmN3rd opened 2 years ago
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.
@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
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)#
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?
@G3rmN3rd, you are asking using OS10_Config, are we able to configure multiple switches/devices?
When will this limitation be fixed, it's not really appropriate to have to use multiple roles to do this simple setting
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"
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
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Dell S5348F-ON, OS10 v10.5.2.
STEPS TO REPRODUCE
[Project Directory]
[hosts]
[vxleaf-setup.yml]
[host_vars file Try 1]
I have also tried: [host_vars file Try 2]
[With host_vars file Try 1]
[With host_vars file Try 2]
EXPECTED RESULTS
ACTUAL RESULTS