# Cisco MDS | nxos\_zone\_zoneset

**URL:** <https://forum.ansible.com/t/cisco-mds-nxos-zone-zoneset/33128>\
**Category:** Ansible Project\
**Created:** [June 9, 2020, 7:22pm UTC](https://forum.ansible.com/t/cisco-mds-nxos-zone-zoneset/33128 "2020-06-09T19:22:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kzersatz](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@kzersatz](https://forum.ansible.com/u/kzersatz)\
**Post date:** [June 9, 2020, 7:22pm UTC](https://forum.ansible.com/t/cisco-mds-nxos-zone-zoneset/33128/1 "2020-06-09T19:22:34Z")

</div>

Alrighty

So I’ve run into a bit of a head scratcher

New MDS deployment, right?

all of 0 customers running across it so far,  
2 admins poking at it, one being myself trying to get Ansible playbooks to play nicely with this new pair.

Playbook functions on old MDS’s without an incident. that is one MINOR code version behind (like .1a to .2)

The error:  
`"msg": "zone has acquired lock on the switch for vsan 101. Hence cannot procced.",`  
some redactions have been made.

playbook:

`

---

<div class="post-metadata">

**Author:** ![oxido\_A](https://avatars.discourse-cdn.com/v4/letter/o/7cd45c/32.png) [@oxido\_A](https://forum.ansible.com/u/oxido_A)\
**Post date:** [June 9, 2020, 7:27pm UTC](https://forum.ansible.com/t/cisco-mds-nxos-zone-zoneset/33128/2 "2020-06-09T19:27:42Z")

</div>

And What happens when you -The admin execute :

```auto
show zone status ?? 

```

```auto

```

---

<div class="post-metadata">

**Author:** ![kzersatz](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@kzersatz](https://forum.ansible.com/u/kzersatz)\
**Post date:** [June 9, 2020, 7:39pm UTC](https://forum.ansible.com/t/cisco-mds-nxos-zone-zoneset/33128/3 "2020-06-09T19:39:21Z")

</div>

It’s in the OG post.

I can’t get it to post /w the code, so here we go.  
[https://pastebin.com/ziMcfTSt](https://pastebin.com/ziMcfTSt)

---

<div class="post-metadata">

**Author:** ![kzersatz](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@kzersatz](https://forum.ansible.com/u/kzersatz)\
**Post date:** [June 10, 2020, 4:46pm UTC](https://forum.ansible.com/t/cisco-mds-nxos-zone-zoneset/33128/4 "2020-06-10T16:46:40Z")

</div>

Updated the modules for MDS to most current release via github.  
No success.

---

<div class="post-metadata">

**Author:** ![kzersatz](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@kzersatz](https://forum.ansible.com/u/kzersatz)\
**Post date:** [June 10, 2020, 7:22pm UTC](https://forum.ansible.com/t/cisco-mds-nxos-zone-zoneset/33128/5 "2020-06-10T19:22:42Z")

</div>

I think I found the offending “Check” thats causing my headache.

`

```auto
 # Step1: execute show zone status and get
        shZoneStatusObj = ShowZoneStatus(module, vsan)
        sw_default_zone = shZoneStatusObj.getDefaultZone()
        sw_mode = shZoneStatusObj.getMode()
        sw_smart_zoning = shZoneStatusObj.getSmartZoningStatus() if sw_smart_zoning.lower() == "Enabled".lower():
            sw_smart_zoning_bool = True
        else:
            sw_smart_zoning_bool = False if shZoneStatusObj.isVsanAbsent():
            module.fail_json(msg='Vsan ' + str(vsan) + ' is not present in the switch. Hence cannot procced.') if shZoneStatusObj.isLocked():
            module.fail_json(msg='zone has acquired clock on the switch for vsan ' + str(vsan) + '. Hence cannot procced.')

```

`

Referencing the ShowZoneStatus module that its calling

Looks like its mishandling the output from this command…

`  
def update(self):

output = self.execute\_show\_zone\_status\_cmd().split(“\n”)

patfordefzone = “VSAN: " + str(self.vsan) + r” default-zone:\s+(\S+).\*"  
patformode = r"._mode:\s+(\S+)._"  
patforsession = r"._session:\s+(\S+)._"  
patforsz = r"._smart-zoning:\s+(\S+)._"  
for line in output:  
if “is not configured” in line:  
self.vsanAbsent = True  
break  
mdefz = re.match(patfordefzone, line.strip())  
mmode = re.match(patformode, line.strip())  
msession = re.match(patforsession, line.strip())  
msz = re.match(patforsz, line.strip())

if mdefz:  
self.default\_zone = mdefz.group(1)  
if mmode:  
self.mode = mmode.group(1)  
if msession:  
self.session = msession.group(1)  
if self.session != “none”:  
self.locked = True  
if msz:  
self.sz = msz.group(1)

def isLocked(self):  
return self.locked

`

---

<div class="post-metadata">

**Author:** ![kzersatz](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@kzersatz](https://forum.ansible.com/u/kzersatz)\
**Post date:** [June 11, 2020, 7:24pm UTC](https://forum.ansible.com/t/cisco-mds-nxos-zone-zoneset/33128/6 "2020-06-11T19:24:50Z")

</div>

Opened an issue with Cisco on github.

[https://github.com/Cisco-SAN/MDS\_Ansible\_Modules/issues/9](https://github.com/Cisco-SAN/MDS_Ansible_Modules/issues/9)
