#how can we get the is_home info of the lifs using anisble?
1 messages · Page 1 of 1 (latest)
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.
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 ?
You have to study the endpoints in the API reference https://docs.netapp.com/us-en/ontap-automation/reference/api_reference.html#access-the-ontap-api-documentation-page
awesome thanks @tawny glacier
- 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
"is_home" is basically "current_node == home_node" and "current_port == home_port", so a workaround would be to just use these
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.
yes because net int revertneeds both the VServer name and the LIF name. LIF names alone are not unique