#how can we get the is_home info of the lifs using anisble?

1 messages · Page 1 of 1 (latest)

normal pendant
#

i used the network/ip/interfaces on netapp.ontap.na_ontap_rest_info module. but it only gives uuid and name. doesnt have other details.

daring fable
#

Hi!

Try this:

  • name: Get existing net interface info
    netapp.ontap.na_ontap_rest_info:
    hostname: "{{ netapp_hostname }}"
    username: "{{ netapp_username }}"
    password: "{{ netapp_password }}"
    https: true
    validate_certs: false
    gather_subset: "network/ip/interfaces"
    use_python_keys: true
    fields:
    - 'name'
    - 'location.is_home'
    register: lifinfo

Keep in mind to use 'fields' when using the na_ontap_rest_info module, it is necessary in many cases.

normal pendant
#

thanks @daring fable that works like a charm. Quick one, i am still in learning mode on ansible. just wanted to know, how do we get to know the fields on na_ontap_rest_info module ?

tawny glacier
normal pendant
#

awesome thanks @tawny glacier

normal pendant
#
  • name: revert network interface to home port
    netapp.ontap.na_ontap_ssh_command:
    <<: *login
    command: 'network interface revert -lif {{ item.name }}'
    accept_unknown_host_keys: true
    loop: "{{ result.ontap_info.network_ip_interfaces.records }}"
    loop_control:
    label: "NAME: {{ item.name }} ISHOME: {{ item.location.is_home }}"
    when: item.location.is_home == false
    delegate_to: localhost
#

not sure what i am doing wrong here.. i gets the not home lif but doesnt seem to revert to home

tawny glacier
#

Why use SSH command module? na_ontap_interface has an example for migration

indigo dome
#

"is_home" is basically "current_node == home_node" and "current_port == home_port", so a workaround would be to just use these

normal pendant
#

i was using the logic to get all the interface and if any interface is not on the home node , then revert that interface to the home node.

#

command: 'network interface revert -lif {{ item.name }}' doesnt work.. if i use a * instead of item.name then that works..

indigo dome
#

yes because net int revertneeds both the VServer name and the LIF name. LIF names alone are not unique

normal pendant
#

thanks @indigo dome . command: 'network interface revert -vserver * -lif {{ item.name }}' worked as i expected