#Retrieving lun_naa_id and capturing it in a variable

1 messages · Page 1 of 1 (latest)

opaque egret
#

I am able to see the lun_naa_id when using na_ontap_lun_map but I can't figure how to capture it into a variable. Any advise or can you point me in the right direction?

keen geode
#

return values can be captured with register:

`- name: Create LUN mapping
netapp.ontap.na_ontap_lun_map:
state: present
initiator_group_name: ansibleIgroup3234
path: /vol/iscsi_path/iscsi_lun
vserver: ci_dev
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
register: lun_map_result

  • name: show captured variable
    ansible.builtin.debug:
    var: lun_map_result`
opaque egret
#

I did something similiar to this but I just want "one" field. We use SAN luns. I want just the lun_naa_id result to capture .When I did this I got all the lun info, size, os ype, serial, type, & state.

patent cape
#

With the register: example above - use 'set_fact' to save the naa id to a variable then you can reference it later...

opaque egret
#

I get this error. The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'lun_naa_id'

opaque egret
#

I figured it out. It was part of a loop. That seemed to be the issue.

#

when using this community.vmware.vmware_host_datastore module to create a SAN attached datastore, I get "Cannot mount datastore DataStore 1 on host 1. The object or item referred to could not be found." The Lun IDs match.

#

It seems to get stuck on the name of the datastore.