1818 ansible.builtin.set_fact :
1919 run__datahub_subnet_ids : " {{ infra__azure_subnets }}"
2020
21- - name : Set fact for Azure NFS Mount
22- when : infra__azure_nfs_mount is defined
21+ # TODO Discover an existing NFS mount (shared) if not created upstream
22+ # This might not exist. If so, then the ML configs MUST declare their own location
23+ # If it does exist, then the ML configs can use it as a default if not set explicitly
24+
25+ - name : Set fact for Azure NFS mount path if established by Infrastructure
26+ when : infra__azure_netapp_nfs_mount is defined
2327 ansible.builtin.set_fact :
24- run__azure_nfs_mount : " {{ infra__azure_nfs_mount }}"
28+ run__azure_netapp_nfs_mount : " {{ infra__azure_netapp_nfs_mount }}"
29+
30+ - name : Discover Azure NetApp NFS mount path
31+ when : run__azure_netapp_nfs_mount is undefined
32+ block :
33+ - name : Get Azure NetApp NFS volume details
34+ register : __azure_netapp_nfs_info
35+ azure.azcollection.azure_rm_resource_info :
36+ resource_group : " {{ run__azure_metagroup_name }}"
37+ provider : NetApp
38+ resource_type : netAppAccounts
39+ resource_name : " {{ run__azure_netapp_account_name }}"
40+ subresource :
41+ - type : capacityPools
42+ name : " {{ run__azure_netapp_pool_name }}"
43+ - type : volumes
44+ name : " {{ run__azure_netapp_vol_name }}"
45+
46+ - name : Set Azure NetApp Volume Start IP if exists
47+ when : __azure_netapp_nfs_info.response | length > 0
48+ ansible.builtin.set_fact :
49+ __azure_netapp_startip : " {{ __azure_netapp_nfs_info.response | first | community.general.json_query('properties.mountTargets[0].ipAddress') }}"
50+
51+ - name : Set Azure NetApp Volume Info and Protocol if exists
52+ when : __azure_netapp_startip is defined
53+ block :
54+ - name : Set Azure NetApp Volume NFS mount path
55+ ansible.builtin.set_fact :
56+ run__azure_netapp_nfs_mount : " {{ __azure_netapp_startip }}:/{{ run__namespace }}"
57+
58+ - name : Validate Azure NetApp Volume NFS protocol version
59+ ansible.builtin.assert :
60+ that : ("NFSv" + run__azure_netapp_nfs_version) in __azure_netapp_nfs_info.response | first | community.general.json_query('properties.protocolTypes')
61+ fail_msg : " Invalid NFS protocol version. 'NFSv{{ run__azure_netapp_nfs_version }}' not supported by Azure NetApp volume, '{{ __azure_netapp_nfs_info.response | map('attribute', 'id') | list | first }}'."
62+ quiet : yes
63+
64+ # ansible -m azure.azcollection.azure_rm_resource_info localhost -a "resource_group=go03-rmgp provider=NetApp resource_type='netAppAccounts' resource_name='go03-netapp-account' subresource={{ subs }}" -e '{ "subs": [{ "type": "capacityPools" }] }'
0 commit comments