Attempting to Add a newly created alias in our playbook to a zone and then activating a zoneset fails with several syntax errors.
clakkimsetty opened this issue · 14 comments
The issue I started:
SUMMARY
Attempting to Add a newly created alias in our playbook to a zone and then activating a zoneset fails with several syntax errors. Output is not in the correct sections based on the correct padding.
ISSUE TYPE
- Bug Report
COMPONENT NAME
nxos_zone_zoneset
ANSIBLE VERSION
We are using ansible tower as execution environment , the version is Ansible Automation Platform Controller 4.1.0
COLLECTION VERSION
This is a part of the Ansible Core Modules installed in the Execution environment
CONFIGURATION
N/A - Not possible in our Environment
OS / ENVIRONMENT
We are running this playbook on Ansible tower which is installed on RedHat Linux (RHEL 8)
Since Tower not using that OS, The worker nodes however are based on the minimal RHEL 8
STEPS TO REPRODUCE
This is the playbook that we wrote to create device alias MDS and Add Host Device-Alias to MDS Zones & Activate SAN Zone for provisioned infrastructure
- hosts: all
connection: local
gather_facts: no
vars:
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: cisco.nxos.nxos
tasks:
#Create Device Alias MDS ( this ansible block is working for us )
- name: Create device alias for MDS
cisco.nxos.nxos_devicealias:
da:
- name: "{{ mds_alias_name }}"
pwwn: "{{ mds_pwwn }}"
register: result
- debug: var=result
#Add host Device-Alias to MDS Zones & Activate SAN Zone for provisioned infrastructure ( we are getting issues in the below ansible block )
- name: Add Device Alias to Zone
cisco.nxos.nxos_zone_zoneset:
zone_zoneset_details:
- vsan: "{{ mds_vsan }}"
- mode: enhanced
zoneset:
- name: "{{ mds_zoneset }}"
- action: activate
- members:
- name: "{{ mds_zonename }}"
zone:
- name: "{{ mds_zonename }}"
- members:
- pwwn: "{{ mds_pwwn }}"
- device_alias: "{{ mds_alias_name }}"
- devtype: "{{ mds_devtype }}"
register: result
EXPECTED RESULTS
ACTUAL RESULTS
We are getting this error related to syntax and padding , any help here would be appreciated
the error appears to be in '/project/MDSZoningMain.yml': line 33, column 13, but may
21
be elsewhere in the file depending on the exact syntax problem.
2223
The offending line appears to be:
2425
name: "{{ mds_zonename }}"
26
- members:
27
^ here
This is the output we are getting with error msg
"msg": "missing required arguments: name found in zone_zoneset_details -> zone",
"invocation": {
"module_args": {
"zone_zoneset_details": [
{
"vsan": 9,
"mode": "enhanced",
"zoneset": [
{
"name": "foo2_vxblock",
"remove": false,
"members": null,
"action": null
},
{
"action": "activate",
"remove": false,
"name": null,
"members": null
},
{
"members": [
{
"name": "foo2_dev2208",
"remove": false
}
],
"remove": false,
"name": null,
"action": null
}
],
"zone": [
{
"name": "foo2_dev2208",
"remove": false,
"members": null
},
{
"members": [
{
"device_alias": "foo2_010",
"pwwn": "foo2_010",
"remove": false,
"devtype": null
},
{
"devtype": "initiator",
"remove": false,
"pwwn": null
}
],
"remove": false,
"name": null
}
],
"default_zone": null,
"smart_zoning": null
}
Additionally we have tried padding this various differant ways, if we follow the Documentation we error, if we follow the examples it also errors. The 2 dont match and after changing padding, list items, etc. multiple times we were never able to get it to run.
@srbharadwaj could you please respond to this? Thank you.
@NilashishC is there a way we can attach files to the open issues? From the looks of it, it seems to be a problem with yaml formatting isn't?
@clakkimsetty looks like an invalid yaml to me, please verify the same via some validator tools like https://www.yamllint.com/
@srbharadwaj Yes, seems like YAML indentation issue to me.
We can always attach files to comments by dragging and dropping. But from the initial issue description, this is what I could make out:
---
- hosts: all
gather_facts: no
vars:
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: cisco.nxos.nxos
tasks:
- name: Create device alias for MDS
cisco.nxos.nxos_devicealias:
da:
- name: "{{ mds_alias_name }}"
pwwn: "{{ mds_pwwn }}"
- name: Add Device Alias to Zone
cisco.nxos.nxos_zone_zoneset:
zone_zoneset_details:
- vsan: "{{ mds_vsan }}"
mode: enhanced
zone:
- name: "{{ mds_zonename }}"
members:
- pwwn: "{{ mds_pwwn }}"
- device_alias: "{{ mds_alias_name }}"
- devtype: "{{ mds_devtype }}"
zoneset:
- name: "{{ mds_zoneset }}"
action: activate
members:
- name: "{{ mds_zonename }}"
Please confirm if this is correct.
Hi, thanks for replying on to the issue , As mentioned above here is the yaml file attached , please check and let us know. Thanks
i have uploaded a zip folder above in which it has the yaml file , please let me know if you can access that
@clakkimsetty Thanks for the yaml file, as suspected, the way the yaml file was constructed was wrong, attached is the correct yaml as well as the run log of the playbook.
Please compare the one attached to the one you shared to know the differences, basically '-' should be used only for list elements, you may want to check the yaml syntax at https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html
@clakkimsetty Please let us know if the updated playbook provided by @srbharadwaj works for you. Thanks.
Thank you. We will close this issue now.