Closed starvinmarwin closed 7 months ago
cc @srbharadwaj
@starvinmarwin It shouldn't take that much time, would it be possible to share a switch accounting logs as well as ansible playbook logs while running with -vvv option?
Hi, here is a snippet from accounting log, as you see, it takes around 6 sec to add each records to zone DB:
Tue Jan 16 13:36:58 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:36:58 2024:type=update:id=nginx:user=admin:cmd=Zone martin1 is created on VSAN 1251 Tue Jan 16 13:36:58 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin1 vsan 1251 (SUCCESS) Tue Jan 16 13:36:58 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 26:10:04:25:c5:00:01:02 ] to zone martin1 on VSAN 1251 Tue Jan 16 13:36:58 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin1 vsan 1251 ; member pwwn 26:10:04:25:c5:00:01:02 (SUCCESS) Tue Jan 16 13:36:58 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:37:05 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:37:05 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin1 vsan 1251 (SUCCESS) Tue Jan 16 13:37:05 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 20:00:00:27:b5:00:01:1f ] to zone martin1 on VSAN 1251 Tue Jan 16 13:37:05 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin1 vsan 1251 ; member pwwn 20:00:00:27:b5:00:01:1f (SUCCESS) Tue Jan 16 13:37:05 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:37:10 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:37:10 2024:type=update:id=nginx:user=admin:cmd=Zone martin2 is created on VSAN 1251 Tue Jan 16 13:37:10 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin2 vsan 1251 (SUCCESS) Tue Jan 16 13:37:10 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:1a:44:82:e5:83:5e:b5 ] to zone martin2 on VSAN 1251 Tue Jan 16 13:37:10 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin2 vsan 1251 ; member pwwn 22:1a:44:82:e5:83:5e:b5 (SUCCESS) Tue Jan 16 13:37:10 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:37:17 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:37:17 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin2 vsan 1251 (SUCCESS) Tue Jan 16 13:37:17 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:00:f8:75:88:89:41:2f ] to zone martin2 on VSAN 1251 Tue Jan 16 13:37:17 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin2 vsan 1251 ; member pwwn 10:00:f8:75:88:89:41:2f (SUCCESS) Tue Jan 16 13:37:17 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:37:23 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:37:23 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin2 vsan 1251 (SUCCESS) Tue Jan 16 13:37:23 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:1a:54:82:e5:83:5e:b5 ] to zone martin2 on VSAN 1251 Tue Jan 16 13:37:23 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin2 vsan 1251 ; member pwwn 22:1a:54:82:e5:83:5e:b5 (SUCCESS) Tue Jan 16 13:37:23 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:37:30 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:37:30 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin2 vsan 1251 (SUCCESS) Tue Jan 16 13:37:30 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:00:68:75:88:89:41:2f ] to zone martin2 on VSAN 1251 Tue Jan 16 13:37:30 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin2 vsan 1251 ; member pwwn 10:00:68:75:88:89:41:2f (SUCCESS) Tue Jan 16 13:37:30 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:37:36 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:37:36 2024:type=update:id=nginx:user=admin:cmd=Zone martin3 is created on VSAN 1251 Tue Jan 16 13:37:36 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin3 vsan 1251 (SUCCESS) Tue Jan 16 13:37:36 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:1a:54:82:e5:83:5e:b5 ] to zone martin3 on VSAN 1251 Tue Jan 16 13:37:36 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin3 vsan 1251 ; member pwwn 22:1a:54:82:e5:83:5e:b5 (SUCCESS) Tue Jan 16 13:37:36 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:37:42 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:37:42 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin3 vsan 1251 (SUCCESS) Tue Jan 16 13:37:42 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:00:68:15:88:89:41:2f ] to zone martin3 on VSAN 1251 Tue Jan 16 13:37:42 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin3 vsan 1251 ; member pwwn 10:00:68:15:88:89:41:2f (SUCCESS) Tue Jan 16 13:37:42 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:37:48 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:37:48 2024:type=update:id=nginx:user=admin:cmd=Zone martin4 is created on VSAN 1251 Tue Jan 16 13:37:48 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin4 vsan 1251 (SUCCESS) Tue Jan 16 13:37:49 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:1a:44:a2:e5:83:5e:b5 ] to zone martin4 on VSAN 1251 Tue Jan 16 13:37:49 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin4 vsan 1251 ; member pwwn 22:1a:44:a2:e5:83:5e:b5 (SUCCESS) Tue Jan 16 13:37:49 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:37:54 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:37:54 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin4 vsan 1251 (SUCCESS) Tue Jan 16 13:37:54 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:00:f8:b5:88:89:41:2f ] to zone martin4 on VSAN 1251 Tue Jan 16 13:37:54 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin4 vsan 1251 ; member pwwn 10:00:f8:b5:88:89:41:2f (SUCCESS) Tue Jan 16 13:37:54 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:00 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:00 2024:type=update:id=nginx:user=admin:cmd=Zone martin5 is created on VSAN 1251 Tue Jan 16 13:38:00 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin5 vsan 1251 (SUCCESS) Tue Jan 16 13:38:00 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:1a:44:b2:e5:83:5e:b5 ] to zone martin5 on VSAN 1251 Tue Jan 16 13:38:00 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin5 vsan 1251 ; member pwwn 22:1a:44:b2:e5:83:5e:b5 (SUCCESS) Tue Jan 16 13:38:00 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:06 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:06 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin5 vsan 1251 (SUCCESS) Tue Jan 16 13:38:06 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:00:f8:c5:88:89:41:2f ] to zone martin5 on VSAN 1251 Tue Jan 16 13:38:06 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin5 vsan 1251 ; member pwwn 10:00:f8:c5:88:89:41:2f (SUCCESS) Tue Jan 16 13:38:06 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:11 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:11 2024:type=update:id=nginx:user=admin:cmd=Zone martin6 is created on VSAN 1251 Tue Jan 16 13:38:11 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin6 vsan 1251 (SUCCESS) Tue Jan 16 13:38:11 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:1a:44:82:e5:43:5e:b5 ] to zone martin6 on VSAN 1251 Tue Jan 16 13:38:11 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin6 vsan 1251 ; member pwwn 22:1a:44:82:e5:43:5e:b5 (SUCCESS) Tue Jan 16 13:38:11 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:17 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:17 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin6 vsan 1251 (SUCCESS) Tue Jan 16 13:38:17 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:00:f8:75:88:49:41:2f ] to zone martin6 on VSAN 1251 Tue Jan 16 13:38:17 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin6 vsan 1251 ; member pwwn 10:00:f8:75:88:49:41:2f (SUCCESS) Tue Jan 16 13:38:17 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:23 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:23 2024:type=update:id=nginx:user=admin:cmd=Zone martin7 is created on VSAN 1251 Tue Jan 16 13:38:23 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin7 vsan 1251 (SUCCESS) Tue Jan 16 13:38:23 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:1a:44:82:e5:83:6e:b5 ] to zone martin7 on VSAN 1251 Tue Jan 16 13:38:23 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin7 vsan 1251 ; member pwwn 22:1a:44:82:e5:83:6e:b5 (SUCCESS) Tue Jan 16 13:38:23 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:28 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:28 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin7 vsan 1251 (SUCCESS) Tue Jan 16 13:38:28 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:00:f8:75:88:89:71:2f ] to zone martin7 on VSAN 1251 Tue Jan 16 13:38:28 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin7 vsan 1251 ; member pwwn 10:00:f8:75:88:89:71:2f (SUCCESS) Tue Jan 16 13:38:28 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:34 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:34 2024:type=update:id=nginx:user=admin:cmd=Zone martin8 is created on VSAN 1251 Tue Jan 16 13:38:34 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin8 vsan 1251 (SUCCESS) Tue Jan 16 13:38:34 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:11:44:82:e5:83:5e:b5 ] to zone martin8 on VSAN 1251 Tue Jan 16 13:38:34 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin8 vsan 1251 ; member pwwn 22:11:44:82:e5:83:5e:b5 (SUCCESS) Tue Jan 16 13:38:34 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:39 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:39 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin8 vsan 1251 (SUCCESS) Tue Jan 16 13:38:40 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:01:f8:75:88:89:41:2f ] to zone martin8 on VSAN 1251 Tue Jan 16 13:38:40 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin8 vsan 1251 ; member pwwn 10:01:f8:75:88:89:41:2f (SUCCESS) Tue Jan 16 13:38:40 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:46 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:46 2024:type=update:id=nginx:user=admin:cmd=Zone martin9 is created on VSAN 1251 Tue Jan 16 13:38:46 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin9 vsan 1251 (SUCCESS) Tue Jan 16 13:38:47 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:1b:44:82:e5:83:5e:b5 ] to zone martin9 on VSAN 1251 Tue Jan 16 13:38:47 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin9 vsan 1251 ; member pwwn 22:1b:44:82:e5:83:5e:b5 (SUCCESS) Tue Jan 16 13:38:47 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:52 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:52 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin9 vsan 1251 (SUCCESS) Tue Jan 16 13:38:52 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:0b:f8:75:88:89:41:2f ] to zone martin9 on VSAN 1251 Tue Jan 16 13:38:52 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin9 vsan 1251 ; member pwwn 10:0b:f8:75:88:89:41:2f (SUCCESS) Tue Jan 16 13:38:52 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:38:58 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:38:58 2024:type=update:id=nginx:user=admin:cmd=Zone martin10 is created on VSAN 1251 Tue Jan 16 13:38:58 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin10 vsan 1251 (SUCCESS) Tue Jan 16 13:38:58 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 22:1c:44:82:e5:83:5e:b5 ] to zone martin10 on VSAN 1251 Tue Jan 16 13:38:58 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin10 vsan 1251 ; member pwwn 22:1c:44:82:e5:83:5e:b5 (SUCCESS) Tue Jan 16 13:38:58 2024:type=update:id=nginx:user=admin:cmd=no terminal dont-ask (SUCCESS) Tue Jan 16 13:39:04 2024:type=update:id=nginx:user=admin:cmd=terminal dont-ask (SUCCESS) Tue Jan 16 13:39:04 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin10 vsan 1251 (SUCCESS) Tue Jan 16 13:39:04 2024:type=update:id=nginx:user=admin:cmd=Added member [ WWN: 10:0c:f8:75:88:89:41:2f ] to zone martin10 on VSAN 1251 Tue Jan 16 13:39:04 2024:type=update:id=nginx:user=admin:cmd=configure terminal ; zone name martin10 vsan 1251 ; member pwwn 10:0c:f8:75:88:89:41:2f (SUCCESS)
ansible run with debug log: (first 3 records)
SE-STO-SEMSI:nxos_fabrics semsi$ ansible-playbook -vvv main.yaml -i skondal_a ansible-playbook [core 2.15.5] config file = None configured module search path = ['/Users/semsi/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/Cellar/ansible/8.5.0_1/libexec/lib/python3.11/site-packages/ansible ansible collection location = /Users/semsi/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible-playbook python version = 3.11.6 (main, Oct 3 2023, 02:51:45) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/usr/local/Cellar/ansible/8.5.0_1/libexec/bin/python) jinja version = 3.1.2 libyaml = True No config file found; using defaults host_list declined parsing /Users/semsi/ansible_cicso_mds/cisco/nxos_fabrics/skondal_a as it did not pass its verify_file() method script declined parsing /Users/semsi/ansible_cicso_mds/cisco/nxos_fabrics/skondal_a as it did not pass its verify_file() method auto declined parsing /Users/semsi/ansible_cicso_mds/cisco/nxos_fabrics/skondal_a as it did not pass its verify_file() method Parsed /Users/semsi/ansible_cicso_mds/cisco/nxos_fabrics/skondal_a inventory source with ini plugin statically imported: /Users/semsi/ansible_cicso_mds/cisco/nxos_fabrics/roles/fabric_a/tasks/zone_members.yaml redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos statically imported: /Users/semsi/ansible_cicso_mds/cisco/nxos_fabrics/roles/fabric_a/tasks/zone_set.yaml redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos Skipping callback 'default', as we already have a stdout callback. Skipping callback 'minimal', as we already have a stdout callback. Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: main.yaml **********************************************************************************************************************************************************************
1 plays in main.yaml
PLAY [skondal_a] *************************************************************************************************************************************************************************
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
TASK [fabric_a : Add members to zone database] *******************************************************************************************************************************************
task path: /Users/semsi/ansible_cicso_mds/cisco/nxos_fabrics/roles/fabric_a/tasks/zone_members.yaml:1
redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
redirecting (type: httpapi) ansible.builtin.nxos to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
changed: [10.5.161.16] => (item=[{'name': 'martin1'}, '26:10:04:25:c5:00:01:02']) => {
"ansible_loop_var": "item",
"changed": true,
"commands": [
"terminal dont-ask",
"zone name martin1 vsan 1251",
"member pwwn 26:10:04:25:c5:00:01:02",
"no terminal dont-ask"
],
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"default_zone": null,
"mode": "basic",
"smart_zoning": false,
"vsan": 1251,
"zone": [
{
"members": [
{
"devtype": null,
"pwwn": "26:10:04:25:c5:00:01:02",
"remove": false
}
],
"name": "martin1",
"remove": false
}
],
"zoneset": null
}
]
}
},
"item": [
{
"name": "martin1"
},
"26:10:04:25:c5:00:01:02"
],
"messages": [
"zone mode is already basic ,no change in zone mode configuration for vsan 1251",
"smart-zoning is already set to disabled , no change in smart-zoning configuration for vsan 1251",
"adding zone member '26:10:04:25:c5:00:01:02' to zone 'martin1' in vsan 1251"
]
}
redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
redirecting (type: httpapi) ansible.builtin.nxos to cisco.nxos.nxos
<10.5.161.16> ESTABLISH HTTP(S) CONNECTFOR USER: admin TO https://10.5.161.16:8443
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
changed: [10.5.161.16] => (item=[{'name': 'martin1'}, '20:00:00:27:b5:00:01:1f']) => {
"ansible_loop_var": "item",
"changed": true,
"commands": [
"terminal dont-ask",
"zone name martin1 vsan 1251",
"member pwwn 20:00:00:27:b5:00:01:1f",
"no terminal dont-ask"
],
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"default_zone": null,
"mode": "basic",
"smart_zoning": false,
"vsan": 1251,
"zone": [
{
"members": [
{
"devtype": null,
"pwwn": "20:00:00:27:b5:00:01:1f",
"remove": false
}
],
"name": "martin1",
"remove": false
}
],
"zoneset": null
}
]
}
},
"item": [
{
"name": "martin1"
},
"20:00:00:27:b5:00:01:1f"
],
"messages": [
"zone mode is already basic ,no change in zone mode configuration for vsan 1251",
"smart-zoning is already set to disabled , no change in smart-zoning configuration for vsan 1251",
"adding zone member '20:00:00:27:b5:00:01:1f' to zone 'martin1' in vsan 1251"
]
}
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
changed: [10.5.161.16] => (item=[{'name': 'martin2'}, '22:1a:44:82:e5:83:5e:b5']) => {
"ansible_loop_var": "item",
"changed": true,
"commands": [
"terminal dont-ask",
"zone name martin2 vsan 1251",
"member pwwn 22:1a:44:82:e5:83:5e:b5",
"no terminal dont-ask"
],
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"default_zone": null,
"mode": "basic",
"smart_zoning": false,
"vsan": 1251,
"zone": [
{
"members": [
{
"devtype": null,
"pwwn": "22:1a:44:82:e5:83:5e:b5",
"remove": false
}
],
"name": "martin2",
"remove": false
}
],
"zoneset": null
}
]
}
},
"item": [
{
"name": "martin2"
},
"22:1a:44:82:e5:83:5e:b5"
],
"messages": [
"zone mode is already basic ,no change in zone mode configuration for vsan 1251",
"smart-zoning is already set to disabled , no change in smart-zoning configuration for vsan 1251",
"adding zone member '22:1a:44:82:e5:83:5e:b5' to zone 'martin2' in vsan 1251"
]
}
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
changed: [10.5.161.16] => (item=[{'name': 'martin2'}, '10:00:f8:75:88:89:41:2f']) => {
"ansible_loop_var": "item",
"changed": true,
"commands": [
"terminal dont-ask",
"zone name martin2 vsan 1251",
"member pwwn 10:00:f8:75:88:89:41:2f",
"no terminal dont-ask"
],
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"default_zone": null,
"mode": "basic",
"smart_zoning": false,
"vsan": 1251,
"zone": [
{
"members": [
{
"devtype": null,
"pwwn": "10:00:f8:75:88:89:41:2f",
"remove": false
}
],
"name": "martin2",
"remove": false
}
],
"zoneset": null
}
]
}
},
"item": [
{
"name": "martin2"
},
"10:00:f8:75:88:89:41:2f"
],
"messages": [
"zone mode is already basic ,no change in zone mode configuration for vsan 1251",
"smart-zoning is already set to disabled , no change in smart-zoning configuration for vsan 1251",
"adding zone member '10:00:f8:75:88:89:41:2f' to zone 'martin2' in vsan 1251"
]
}
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
changed: [10.5.161.16] => (item=[{'name': 'martin2'}, '22:1a:54:82:e5:83:5e:b5']) => {
"ansible_loop_var": "item",
"changed": true,
"commands": [
"terminal dont-ask",
"zone name martin2 vsan 1251",
"member pwwn 22:1a:54:82:e5:83:5e:b5",
"no terminal dont-ask"
],
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"default_zone": null,
"mode": "basic",
"smart_zoning": false,
"vsan": 1251,
"zone": [
{
"members": [
{
"devtype": null,
"pwwn": "22:1a:54:82:e5:83:5e:b5",
"remove": false
}
],
"name": "martin2",
"remove": false
}
],
"zoneset": null
}
]
}
},
"item": [
{
"name": "martin2"
},
"22:1a:54:82:e5:83:5e:b5"
],
"messages": [
"zone mode is already basic ,no change in zone mode configuration for vsan 1251",
"smart-zoning is already set to disabled , no change in smart-zoning configuration for vsan 1251",
"adding zone member '22:1a:54:82:e5:83:5e:b5' to zone 'martin2' in vsan 1251"
]
}
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
changed: [10.5.161.16] => (item=[{'name': 'martin2'}, '10:00:68:75:88:89:41:2f']) => {
"ansible_loop_var": "item",
"changed": true,
"commands": [
"terminal dont-ask",
"zone name martin2 vsan 1251",
"member pwwn 10:00:68:75:88:89:41:2f",
"no terminal dont-ask"
],
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"default_zone": null,
"mode": "basic",
"smart_zoning": false,
"vsan": 1251,
"zone": [
{
"members": [
{
"devtype": null,
"pwwn": "10:00:68:75:88:89:41:2f",
"remove": false
}
],
"name": "martin2",
"remove": false
}
],
"zoneset": null
}
]
}
},
"item": [
{
"name": "martin2"
},
"10:00:68:75:88:89:41:2f"
],
"messages": [
"zone mode is already basic ,no change in zone mode configuration for vsan 1251",
"smart-zoning is already set to disabled , no change in smart-zoning configuration for vsan 1251",
"adding zone member '10:00:68:75:88:89:41:2f' to zone 'martin2' in vsan 1251"
]
}
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
changed: [10.5.161.16] => (item=[{'name': 'martin3'}, '22:1a:54:82:e5:83:5e:b5']) => {
"ansible_loop_var": "item",
"changed": true,
"commands": [
"terminal dont-ask",
"zone name martin3 vsan 1251",
"member pwwn 22:1a:54:82:e5:83:5e:b5",
"no terminal dont-ask"
],
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"default_zone": null,
"mode": "basic",
"smart_zoning": false,
"vsan": 1251,
"zone": [
{
"members": [
{
"devtype": null,
"pwwn": "22:1a:54:82:e5:83:5e:b5",
"remove": false
}
],
"name": "martin3",
"remove": false
}
],
"zoneset": null
}
]
}
},
"item": [
{
"name": "martin3"
},
"22:1a:54:82:e5:83:5e:b5"
],
"messages": [
"zone mode is already basic ,no change in zone mode configuration for vsan 1251",
"smart-zoning is already set to disabled , no change in smart-zoning configuration for vsan 1251",
"adding zone member '22:1a:54:82:e5:83:5e:b5' to zone 'martin3' in vsan 1251"
]
}
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
changed: [10.5.161.16] => (item=[{'name': 'martin3'}, '10:00:68:15:88:89:41:2f']) => {
"ansible_loop_var": "item",
"changed": true,
"commands": [
"terminal dont-ask",
"zone name martin3 vsan 1251",
"member pwwn 10:00:68:15:88:89:41:2f",
"no terminal dont-ask"
],
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"default_zone": null,
"mode": "basic",
"smart_zoning": false,
"vsan": 1251,
"zone": [
{
"members": [
{
"devtype": null,
"pwwn": "10:00:68:15:88:89:41:2f",
"remove": false
}
],
"name": "martin3",
"remove": false
}
],
"zoneset": null
}
]
}
},
"item": [
{
"name": "martin3"
},
"10:00:68:15:88:89:41:2f"
],
"messages": [
"zone mode is already basic ,no change in zone mode configuration for vsan 1251",
"smart-zoning is already set to disabled , no change in smart-zoning configuration for vsan 1251",
"adding zone member '10:00:68:15:88:89:41:2f' to zone 'martin3' in vsan 1251"
]
}
@starvinmarwin looks like the issue is not with the module per se , but with the actual use of with_items
In this case the entire run is as if the playbook is executed again and again for every item
, this would mean opening up a new connection, running various show cmds, coming up with the actual cmd to be executed, closing the connections etc..
Using with_items
will do all these steps for every item
So if you have 100 items then its like running 100 ansible playbooks back to back serially one by one which would obviously add some delay
As you can see below a new connection is being opened for every item
"messages": [
"zone mode is already basic ,no change in zone mode configuration for vsan 1251",
"smart-zoning is already set to disabled , no change in smart-zoning configuration for vsan 1251",
"adding zone member '26:10:04:25:c5:00:01:02' to zone 'martin1' in vsan 1251"
]
}
redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
redirecting (type: httpapi) ansible.builtin.nxos to cisco.nxos.nxos
<10.5.161.16> ESTABLISH HTTP(S) CONNECTFOR USER: admin TO https://10.5.161.16:8443/
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
I did a bit of search and it looks like using with_items
is not popular for network automation and using Jinja template could be a better way to do looping, adding some links to check it out
https://github.com/ansible/ansible/issues/42030 https://www.reddit.com/r/networking/comments/8sicox/does_anyone_else_find_ansible_automation/ https://www.ansible.com/blog/accelerate-ansible-networking-aggregate-resources
@NilashishC any idea how timestamp can be known while running playbook with -vvv
also how common is it to use with_items
for running nxos modules?
@srbharadwaj We can use the profile_tasks and timer callback plugins to examine task/playbook execution times.
As for with_items
, you are absolutely correct, we don't really recommend this for network modules. Instead, you'll find aggregate
key in older modules (like nxos_interface
) or config
key implemented as a list of dictionary (with each dictionary representing an individual item (like interface), in nxos_interfaces
.
@starvinmarwin Looping through 10K entries using with_items
would be equivalent to executing the module 10K times, with each iteration individually running show command(s) every time. Not only is it resource intensive, I believe this would be taxing the device as well. Turning on ansible_single_user_mode might help with the idempotent cases, but in all other scenarios for this particular issue, it won't benefit much.
Since zoneset
-> members
accepts a list, why not directly pass the entire list of members from your vars in one go? As an example:
- name: Filter name key from input data
ansible.builtin.set_fact:
filtered_fabric_a: "{{ fabric_a | ansible.utils.keep_keys(target=['name']) }}"
- name: Show filtered data
ansible.builtin.debug:
var: filtered_fabric_a
- name: Enable zoneset with all members
cisco.nxos.nxos_zone_zoneset:
zone_zoneset_details:
- mode: basic
smart_zoning: false
vsan: 1251
zoneset:
- action: activate
members:
- name: "{{ filtered_fabric_a }}"
name: Zoneset_20240105
Thank you, that makes sense! But we still need to populate the all the zones.
Can that also be done in one go?
Currently we have this format that is not a slamdunk :/ Could you share some example on how to pass this to the module please?
fabric_a:
- name: zone1
pwwn:
- '26:10:04:25:c5:00:01:02'
- '20:00:00:27:b5:00:01:1f'
- name: zone2
pwwn:
- '22:1a:44:82:e5:83:5e:b5'
- '10:00:f8:75:88:89:41:2f'
- name: zone3
pwwn:
- '22:1a:54:82:e5:83:5e:b5'
- '10:00:68:75:88:89:41:2f'
- name: zone4
pwwn:
- '22:1a:54:82:e5:83:5e:b5'
- '10:00:68:15:88:89:41:2f'
I'm not sure I fully understand your question. The playbook I shared above is equivalent to the one below. As per the issue details, I believe that's what you were trying to accomplish. If not, could you please elaborate? Thanks!
- name: Filter name key from input data
ansible.builtin.set_fact:
filtered_fabric_a: "{{ fabric_a | ansible.utils.keep_keys(target=['name']) }}"
- name: Show filtered data
ansible.builtin.debug:
var: filtered_fabric_a
- name: Enable zoneset with all members
cisco.nxos.nxos_zone_zoneset:
zone_zoneset_details:
- mode: basic
smart_zoning: false
vsan: 1251
zoneset:
- action: activate
members:
- name: zone1
- name: zone2
- name: zone3
- name: zone4
< .... redacted ... >
name: Zoneset_20240105
Thanks for your quick reply! Before activating the zoneset(as you neatly decribed above), we must first create all individual zones with their members. Ive been using a loop using the same variabel-list, but that will also take time and consume resources as you pointed out:
- name: Add members to zone database
cisco.nxos.nxos_zone_zoneset:
zone_zoneset_details:
- mode: basic
smart_zoning: false
vsan: 1251
zone:
- members:
- pwwn: "{{ item.1 }}"
name: "{{ item.0.name }}"
remove: false
with_subelements:
- "{{ fabric_a }}"
- pwwn
I would like the same vars-list (fabric_a) to only maintain one list of pwwns. Is it possible to feed that into the config in one go, like we do with the zoneset? Without looping through 10000 lines of code :)
@starvinmarwin That would be slightly more complicated and needs some Jinja2 magic to work. You can refer to the following as an example:
updated_fabric.j2
---
new_fabric_a:
{%- for entry in fabric_a %}
- name: {{ entry.name }}
members:
{%- for subentry in entry.pwwn %}
- pwwn: {{ subentry }}
{%- endfor %}
{%- endfor %}
playbook
---
- hosts: nxos
gather_facts: false
tasks:
- name: Load file containing fabric_a
ansible.builtin.include_vars:
file: ./fabric_a.yaml
- name: Generate updated fabric data
ansible.builtin.template:
src: './updated_fabric_a.j2'
dest: 'updated_fabric_a.yaml'
trim_blocks: false
delegate_to: localhost
- name: Load updated data
ansible.builtin.include_vars:
file: ./updated_fabric_a.yaml
- name: Add members to zone database
cisco.nxos.nxos_zone_zoneset:
zone_zoneset_details:
- mode: basic
smart_zoning: false
vsan: 1251
zone: "{{ new_fabric_a }}"
updated_fabric_a.yaml
---
new_fabric_a:
- name: zone1
members:
- pwwn: 26:10:04:25:c5:00:01:02
- pwwn: 20:00:00:27:b5:00:01:1f
- name: zone2
members:
- pwwn: 22:1a:44:82:e5:83:5e:b5
- pwwn: 10:00:f8:75:88:89:41:2f
With that, I'm closing this issue since this is not a really a bug but an user question. If you have further queries, please feel free to reach out to us at any of the following places:
Issues or feature requests should be opened in this repository.
Thank you and happy automating!
Hi again Nilashish,
Sorry for posting in this closed ticket, but I cant get the zone_set module to accept a list as input. Following your example it looks fine;
soure code:
- name: Filter name key from input data
ansible.builtin.set_fact:
filtered_fabric_a: "{{ fabric_a | ansible.utils.keep_keys(target=['name']) }}"
- name: Enable zoneset with all members
cisco.nxos.nxos_zone_zoneset:
zone_zoneset_details:
- mode: basic
smart_zoning: false
vsan: 1251
zoneset:
- action: activate
members:
- name: "{{ filtered_fabric_a }}"
name: Zoneset_20240130121
Runtime output:
TASK [Filter name key from input data] ****************************************************************************************************************************************************
task path: /Users/semsi/ansible_cicso_mds/cisco_labb/tasks/zone_set.yaml:1
redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
redirecting (type: httpapi) ansible.builtin.nxos to cisco.nxos.nxos
<10.5.161.16> ESTABLISH HTTP(S) CONNECTFOR USER: admin TO https://10.5.161.16:8443
ok: [10.5.161.16] => {
"ansible_facts": {
"filtered_fabric_a": [
{
"name": "zone1"
},
{
"name": "zone2"
},
{
"name": "zone3"
},
{
"name": "zone4"
}
]
},
"changed": false
}
But on execution it fails with "invalid command";
TASK [Enable zoneset with all members] ****************************************************************************************************************************************************
task path: /Users/semsi/ansible_cicso_mds/cisco_labb/tasks/zone_set.yaml:13
redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
redirecting (type: httpapi) ansible.builtin.nxos to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
redirecting (type: action) cisco.nxos.nxos_zone_zoneset to cisco.nxos.nxos
The full traceback is:
File "/Users/semsi/.ansible/collections/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/nxos.py", line 312, in load_config
resp = self.edit_config(commands, replace=replace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/semsi/.ansible/collections/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/nxos.py", line 343, in edit_config
responses = self._connection.send_request(candidate, output="config")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/ansible/8.5.0_1/libexec/lib/python3.11/site-packages/ansible/module_utils/connection.py", line 200, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [10.5.161.16]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"default_zone": null,
"mode": "basic",
"smart_zoning": false,
"vsan": 1251,
"zone": null,
"zoneset": [
{
"action": "activate",
"members": [
{
"name": "[{'name': 'zone1'}, {'name': 'zone2'}, {'name': 'zone3'}, {'name': 'zone4'}]",
"remove": false
}
],
"name": "Zoneset_20240130121",
"remove": false
}
]
}
]
}
},
"msg": "member [{'name': 'zone1'}, {'name': 'zone2'}, {'name': 'zone3'}, {'name': 'zone4'}]: Input CLI command error: % Invalid command\n"
}
Does the list have to be structured some special way?
Regards,
Martin
@starvinmarwin Apologies for a slight mistake in the example I shared, I believe it should be as follows:
- name: Filter name key from input data
ansible.builtin.set_fact:
filtered_fabric_a: "{{ fabric_a | ansible.utils.keep_keys(target=['name']) }}"
- name: Show filtered data
ansible.builtin.debug:
var: filtered_fabric_a
- name: Enable zoneset with all members
cisco.nxos.nxos_zone_zoneset:
zone_zoneset_details:
- mode: basic
smart_zoning: false
vsan: 1251
zoneset:
- action: activate
members: "{{ filtered_fabric_a }}"
name: Zoneset_20240105
Thanks alot! That did the trick :)
SUMMARY
When running nxos_zone_zoneset module the full zone list has to be provided for all zones to be included in MDS active config. Since we have more than 10.000 entires in our active config, the playbook run takes +10 hours. Is there a way to add only new entries to the running config (equiv to PUT/PATCH in REST API) without having to provide the full member list every time?
ISSUE TYPE
COMPONENT NAME
cisco.nxos.nxos_zone_zoneset 5.3.0
ADDITIONAL INFORMATION
fabric_a sample: