I am trying to create volumes and LUNs across different NetApp ONTAP 9.13.1 clusters. For the moment my work manages one cluster and I have my connection details set with:
in my role main playbook:
module_defaults: group/netapp.ontap.netapp_ontap: hostname: "{{ clusterip }}" username: "{{ user }}" password: "{{ pass }}" https: "{{ https_option }}" validate_certs: "{{ validate_certs_option }}" use_rest: always
but if I want to create a LUN in a specific cluster I might need to use the :
vars: cluster1: &cluster1 hostname: "{{ clusterip }}" username: "{{ user }}" password: "{{ pass }}" https: "{{ https_option }}" validate_certs: "{{ validate_certs_option }}"
and in every netapp task in all my tasks playbooks: I will use something similar to this:
- name: Create LUN na_ontap_lun: <<: *cluster1 name: "cluster_1-luntest"
but if I want to keep the task general and customisable for all clusters I want to be able to have
- name: Create LUN na_ontap_lun: <<: *login name: "{{ cluster_number }}-luntest"
and login will point to the right cluster credentials depending on {{ cluster_number }}, and there would be no need to repeat the task N times ( N being number of clusters ) to create a LUN with the correct login credentials.
How can this be achieved or what is the best practice for handling resource creation in multi cluster environment?