summaryrefslogtreecommitdiffstats
path: root/collections-debian-merged/ansible_collections/community/azure
diff options
context:
space:
mode:
Diffstat (limited to 'collections-debian-merged/ansible_collections/community/azure')
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/.gitignore387
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/CHANGELOG.rst20
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/COPYING675
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/FILES.json1902
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/MANIFEST.json32
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/README.md36
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/changelogs/changelog.yaml1
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/changelogs/config.yaml29
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/changelogs/fragments/.keep0
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/meta/action_groups.yml27
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/meta/runtime.yml302
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/__init__.py0
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aks_facts.py190
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aks_info.py190
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aksversion_facts.py133
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aksversion_info.py133
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_applicationsecuritygroup_facts.py229
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_applicationsecuritygroup_info.py229
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_appserviceplan_facts.py241
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_appserviceplan_info.py241
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_automationaccount_facts.py383
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_automationaccount_info.py383
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_autoscale_facts.py271
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_autoscale_info.py271
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_availabilityset_facts.py216
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_availabilityset_info.py216
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnendpoint_facts.py315
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnendpoint_info.py315
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnprofile_facts.py268
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnprofile_info.py268
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerinstance_facts.py320
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerinstance_info.py320
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerregistry_facts.py283
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerregistry_info.py283
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_facts.py520
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_info.py520
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_deployment_facts.py249
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_deployment_info.py249
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlab_facts.py272
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlab_info.py272
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabarmtemplate_facts.py226
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabarmtemplate_info.py226
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifact_facts.py250
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifact_info.py250
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifactsource_facts.py258
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifactsource_info.py258
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabcustomimage_facts.py229
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabcustomimage_info.py229
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabenvironment_facts.py245
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabenvironment_info.py245
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabpolicy_facts.py243
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabpolicy_info.py243
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabschedule_facts.py222
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabschedule_info.py222
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualmachine_facts.py329
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualmachine_info.py329
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualnetwork_facts.py221
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualnetwork_info.py221
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnsrecordset_facts.py294
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnsrecordset_info.py294
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnszone_facts.py258
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnszone_info.py258
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_functionapp_facts.py206
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_functionapp_info.py206
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_hdinsightcluster_facts.py321
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_hdinsightcluster_info.py321
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_image_facts.py307
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_image_info.py307
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loadbalancer_facts.py177
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loadbalancer_info.py177
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_lock_facts.py223
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_lock_info.py223
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loganalyticsworkspace_facts.py269
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loganalyticsworkspace_info.py269
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_managed_disk.py489
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_managed_disk_facts.py243
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk.py489
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk_facts.py243
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk_info.py243
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbconfiguration_facts.py216
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbconfiguration_info.py216
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbdatabase_facts.py211
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbdatabase_info.py211
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbfirewallrule_facts.py207
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbfirewallrule_info.py207
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbserver_facts.py264
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbserver_info.py264
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlconfiguration_facts.py214
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlconfiguration_info.py214
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqldatabase_facts.py209
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqldatabase_info.py209
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlfirewallrule_facts.py205
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlfirewallrule_info.py205
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlserver_facts.py262
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlserver_info.py262
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_networkinterface_facts.py354
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_networkinterface_info.py354
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlconfiguration_facts.py217
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlconfiguration_info.py217
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqldatabase_facts.py209
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqldatabase_info.py209
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlfirewallrule_facts.py205
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlfirewallrule_info.py205
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlserver_facts.py263
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlserver_info.py263
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_publicipaddress_facts.py321
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_publicipaddress_info.py321
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_rediscache_facts.py354
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_rediscache_info.py354
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resource_facts.py431
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resource_info.py431
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resourcegroup_facts.py239
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resourcegroup_info.py239
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roleassignment_facts.py280
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roleassignment_info.py280
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roledefinition_facts.py310
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roledefinition_info.py310
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_routetable_facts.py219
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_routetable_info.py219
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_securitygroup_facts.py320
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_securitygroup_info.py320
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_servicebus_facts.py584
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_servicebus_info.py584
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqldatabase_facts.py288
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqldatabase_info.py288
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlfirewallrule_facts.py215
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlfirewallrule_info.py215
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlserver_facts.py207
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlserver_info.py207
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_storageaccount_facts.py555
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_storageaccount_info.py555
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_subnet_facts.py246
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_subnet_info.py246
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerendpoint_facts.py311
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerendpoint_info.py311
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerprofile_facts.py422
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerprofile_info.py422
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_extension.py339
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_facts.py456
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_info.py456
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_scaleset.py1235
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_scaleset_facts.py436
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension.py339
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension_facts.py248
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension_info.py248
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineimage_facts.py258
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineimage_info.py258
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset.py1235
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset_facts.py436
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset_info.py436
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetextension_facts.py228
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetextension_info.py228
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetinstance_facts.py243
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetinstance_info.py243
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetwork_facts.py338
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetwork_info.py338
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetworkpeering_facts.py256
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetworkpeering_info.py256
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_webapp_facts.py488
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_webapp_info.py488
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/shippable.yml37
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/.gitignore1
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/aliases4
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/tasks/main.yml74
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/aliases17
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/tasks/main.yml714
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/aliases8
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/tasks/main.yml581
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/aliases10
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/tasks/main.yml581
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/aliases10
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/tasks/main.yml552
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/aliases4
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/tasks/main.yml95
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/aliases5
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/tasks/main.yml269
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/aliases4
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/tasks/main.yml269
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/aliases8
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/tasks/main.yml375
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/aliases4
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/inventory.yml66
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/main.yml7
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/runme.sh5
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_deallocate.yml78
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_dual_nic.yml116
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_invalid.yml31
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_minimal.yml64
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_no_public_ip.yml38
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_public_ip.yml236
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/setup.yml22
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/aliases4
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/tasks/main.yml167
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/aliases7
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/tasks/main.yml547
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/aliases5
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/meta/main.yml2
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/tasks/main.yml369
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/setup_azure/aliases0
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/requirements.yml3
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/sanity/ignore-2.10.txt270
-rw-r--r--collections-debian-merged/ansible_collections/community/azure/tests/sanity/requirements.txt4
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/azure/tests/utils/ado/ado.sh124
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/azure.sh19
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/check_matrix.py120
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/cloud.sh19
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/sanity.sh27
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/shippable.sh202
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/timing.py16
-rwxr-xr-xcollections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/timing.sh5
221 files changed, 53833 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/community/azure/.gitignore b/collections-debian-merged/ansible_collections/community/azure/.gitignore
new file mode 100644
index 00000000..c6fc14ad
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/.gitignore
@@ -0,0 +1,387 @@
+
+# Created by https://www.gitignore.io/api/git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs,dotenv
+# Edit at https://www.gitignore.io/?templates=git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs,dotenv
+
+### dotenv ###
+.env
+
+### Emacs ###
+# -*- mode: gitignore; -*-
+*~
+\#*\#
+/.emacs.desktop
+/.emacs.desktop.lock
+*.elc
+auto-save-list
+tramp
+.\#*
+
+# Org-mode
+.org-id-locations
+*_archive
+
+# flymake-mode
+*_flymake.*
+
+# eshell files
+/eshell/history
+/eshell/lastdir
+
+# elpa packages
+/elpa/
+
+# reftex files
+*.rel
+
+# AUCTeX auto folder
+/auto/
+
+# cask packages
+.cask/
+dist/
+
+# Flycheck
+flycheck_*.el
+
+# server auth directory
+/server/
+
+# projectiles files
+.projectile
+
+# directory configuration
+.dir-locals.el
+
+# network security
+/network-security.data
+
+
+### Git ###
+# Created by git for backups. To disable backups in Git:
+# $ git config --global mergetool.keepBackup false
+*.orig
+
+# Created by git when using merge tools for conflicts
+*.BACKUP.*
+*.BASE.*
+*.LOCAL.*
+*.REMOTE.*
+*_BACKUP_*.txt
+*_BASE_*.txt
+*_LOCAL_*.txt
+*_REMOTE_*.txt
+
+#!! ERROR: jupyternotebook is undefined. Use list command to see defined gitignore types !!#
+
+### Linux ###
+
+# temporary files which can be created if a process still has a handle open of a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being accessed
+.nfs*
+
+### PyCharm+all ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+### PyCharm+all Patch ###
+# Ignores the whole .idea folder and all .iml files
+# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
+
+.idea/
+
+# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
+
+*.iml
+modules.xml
+.idea/misc.xml
+*.ipr
+
+# Sonarlint plugin
+.idea/sonarlint
+
+### pydev ###
+.pydevproject
+
+### Python ###
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+pip-wheel-metadata/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# pyenv
+.python-version
+
+# pipenv
+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+# However, in case of collaboration, if having platform-specific dependencies or dependencies
+# having no cross-platform support, pipenv may install dependencies that don't work, or not
+# install all needed dependencies.
+#Pipfile.lock
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# Mr Developer
+.mr.developer.cfg
+.project
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+### Vim ###
+# Swap
+[._]*.s[a-v][a-z]
+[._]*.sw[a-p]
+[._]s[a-rt-v][a-z]
+[._]ss[a-gi-z]
+[._]sw[a-p]
+
+# Session
+Session.vim
+Sessionx.vim
+
+# Temporary
+.netrwhist
+# Auto-generated tag files
+tags
+# Persistent undo
+[._]*.un~
+
+### WebStorm ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+
+# Generated files
+
+# Sensitive or high-churn files
+
+# Gradle
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn. Uncomment if using
+# auto-import.
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+# *.iml
+# *.ipr
+
+# CMake
+
+# Mongo Explorer plugin
+
+# File-based project format
+
+# IntelliJ
+
+# mpeltonen/sbt-idea plugin
+
+# JIRA plugin
+
+# Cursive Clojure plugin
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+
+# Editor-based Rest Client
+
+# Android studio 3.1+ serialized cache file
+
+### WebStorm Patch ###
+# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
+
+# *.iml
+# modules.xml
+# .idea/misc.xml
+# *.ipr
+
+# Sonarlint plugin
+.idea/**/sonarlint/
+
+# SonarQube Plugin
+.idea/**/sonarIssues.xml
+
+# Markdown Navigator plugin
+.idea/**/markdown-navigator.xml
+.idea/**/markdown-navigator/
+
+### Windows ###
+# Windows thumbnail cache files
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
+
+# Dump file
+*.stackdump
+
+# Folder config file
+[Dd]esktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# End of https://www.gitignore.io/api/git,linux,pydev,python,windows,pycharm+all,jupyternotebook,vim,webstorm,emacs,dotenv
diff --git a/collections-debian-merged/ansible_collections/community/azure/CHANGELOG.rst b/collections-debian-merged/ansible_collections/community/azure/CHANGELOG.rst
new file mode 100644
index 00000000..ec558fdf
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/CHANGELOG.rst
@@ -0,0 +1,20 @@
+=============================
+Community Azure Release Notes
+=============================
+
+.. contents:: Topics
+
+
+v1.0.0
+======
+
+Release Summary
+---------------
+
+This is the first proper release of the ``community.crypto`` collection. This changelog contains all changes to the modules in this collection that were added after the release of Ansible 2.9.0.
+
+
+Minor Changes
+-------------
+
+- Documentation updated to use FQCN.
diff --git a/collections-debian-merged/ansible_collections/community/azure/COPYING b/collections-debian-merged/ansible_collections/community/azure/COPYING
new file mode 100644
index 00000000..10926e87
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/COPYING
@@ -0,0 +1,675 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
diff --git a/collections-debian-merged/ansible_collections/community/azure/FILES.json b/collections-debian-merged/ansible_collections/community/azure/FILES.json
new file mode 100644
index 00000000..7617a25e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/FILES.json
@@ -0,0 +1,1902 @@
+{
+ "files": [
+ {
+ "name": ".",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "meta/runtime.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f4be75a7edd84978144796189e439c48b40779f36384186dc8b15f83e50792cf",
+ "format": 1
+ },
+ {
+ "name": "meta/action_groups.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "17900c5cb6c043d1c90df45db9c3e6aafaf48e42869ec20b5c2fe97cae327b43",
+ "format": 1
+ },
+ {
+ "name": "plugins",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/modules",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_rediscache_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "774eb14439e0136d25fc331231992552e1ee66439784ce68db3a644cec560fe5",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_lock_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4d708e179f05a954c04005863978e1d1867e09e9e0442e93e5f0833c6cb4fe49",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabvirtualnetwork_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5c16f59e5881b10b37dbf07ada48b3502fddb8d65e64f4a0e4b5aeae3cca708e",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_postgresqldatabase_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ce7746d710c2207b1be0496855ed0c1d6df33744eab4b78a8e3a79d5cd57176c",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_securitygroup_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f339a892b623100065178c971e1206a01dcd59072ef298367d2e0014017ca491",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachine_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "26be016eddae95734ae776a9421e815be0db926bf2e4c5dd479a6dfde4fde663",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_aks_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "91f8a16ea315abe4975ed61e0d7916621c6a1c04664cd78638331811f44f79d9",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_networkinterface_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1f5e351d49c4d3dbe10d08c9b22719015a45f22b8155ea040a35098a43b47d1d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_routetable_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b40be3fa7e0b38ebc2c37792d2bd4f36cfad16b800cb256d085ae709603ced34",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_subnet_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "bfac712d591651429609194583fe1d1daa6f2cfe4857164db9a5144fd1ffaeff",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_automationaccount_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3c214be4c704fa9fbd7d887fc222044dd15d07745729e61b6e54190f0c5587ee",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabarmtemplate_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0ebf8e09b911b632bebd90b7031d51572c6c8006a514f53d53a37948ccd2aa1f",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_subnet_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "bfac712d591651429609194583fe1d1daa6f2cfe4857164db9a5144fd1ffaeff",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_trafficmanagerprofile_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "cde0ba84f8e40bcacde6fb9cda8db41e47afdfeb412d6c099440721e81f19736",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_availabilityset_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "9bd11d161fc27109220133f2ba7bfe4d58cc51e96a496c1d1ab53c67c7d227cd",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachine_scaleset.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d0e4531abf1b6dc6cc1a70133ef58d20841c181fe31db5ba97805c78ddf884c1",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_cosmosdbaccount_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "076fb67026a1f3d197c0e1e7413bb2de8feab526281d43a18b308c3bf90a92fb",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_roledefinition_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "9ee4c8fa6b02cac6f6a806ff9affc123ac0f99fd37d288e21702c59e8f554c31",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachinescaleset_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e62c378ee2de29da399c876cb2636249e464e6aab573561d53d221a37641cf45",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_deployment_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "31d6565ca6267eb9b7ae50ae726d86b5d6759e3010cf5d490ad36f98b4d13afe",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualnetwork_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7363ac5674deffa82ff2a4f370cac7375009a622e6bc9aea1c037e2e32ccf120",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_postgresqldatabase_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ce7746d710c2207b1be0496855ed0c1d6df33744eab4b78a8e3a79d5cd57176c",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_networkinterface_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1f5e351d49c4d3dbe10d08c9b22719015a45f22b8155ea040a35098a43b47d1d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_publicipaddress_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e42430d44150e2c4f1fc2f42e7265b00b53a7ae9dab6dee0780d6d286c157162",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_cdnprofile_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "05ae0a117e0af636a0cfa1da2d59c7f440ce9b65c5a837f8bd93456bdda0b449",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mysqlfirewallrule_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6458f250e1c2b373b224e083fe38716161f214da64d2d5b960071739741ab4f9",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_postgresqlserver_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b46fb9f0c2b2283e44f04c8976ddcd059b25f32abd30a9a2479cb01ab3507618",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mariadbdatabase_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "886fc665fc6ac2e18f97f76c9c4fc9ce2588d691b18e3a16ef15989f9c89351d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_cosmosdbaccount_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "076fb67026a1f3d197c0e1e7413bb2de8feab526281d43a18b308c3bf90a92fb",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_hdinsightcluster_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7bb998273e150b8e285c595dfa27ca03be0448fca0242cfabdce9bc6ec0fa345",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/__init__.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_sqldatabase_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "caabca6d86b3d6675f7220b21a8e12c64c42edeaf8e62afa432591dc9ce110d1",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_functionapp_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4705c1963179895d07bff350bb129981c1b0fa1b27f0659213f1d8dc2b94eff3",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_webapp_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "9eb3ba96a32aa9f29fe01aa207b82f0f546d0063ec97b579d243d7b623b562fa",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mysqlserver_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "825312dac8ed9430efb76fceac1b6df27c5df4c6a9513f765bdd6bf12fb7f985",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualnetworkpeering_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "fe17149b5228fb7ab113f4d9c20429c6a98edc18c89565fba7f91506b8a9d659",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabartifactsource_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2a26d6ce8c724e893b6ad8b433b2d914fe42e03bff6cbf88076b09191ff26ed8",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabvirtualmachine_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "69c61200e50217e3e08947b96c9d04b24a82126c7f4ce885757dfd25e107bad1",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_trafficmanagerendpoint_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "aac0e6a42b247e068c8058fb3d8254f1c9204ba981a5626d2dd4c3effa7d085a",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_lock_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4d708e179f05a954c04005863978e1d1867e09e9e0442e93e5f0833c6cb4fe49",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_routetable_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b40be3fa7e0b38ebc2c37792d2bd4f36cfad16b800cb256d085ae709603ced34",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_servicebus_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4076ed1f7366d6a6b7241654bbc84d03c46104989bb0e3237efd11f52d32f809",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_loadbalancer_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7ce1a659c5d7b69313fb97a3f1e49d81b6f4acc6000ee54045292ad29ce70f6a",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachinescalesetextension_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d05a2ccea9b2c645e3a627806b2622cee8fd5714b3bb533669bb394f695a133d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabpolicy_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b9dcaaffc184dbc6ab2b34c47035336c7d41fa1f10deef8ceb9b82bebd3246f9",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_trafficmanagerendpoint_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "aac0e6a42b247e068c8058fb3d8254f1c9204ba981a5626d2dd4c3effa7d085a",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_applicationsecuritygroup_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4b7fd6950f37cfecb43c2d5c6619aa366f54baed7790c98bc55d854f3463fa4b",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_rediscache_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "774eb14439e0136d25fc331231992552e1ee66439784ce68db3a644cec560fe5",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabartifact_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f336a83aed8187a22b3442ba5e27c475e297bf8982071894dea3101eed450e40",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_image_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f9e456b4b6d2717a36f619eac29ba59cdc97c16a0f7691f8648cd1b215606c5d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_cdnprofile_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "05ae0a117e0af636a0cfa1da2d59c7f440ce9b65c5a837f8bd93456bdda0b449",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_roleassignment_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b774866f9bf4243051514616560bd7c057319ac8528cafbc6eb3d545d3f66296",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_publicipaddress_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e42430d44150e2c4f1fc2f42e7265b00b53a7ae9dab6dee0780d6d286c157162",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_resourcegroup_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ef8152e362009dc48e7ce027af21da6889204077e068fff08e49adbebda86bb1",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_appserviceplan_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6a4b70ed248357a7a703e9f013bc0378d3aae717525be60fa77fea30457120de",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachinescalesetextension_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d05a2ccea9b2c645e3a627806b2622cee8fd5714b3bb533669bb394f695a133d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_dnszone_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1cfbdc531aa6f6a72ec5f8a87f850cb11af79c90901fab3169e18e59707bd7fe",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_loadbalancer_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7ce1a659c5d7b69313fb97a3f1e49d81b6f4acc6000ee54045292ad29ce70f6a",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachinescalesetinstance_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ea92a277964408570cf16efead0e60681195b9234567341fc7f689ec237fbd61",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_manageddisk_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b9264a65ed6c303f1ab20958e002f8f62d28b6ea3b5f35c70b2e608e4964af38",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_sqlfirewallrule_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e88e89d56dd9c71625ee091541ce285c8265a8f7f204e2e805b210ce043e08c4",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_hdinsightcluster_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7bb998273e150b8e285c595dfa27ca03be0448fca0242cfabdce9bc6ec0fa345",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_sqlserver_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3e947a74016139cd568b74ab7f0f4a831f3b890701ceed7cc0da24e989b4b657",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_postgresqlfirewallrule_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d24fb0351279bcface6e20a333bb1d843c2a39036e14651628c00314f8178fbe",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_dnsrecordset_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e356ecf5e5ea0e28fffe3a063915d87db9f099488e2de4391e8627c49e022b30",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_loganalyticsworkspace_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "90d118a1ea8f635b613b03a74415d7f9dc85074d35f9163200ca68d72561ad57",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlab_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f3d1889511ed1380a777d4d567f41f2433ebdd38c28cba10fbe3d3f1000cbbdc",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mysqlserver_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "825312dac8ed9430efb76fceac1b6df27c5df4c6a9513f765bdd6bf12fb7f985",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_aksversion_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "08bab0a6f3430434bcabb85dbd0bd19bbe42b0406df22bd67a4e2c3e3462d2ce",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_applicationsecuritygroup_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4b7fd6950f37cfecb43c2d5c6619aa366f54baed7790c98bc55d854f3463fa4b",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mariadbconfiguration_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8b4bf8ecb85abe8f1fe357f37c24fb8bcefb998edb97ddaeccefce9c22d7353f",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_sqlfirewallrule_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e88e89d56dd9c71625ee091541ce285c8265a8f7f204e2e805b210ce043e08c4",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabenvironment_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "42961c86995297179d9017e786a1bbf981fefa7fff276397a61be3894bdab582",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_sqlserver_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3e947a74016139cd568b74ab7f0f4a831f3b890701ceed7cc0da24e989b4b657",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_loganalyticsworkspace_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "90d118a1ea8f635b613b03a74415d7f9dc85074d35f9163200ca68d72561ad57",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_containerinstance_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e5c92958753a562a0da37af470a99c3272157f9161c3b1ed0ca5e820b0373a95",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_manageddisk_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b9264a65ed6c303f1ab20958e002f8f62d28b6ea3b5f35c70b2e608e4964af38",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_trafficmanagerprofile_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "cde0ba84f8e40bcacde6fb9cda8db41e47afdfeb412d6c099440721e81f19736",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_containerregistry_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "459f8625df42cb62ebfeea4571095c4a6c68df8f180c89d831f841b84f290fb9",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_autoscale_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "675897fac80aacc0ff5814528937c9bb5f1435e75cbc3630e5b8e11c01418b84",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mysqlfirewallrule_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6458f250e1c2b373b224e083fe38716161f214da64d2d5b960071739741ab4f9",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_postgresqlconfiguration_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "21c2962168aa3ef8637e47ef3b3cddcce8d4e63aaacf193eaf27e41103103b05",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_deployment_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "31d6565ca6267eb9b7ae50ae726d86b5d6759e3010cf5d490ad36f98b4d13afe",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_roleassignment_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b774866f9bf4243051514616560bd7c057319ac8528cafbc6eb3d545d3f66296",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_functionapp_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4705c1963179895d07bff350bb129981c1b0fa1b27f0659213f1d8dc2b94eff3",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mysqlconfiguration_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0cc57e5b4c8bedaac7e5350702fc824db68ff36ac8a45fe00f3c579bb2c7e440",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachineimage_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1c06aeef1d06c23ece534f0ded04c778979f171c05e7639a62524817ddd1b4ee",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mysqldatabase_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "bdcca0f78c891ae6c45b79377242ce086ab7f91d29c181f43f5e7965ef07869f",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_autoscale_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "675897fac80aacc0ff5814528937c9bb5f1435e75cbc3630e5b8e11c01418b84",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabpolicy_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b9dcaaffc184dbc6ab2b34c47035336c7d41fa1f10deef8ceb9b82bebd3246f9",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabenvironment_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "42961c86995297179d9017e786a1bbf981fefa7fff276397a61be3894bdab582",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_sqldatabase_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "caabca6d86b3d6675f7220b21a8e12c64c42edeaf8e62afa432591dc9ce110d1",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_manageddisk.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "936cc2a5ae1b3787a5ec9fa45e65f08de429ca9556c3ab872a25ef0dcf5f03da",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_storageaccount_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "286df88b0cb3e82d89b4440a0deae759917202f12aa9670a49cdb2a1e4afff32",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabartifact_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f336a83aed8187a22b3442ba5e27c475e297bf8982071894dea3101eed450e40",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_roledefinition_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "9ee4c8fa6b02cac6f6a806ff9affc123ac0f99fd37d288e21702c59e8f554c31",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_cdnendpoint_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8a23dabf5f5073c046d10da91b7f2ed23e2bff6186ecb58622bc26c66d28d990",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_servicebus_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4076ed1f7366d6a6b7241654bbc84d03c46104989bb0e3237efd11f52d32f809",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mariadbfirewallrule_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "33d5631c2cddd77d0f0f0b086869f52769f095052ead81feaa2c7603121ab38f",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachineextension.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6be2ede1391f8ba0389f077e11bc49646f3fbfd0802bd8b2e111f057d2390dfd",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_cdnendpoint_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8a23dabf5f5073c046d10da91b7f2ed23e2bff6186ecb58622bc26c66d28d990",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachine_scaleset_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e62c378ee2de29da399c876cb2636249e464e6aab573561d53d221a37641cf45",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_resource_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "62a3f423f2a6a12c743ee941b2493a2a2fb270c30dad2c4114d9935d47ff9eef",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mariadbserver_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e0db0e1c877a0f8a5a9df56ffccc049b6590fc1918b9e6d5382ce09cbf779385",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachineimage_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1c06aeef1d06c23ece534f0ded04c778979f171c05e7639a62524817ddd1b4ee",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachinescalesetinstance_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ea92a277964408570cf16efead0e60681195b9234567341fc7f689ec237fbd61",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_managed_disk.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "936cc2a5ae1b3787a5ec9fa45e65f08de429ca9556c3ab872a25ef0dcf5f03da",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachineextension_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b235b6c0b5b6f2074a448b7d3b909f72c316f61d38ec88ee2c87dec473b7477b",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachineextension_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b235b6c0b5b6f2074a448b7d3b909f72c316f61d38ec88ee2c87dec473b7477b",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachine_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "26be016eddae95734ae776a9421e815be0db926bf2e4c5dd479a6dfde4fde663",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabschedule_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5ac385e6948f802968f040b0cbe068119cf184ec7f577137b8c0f5a93a522efd",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabarmtemplate_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0ebf8e09b911b632bebd90b7031d51572c6c8006a514f53d53a37948ccd2aa1f",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_automationaccount_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3c214be4c704fa9fbd7d887fc222044dd15d07745729e61b6e54190f0c5587ee",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_postgresqlserver_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b46fb9f0c2b2283e44f04c8976ddcd059b25f32abd30a9a2479cb01ab3507618",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualnetwork_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7363ac5674deffa82ff2a4f370cac7375009a622e6bc9aea1c037e2e32ccf120",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualnetworkpeering_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "fe17149b5228fb7ab113f4d9c20429c6a98edc18c89565fba7f91506b8a9d659",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabcustomimage_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "75f155f9c5f83e385dee840281dc893b31e827b6a9d6c04f47a1c295b168508d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_appserviceplan_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6a4b70ed248357a7a703e9f013bc0378d3aae717525be60fa77fea30457120de",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachine_extension.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6be2ede1391f8ba0389f077e11bc49646f3fbfd0802bd8b2e111f057d2390dfd",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mysqlconfiguration_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0cc57e5b4c8bedaac7e5350702fc824db68ff36ac8a45fe00f3c579bb2c7e440",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_securitygroup_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f339a892b623100065178c971e1206a01dcd59072ef298367d2e0014017ca491",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabartifactsource_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2a26d6ce8c724e893b6ad8b433b2d914fe42e03bff6cbf88076b09191ff26ed8",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_resource_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "62a3f423f2a6a12c743ee941b2493a2a2fb270c30dad2c4114d9935d47ff9eef",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabschedule_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5ac385e6948f802968f040b0cbe068119cf184ec7f577137b8c0f5a93a522efd",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mariadbdatabase_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "886fc665fc6ac2e18f97f76c9c4fc9ce2588d691b18e3a16ef15989f9c89351d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_aksversion_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "08bab0a6f3430434bcabb85dbd0bd19bbe42b0406df22bd67a4e2c3e3462d2ce",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mariadbserver_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e0db0e1c877a0f8a5a9df56ffccc049b6590fc1918b9e6d5382ce09cbf779385",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabvirtualmachine_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "69c61200e50217e3e08947b96c9d04b24a82126c7f4ce885757dfd25e107bad1",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_containerregistry_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "459f8625df42cb62ebfeea4571095c4a6c68df8f180c89d831f841b84f290fb9",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_dnszone_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1cfbdc531aa6f6a72ec5f8a87f850cb11af79c90901fab3169e18e59707bd7fe",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_webapp_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "9eb3ba96a32aa9f29fe01aa207b82f0f546d0063ec97b579d243d7b623b562fa",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mysqldatabase_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "bdcca0f78c891ae6c45b79377242ce086ab7f91d29c181f43f5e7965ef07869f",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_managed_disk_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b9264a65ed6c303f1ab20958e002f8f62d28b6ea3b5f35c70b2e608e4964af38",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_resourcegroup_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ef8152e362009dc48e7ce027af21da6889204077e068fff08e49adbebda86bb1",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabvirtualnetwork_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5c16f59e5881b10b37dbf07ada48b3502fddb8d65e64f4a0e4b5aeae3cca708e",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_storageaccount_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "286df88b0cb3e82d89b4440a0deae759917202f12aa9670a49cdb2a1e4afff32",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachinescaleset.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d0e4531abf1b6dc6cc1a70133ef58d20841c181fe31db5ba97805c78ddf884c1",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlabcustomimage_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "75f155f9c5f83e385dee840281dc893b31e827b6a9d6c04f47a1c295b168508d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_postgresqlfirewallrule_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d24fb0351279bcface6e20a333bb1d843c2a39036e14651628c00314f8178fbe",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_availabilityset_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "9bd11d161fc27109220133f2ba7bfe4d58cc51e96a496c1d1ab53c67c7d227cd",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_postgresqlconfiguration_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "21c2962168aa3ef8637e47ef3b3cddcce8d4e63aaacf193eaf27e41103103b05",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_dnsrecordset_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e356ecf5e5ea0e28fffe3a063915d87db9f099488e2de4391e8627c49e022b30",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_containerinstance_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e5c92958753a562a0da37af470a99c3272157f9161c3b1ed0ca5e820b0373a95",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_aks_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "91f8a16ea315abe4975ed61e0d7916621c6a1c04664cd78638331811f44f79d9",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mariadbconfiguration_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8b4bf8ecb85abe8f1fe357f37c24fb8bcefb998edb97ddaeccefce9c22d7353f",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_image_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f9e456b4b6d2717a36f619eac29ba59cdc97c16a0f7691f8648cd1b215606c5d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_virtualmachinescaleset_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e62c378ee2de29da399c876cb2636249e464e6aab573561d53d221a37641cf45",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_mariadbfirewallrule_facts.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "33d5631c2cddd77d0f0f0b086869f52769f095052ead81feaa2c7603121ab38f",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_devtestlab_info.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f3d1889511ed1380a777d4d567f41f2433ebdd38c28cba10fbe3d3f1000cbbdc",
+ "format": 1
+ },
+ {
+ "name": "README.md",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c1493affdda3ecaff57f050c29dc600cd97df74cc0d378a059b38d0cefdb835c",
+ "format": 1
+ },
+ {
+ "name": "CHANGELOG.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d4870dba105ff4c6af8941deaa9e12f97830a6f39b9d1083d155993c5fd91f17",
+ "format": 1
+ },
+ {
+ "name": "tests",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/sanity",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/sanity/ignore-2.10.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "fb6d386024cf58854a524c71c4004caad446cd5beb559e098bda50ddfcac57b3",
+ "format": 1
+ },
+ {
+ "name": "tests/sanity/requirements.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c8a4ac4bfdef88e75d6e748e35a42fb4915947dfa2b7dd788626fd829600e014",
+ "format": 1
+ },
+ {
+ "name": "tests/requirements.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "10abe0f4e4d63e04b4a5ae5b7b786a90e07d4d7c060c7e5d8548b0f67a2f6b99",
+ "format": 1
+ },
+ {
+ "name": "tests/integration",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_sqlserver",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_sqlserver/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_sqlserver/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_sqlserver/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "a384b758e56639007b0cd461ab72001e58011e43a9fdc8a2cc4da93908ce0b5b",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_sqlserver/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_sqlserver/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1d9551c42dc0fd4d3db786b525ef686540dfb4e49a93f7fd0b381c1e9d5f3c51",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/setup_azure",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/setup_azure/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mysqlserver",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mysqlserver/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mysqlserver/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mysqlserver/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0097d99b1d08c330352eca55034efe71eb4fd7c60daad2458dd51ed833adac21",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mysqlserver/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mysqlserver/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "9a3b579cfd310c919a0ada4d43ab14fbd0ac2cbfc05d2e1fc512e07ca600c6bb",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachineextension",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachineextension/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachineextension/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachineextension/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2cf21a9270482f8dc15a232c746ba8ffbe97f5a4ec2704d636c8c74b04bf3fa5",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachineextension/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachineextension/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b433b1550ea196f43fcfdfdf83e9775f5ef1dfeb6ff7607cd857cf225ad0b782",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_publicipaddress",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_publicipaddress/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_publicipaddress/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_publicipaddress/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c5a003e8ffbfa374330ab6a00edca3d006c93293049be5563c65c5fda8f60e38",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_publicipaddress/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_publicipaddress/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e68d74719393f1d8af675bb16cf62155d289b255368264df0cea63cf5631633e",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachinescaleset",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachinescaleset/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachinescaleset/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachinescaleset/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f05788275083186272fb140be1e8b93f1faa6b30eac971429c833e3f9a9dce7f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachinescaleset/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachinescaleset/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "09cc3824678018621fd742905bf6abe1ea08ead9da10a57e277e716c9a8a16d3",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_postgresqlserver",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_postgresqlserver/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_postgresqlserver/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_postgresqlserver/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1089ff382622172ca427a55f0ee5134893ac75704af10ef6cd8d6a482288a6b3",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_postgresqlserver/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_postgresqlserver/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "804c66531dc674478c6317504f26ad85200fa88476b83b35568d99e7abba98fe",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "be2ecb988a0740bffedda45bba0eae5cd1d8d45633f5b6fd67296ff15a8a324b",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/runme.sh",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8d9a70f8c75d9a856cd529ae8ccb6e589c0db9494da4bb08cead6963e98d9dd5",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d5ebc7dbf05811adb28876480455e89712f1573fb705705744183b986e9b407f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_minimal.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "07e2c8ebf1a6387b7a983a53c5c966c899c2934ed0786448f104d7afe1078a78",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_deallocate.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8ba8d439453c581b96ac93d5338698196801bb1c23182e7920d5fa3c7f777637",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_invalid.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5e80b3a2b33e208e205efd119bdb1aab8bd5d3503ee6feae062e296942cb9501",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_public_ip.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "100213494ab7fb792b774af4bd9622ac81f36853ebcbd99b8127b91e117c361a",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/tasks/setup.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "57567d672bbad5af46bb16620cd10542ae01f2eaab7f8ee73bf0b72f4bc83e50",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_no_public_ip.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8e64dd06bddd37fbc2cd2dc16c278410df242deb0d6d6d4159bda00cb5c346ca",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_dual_nic.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f9179de8f8ed757fa39f5bd6713ead6b9cfc85d7af4cf99c20ed608b5ae53fd7",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_virtualmachine/inventory.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4b3574ba494b0729da21cb55774c74783452976b6fcfdc40f4617092d5be5a74",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_webapp",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_webapp/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_webapp/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_webapp/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ad1631b85f25ba148ea7100de215466a8ac50b2d4d79500828648f36a2571031",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_webapp/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_webapp/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d38b4703ef1c63e0c9729827657f5bee4f3a6fa46fa296766c455046089fa58a",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_devtestlab",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_devtestlab/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_devtestlab/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_devtestlab/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "81191f20c3f97d7fc705a64e76daebd0c0087e9292dcdb2126b25ec55ff7ef16",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_devtestlab/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_devtestlab/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "80f9611aa33f01f4f9820c4b58e123c51df6c77ec2be358043ba7413d07dbe59",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_automationaccount",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_automationaccount/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_automationaccount/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_automationaccount/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5191cbf65e910c9bd37982dac5f676b0fc408c97ea3a24c111ad1bf72d2cfad1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_automationaccount/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_automationaccount/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "07382d16f30cdb5042b0d31f293bd22aface7702b97e4101a5dd33d391686c5f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mariadbserver",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mariadbserver/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mariadbserver/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mariadbserver/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "fbc6b23f69c7f9ec78dad1477f61f4dcd4df74ef9d78c402f07301a57bf405fc",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mariadbserver/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_mariadbserver/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b0e942c2b3a55361395883f727beb3a2e342d87428765933367363b330f35944",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_rediscache",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_rediscache/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_rediscache/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_rediscache/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ac986547c945a2dbded6048b482ded1f641bb8255b24bba56be966b232f149d1",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_rediscache/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_rediscache/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7abb4d365dcf3c7237cf289c701f230fb0af8651122031844caead2f3e5f4d8e",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_securitygroup",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_securitygroup/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_securitygroup/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_securitygroup/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6ef63ba8ab94dea44b52137776c2895b3e09c978826d424cd2bb227db386c2f2",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_securitygroup/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_securitygroup/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e2940498a937f1a986663fa9a5ba764cb0d1a3b9c010f1f83e90bc1f67197cc7",
+ "format": 1
+ },
+ {
+ "name": "tests/.gitignore",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b5726d3ec9335a09c124469eca039523847a6b0f08a083efaefd002b83326600",
+ "format": 1
+ },
+ {
+ "name": "tests/utils",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/utils/shippable",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/utils/shippable/shippable.sh",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4c1b75caeef9371ac155856d129f898f22f967ea558f73519f1a5ce7ed948dfb",
+ "format": 1
+ },
+ {
+ "name": "tests/utils/shippable/timing.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ebb7d3553349747ad41d80899ed353e13cf32fcbecbb6566cf36e9d2bc33703e",
+ "format": 1
+ },
+ {
+ "name": "tests/utils/shippable/check_matrix.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b228ec82e84aa69522362aa3f41c5b36e6f4e98553511362854456a474d99403",
+ "format": 1
+ },
+ {
+ "name": "tests/utils/shippable/timing.sh",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f3f3cc03a997cdba719b0542fe668fc612451841cbe840ab36865f30aa54a1bd",
+ "format": 1
+ },
+ {
+ "name": "tests/utils/shippable/cloud.sh",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "dd953f7e779b9962e76492c389142e03174e84a8115f53e56628e2af9e66b818",
+ "format": 1
+ },
+ {
+ "name": "tests/utils/shippable/sanity.sh",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "a01d92ca36ea457c0e7032ece03a0b485377eef8c8598d8f7c04a185fba279ed",
+ "format": 1
+ },
+ {
+ "name": "tests/utils/shippable/azure.sh",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "dd953f7e779b9962e76492c389142e03174e84a8115f53e56628e2af9e66b818",
+ "format": 1
+ },
+ {
+ "name": "tests/utils/ado",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/utils/ado/ado.sh",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "879019cb9fa8ea2ac1ae81197ebc880b20071f7e582407a7ba1d30002e9cb968",
+ "format": 1
+ },
+ {
+ "name": "changelogs",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "changelogs/changelog.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "02d9f0eea7df7b797153dce4bb6ad508d608590469e302fe9f38494c71e5643b",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/.keep",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "changelogs/config.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "93e6532aa24bd6b494fb52a349736e1595e133e7b2c6ff8197dbf35c31879d69",
+ "format": 1
+ },
+ {
+ "name": "COPYING",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0ae0485a5bd37a63e63603596417e4eb0e653334fa6c7f932ca3a0e85d4af227",
+ "format": 1
+ },
+ {
+ "name": "shippable.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "bf58f0d30ac91d3e80bd4217f433c2b1c5cba5e7702506ab72d245e0669d0f5b",
+ "format": 1
+ },
+ {
+ "name": ".gitignore",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "258e4be3cfda40797fe734b375b6f94c110c9a9bebce196fedce319a457ce720",
+ "format": 1
+ }
+ ],
+ "format": 1
+} \ No newline at end of file
diff --git a/collections-debian-merged/ansible_collections/community/azure/MANIFEST.json b/collections-debian-merged/ansible_collections/community/azure/MANIFEST.json
new file mode 100644
index 00000000..4c318e41
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/MANIFEST.json
@@ -0,0 +1,32 @@
+{
+ "collection_info": {
+ "namespace": "community",
+ "name": "azure",
+ "version": "1.0.0",
+ "authors": [
+ "Ansible (github.com/ansible)"
+ ],
+ "readme": "README.md",
+ "tags": [
+ "azure"
+ ],
+ "description": "The Community Azure Collection",
+ "license": [],
+ "license_file": "COPYING",
+ "dependencies": {
+ "azure.azcollection": ">=1.0.0"
+ },
+ "repository": "https://github.com:ansible-collections/community.azure",
+ "documentation": "https://docs.ansible.com/ansible/2.10/collections/community/azure/",
+ "homepage": "https://github.com/ansible-collections/community.azure",
+ "issues": "https://github.com/ansible-collections/community.azure/issues"
+ },
+ "file_manifest_file": {
+ "name": "FILES.json",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "84a5a8024a217386d1959148723059b2f2725fe918cbfb7bcf635932868954ab",
+ "format": 1
+ },
+ "format": 1
+} \ No newline at end of file
diff --git a/collections-debian-merged/ansible_collections/community/azure/README.md b/collections-debian-merged/ansible_collections/community/azure/README.md
new file mode 100644
index 00000000..d4c197d0
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/README.md
@@ -0,0 +1,36 @@
+# Ansible Community Azure Collection
+[![Shippable build status](https://api.shippable.com/projects/5e66776c46e72100078419d6/badge?branch=main)](https://app.shippable.com/projects/5e66776c46e72100078419d6)
+[![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/community.azure)](https://codecov.io/gh/ansible-collections/community.azure)
+
+Provides modules for [Ansible](https://www.ansible.com/community) for various Azure operations.
+
+## Requirements
+
+- ansible version >= 2.9
+
+## Installation
+
+To install Azure collection hosted in Galaxy:
+
+```bash
+ansible-galaxy collection install community.azure
+```
+
+To upgrade to the latest version of Azure collection:
+
+```bash
+ansible-galaxy collection install community.azure --force
+```
+
+## More information
+
+- [Ansible Collection overview](https://github.com/ansible-collections/overview)
+- [Ansible User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html)
+- [Ansible Developer guide](https://docs.ansible.com/ansible/latest/dev_guide/index.html)
+- [Ansible Community code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html)
+
+## Licensing
+
+GNU General Public License v3.0 or later.
+
+See [COPYING](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text.
diff --git a/collections-debian-merged/ansible_collections/community/azure/changelogs/changelog.yaml b/collections-debian-merged/ansible_collections/community/azure/changelogs/changelog.yaml
new file mode 100644
index 00000000..2abdaca5
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/changelogs/changelog.yaml
@@ -0,0 +1 @@
+releases: {}
diff --git a/collections-debian-merged/ansible_collections/community/azure/changelogs/config.yaml b/collections-debian-merged/ansible_collections/community/azure/changelogs/config.yaml
new file mode 100644
index 00000000..08c3ba7c
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/changelogs/config.yaml
@@ -0,0 +1,29 @@
+changelog_filename_template: ../CHANGELOG.rst
+changelog_filename_version_depth: 0
+changes_file: changelog.yaml
+changes_format: combined
+keep_fragments: false
+mention_ancestor: true
+new_plugins_after_name: removed_features
+notesdir: fragments
+prelude_section_name: release_summary
+prelude_section_title: Release Summary
+sections:
+- - major_changes
+ - Major Changes
+- - minor_changes
+ - Minor Changes
+- - breaking_changes
+ - Breaking Changes / Porting Guide
+- - deprecated_features
+ - Deprecated Features
+- - removed_features
+ - Removed Features (previously deprecated)
+- - security_fixes
+ - Security Fixes
+- - bugfixes
+ - Bugfixes
+- - known_issues
+ - Known Issues
+title: CHANGE THIS IN changelogs/config.yaml!
+trivial_section_name: trivial
diff --git a/collections-debian-merged/ansible_collections/community/azure/changelogs/fragments/.keep b/collections-debian-merged/ansible_collections/community/azure/changelogs/fragments/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/changelogs/fragments/.keep
diff --git a/collections-debian-merged/ansible_collections/community/azure/meta/action_groups.yml b/collections-debian-merged/ansible_collections/community/azure/meta/action_groups.yml
new file mode 100644
index 00000000..92705287
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/meta/action_groups.yml
@@ -0,0 +1,27 @@
+azure:
+- azure_rm_aks_facts
+- azure_rm_dnsrecordset_facts
+- azure_rm_dnszone_facts
+- azure_rm_networkinterface_facts
+- azure_rm_publicipaddress_facts
+- azure_rm_securitygroup_facts
+- azure_rm_storageaccount_facts
+- azure_rm_virtualmachine_facts
+- azure_rm_virtualnetwork_facts
+- azure_rm_mysqldatabase_facts
+- azure_rm_loadbalancer_facts
+- azure_rm_manageddisk_facts
+- azure_rm_mysqlserver_facts
+- azure_rm_resource_facts
+- azure_rm_virtualmachine_extension
+- azure_rm_availabilityset_facts
+- azure_rm_appserviceplan_facts
+- azure_rm_functionapp_facts
+- azure_rm_virtualmachineimage_facts
+- azure_rm_sqlserver_facts
+- azure_rm_postgresqldatabase_facts
+- azure_rm_virtualmachine_scaleset
+- azure_rm_managed_disk
+- azure_rm_managed_disk_facts
+- azure_rm_resourcegroup_facts
+- azure_rm_virtualmachine_scaleset_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/meta/runtime.yml b/collections-debian-merged/ansible_collections/community/azure/meta/runtime.yml
new file mode 100644
index 00000000..b76d09d8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/meta/runtime.yml
@@ -0,0 +1,302 @@
+plugin_routing:
+ modules:
+ azure_rm_aks_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_dnsrecordset_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_dnszone_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_networkinterface_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_publicipaddress_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_securitygroup_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_storageaccount_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualmachine_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualnetwork_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_roledefinition_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_autoscale_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_mysqldatabase_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlabschedule_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualmachinescaleset_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlabcustomimage_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_cosmosdbaccount_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_subnet_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_aksversion_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_hdinsightcluster_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualmachinescalesetextension_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_loadbalancer_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_roleassignment_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_manageddisk_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_mysqlserver_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_servicebus_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_rediscache_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_resource_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_routetable_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualmachine_extension:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_loganalyticsworkspace_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_sqldatabase_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlabartifactsource_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_deployment_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualmachineextension_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_applicationsecuritygroup_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_availabilityset_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_mariadbdatabase_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlabenvironment_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_appserviceplan_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_containerinstance_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlabarmtemplate_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlabartifact_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualmachinescalesetinstance_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_cdnendpoint_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_trafficmanagerprofile_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_functionapp_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualmachineimage_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_mariadbconfiguration_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualnetworkpeering_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_sqlserver_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_mariadbfirewallrule_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_mysqlconfiguration_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_mysqlfirewallrule_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_postgresqlfirewallrule_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_mariadbserver_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_postgresqldatabase_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlabvirtualnetwork_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlabpolicy_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_trafficmanagerendpoint_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_sqlfirewallrule_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_containerregistry_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_postgresqlconfiguration_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_postgresqlserver_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlab_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_cdnprofile_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualmachine_scaleset:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_webapp_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_devtestlabvirtualmachine_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_image_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_managed_disk:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_automationaccount_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_lock_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_managed_disk_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_resourcegroup_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
+ azure_rm_virtualmachine_scaleset_facts:
+ deprecation:
+ removal_date: TBD
+ warning_text: see plugin documentation for details
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/__init__.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/__init__.py
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aks_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aks_facts.py
new file mode 100644
index 00000000..1094455e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aks_facts.py
@@ -0,0 +1,190 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_aks_info
+
+
+short_description: Get Azure Kubernetes Service facts
+
+description:
+ - Get facts for a specific Azure Kubernetes Service or all Azure Kubernetes Services.
+
+options:
+ name:
+ description:
+ - Limit results to a specific resource group.
+ resource_group:
+ description:
+ - The resource group to search for the desired Azure Kubernetes Service
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ show_kubeconfig:
+ description:
+ - Show kubeconfig of the AKS cluster.
+ - Note the operation will cost more network overhead, not recommended when listing AKS.
+ choices:
+ - user
+ - admin
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one Azure Kubernetes Service
+ community.azure.azure_rm_aks_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all Azure Kubernetes Services
+ community.azure.azure_rm_aks_info:
+
+ - name: Get facts by tags
+ community.azure.azure_rm_aks_info:
+ tags:
+ - testing
+'''
+
+RETURN = '''
+azure_aks:
+ description: List of Azure Kubernetes Service dicts.
+ returned: always
+ type: list
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'managedClusters'
+
+
+class AzureRMManagedClusterInfo(AzureRMModuleBase):
+ """Utility class to get Azure Kubernetes Service facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ show_kubeconfig=dict(type='str', choices=['user', 'admin']),
+ )
+
+ self.results = dict(
+ changed=False,
+ aks=[],
+ available_versions=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.show_kubeconfig = None
+
+ super(AzureRMManagedClusterInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_aks_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_aks_facts' module has been renamed to 'azure_rm_aks_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.results['aks'] = (
+ self.get_item() if self.name
+ else self.list_items()
+ )
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Kubernetes Service"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.managedcluster_client.managed_clusters.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_obj(item, AZURE_OBJECT_CLASS)]
+ if self.show_kubeconfig:
+ result[0]['kube_config'] = self.get_aks_kubeconfig(self.resource_group, self.name)
+
+ return result
+
+ def list_items(self):
+ """Get all Azure Kubernetes Services"""
+
+ self.log('List all Azure Kubernetes Services')
+
+ try:
+ response = self.managedcluster_client.managed_clusters.list(self.resource_group)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ item_dict = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ if self.show_kubeconfig:
+ item_dict['kube_config'] = self.get_aks_kubeconfig(self.resource_group, item.name)
+ results.append(item_dict)
+
+ return results
+
+ def get_aks_kubeconfig(self, resource_group, name):
+ '''
+ Gets kubeconfig for the specified AKS instance.
+
+ :return: AKS instance kubeconfig
+ '''
+ if not self.show_kubeconfig:
+ return ''
+ role_name = 'cluster{0}'.format(str.capitalize(self.show_kubeconfig))
+ access_profile = self.managedcluster_client.managed_clusters.get_access_profile(resource_group, name, role_name)
+ return access_profile.kube_config.decode('utf-8')
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMManagedClusterInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aks_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aks_info.py
new file mode 100644
index 00000000..1094455e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aks_info.py
@@ -0,0 +1,190 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_aks_info
+
+
+short_description: Get Azure Kubernetes Service facts
+
+description:
+ - Get facts for a specific Azure Kubernetes Service or all Azure Kubernetes Services.
+
+options:
+ name:
+ description:
+ - Limit results to a specific resource group.
+ resource_group:
+ description:
+ - The resource group to search for the desired Azure Kubernetes Service
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ show_kubeconfig:
+ description:
+ - Show kubeconfig of the AKS cluster.
+ - Note the operation will cost more network overhead, not recommended when listing AKS.
+ choices:
+ - user
+ - admin
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one Azure Kubernetes Service
+ community.azure.azure_rm_aks_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all Azure Kubernetes Services
+ community.azure.azure_rm_aks_info:
+
+ - name: Get facts by tags
+ community.azure.azure_rm_aks_info:
+ tags:
+ - testing
+'''
+
+RETURN = '''
+azure_aks:
+ description: List of Azure Kubernetes Service dicts.
+ returned: always
+ type: list
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'managedClusters'
+
+
+class AzureRMManagedClusterInfo(AzureRMModuleBase):
+ """Utility class to get Azure Kubernetes Service facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ show_kubeconfig=dict(type='str', choices=['user', 'admin']),
+ )
+
+ self.results = dict(
+ changed=False,
+ aks=[],
+ available_versions=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.show_kubeconfig = None
+
+ super(AzureRMManagedClusterInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_aks_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_aks_facts' module has been renamed to 'azure_rm_aks_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.results['aks'] = (
+ self.get_item() if self.name
+ else self.list_items()
+ )
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Kubernetes Service"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.managedcluster_client.managed_clusters.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_obj(item, AZURE_OBJECT_CLASS)]
+ if self.show_kubeconfig:
+ result[0]['kube_config'] = self.get_aks_kubeconfig(self.resource_group, self.name)
+
+ return result
+
+ def list_items(self):
+ """Get all Azure Kubernetes Services"""
+
+ self.log('List all Azure Kubernetes Services')
+
+ try:
+ response = self.managedcluster_client.managed_clusters.list(self.resource_group)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ item_dict = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ if self.show_kubeconfig:
+ item_dict['kube_config'] = self.get_aks_kubeconfig(self.resource_group, item.name)
+ results.append(item_dict)
+
+ return results
+
+ def get_aks_kubeconfig(self, resource_group, name):
+ '''
+ Gets kubeconfig for the specified AKS instance.
+
+ :return: AKS instance kubeconfig
+ '''
+ if not self.show_kubeconfig:
+ return ''
+ role_name = 'cluster{0}'.format(str.capitalize(self.show_kubeconfig))
+ access_profile = self.managedcluster_client.managed_clusters.get_access_profile(resource_group, name, role_name)
+ return access_profile.kube_config.decode('utf-8')
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMManagedClusterInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aksversion_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aksversion_facts.py
new file mode 100644
index 00000000..19d71829
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aksversion_facts.py
@@ -0,0 +1,133 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_aksversion_info
+
+
+short_description: Get available kubernetes versions supported by Azure Kubernetes Service
+
+description:
+ - Get available kubernetes versions supported by Azure Kubernetes Service.
+
+options:
+ location:
+ description:
+ - Get the versions available for creating a managed Kubernetes cluster.
+ required: true
+ version:
+ description:
+ - Get the upgrade versions available for a managed Kubernetes cluster version.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+'''
+
+EXAMPLES = '''
+ - name: Get available versions for AKS in location eastus
+ community.azure.azure_rm_aksversion_info:
+ location: eastus
+ - name: Get available versions an AKS can be upgrade to
+ community.azure.azure_rm_aksversion_info:
+ location: eastis
+ version: 1.11.6
+'''
+
+RETURN = '''
+azure_aks_versions:
+ description: List of supported kubernetes versions.
+ returned: always
+ type: list
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+
+class AzureRMAKSVersion(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_args = dict(
+ location=dict(type='str', required=True),
+ version=dict(type='str')
+ )
+
+ self.results = dict(
+ changed=False,
+ azure_aks_versions=[]
+ )
+
+ self.location = None
+ self.version = None
+
+ super(AzureRMAKSVersion, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_aksversion_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_aksversion_facts' module has been renamed to 'azure_rm_aksversion_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.results['azure_aks_versions'] = self.get_all_versions(self.location, self.version)
+
+ return self.results
+
+ def get_all_versions(self, location, version):
+ '''
+ Get all kubernetes version supported by AKS
+ :return: ordered version list
+ '''
+ try:
+ result = dict()
+ response = self.containerservice_client.container_services.list_orchestrators(self.location, resource_type='managedClusters')
+ orchestrators = response.orchestrators
+ for item in orchestrators:
+ result[item.orchestrator_version] = [x.orchestrator_version for x in item.upgrades] if item.upgrades else []
+ if version:
+ return result.get(version) or []
+ else:
+ keys = list(result.keys())
+ keys.sort()
+ return keys
+ except Exception as exc:
+ self.fail('Error when getting AKS supported kubernetes version list for location {0} - {1}'.format(self.location, exc.message or str(exc)))
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMAKSVersion()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aksversion_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aksversion_info.py
new file mode 100644
index 00000000..19d71829
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_aksversion_info.py
@@ -0,0 +1,133 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_aksversion_info
+
+
+short_description: Get available kubernetes versions supported by Azure Kubernetes Service
+
+description:
+ - Get available kubernetes versions supported by Azure Kubernetes Service.
+
+options:
+ location:
+ description:
+ - Get the versions available for creating a managed Kubernetes cluster.
+ required: true
+ version:
+ description:
+ - Get the upgrade versions available for a managed Kubernetes cluster version.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+'''
+
+EXAMPLES = '''
+ - name: Get available versions for AKS in location eastus
+ community.azure.azure_rm_aksversion_info:
+ location: eastus
+ - name: Get available versions an AKS can be upgrade to
+ community.azure.azure_rm_aksversion_info:
+ location: eastis
+ version: 1.11.6
+'''
+
+RETURN = '''
+azure_aks_versions:
+ description: List of supported kubernetes versions.
+ returned: always
+ type: list
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+
+class AzureRMAKSVersion(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_args = dict(
+ location=dict(type='str', required=True),
+ version=dict(type='str')
+ )
+
+ self.results = dict(
+ changed=False,
+ azure_aks_versions=[]
+ )
+
+ self.location = None
+ self.version = None
+
+ super(AzureRMAKSVersion, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_aksversion_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_aksversion_facts' module has been renamed to 'azure_rm_aksversion_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.results['azure_aks_versions'] = self.get_all_versions(self.location, self.version)
+
+ return self.results
+
+ def get_all_versions(self, location, version):
+ '''
+ Get all kubernetes version supported by AKS
+ :return: ordered version list
+ '''
+ try:
+ result = dict()
+ response = self.containerservice_client.container_services.list_orchestrators(self.location, resource_type='managedClusters')
+ orchestrators = response.orchestrators
+ for item in orchestrators:
+ result[item.orchestrator_version] = [x.orchestrator_version for x in item.upgrades] if item.upgrades else []
+ if version:
+ return result.get(version) or []
+ else:
+ keys = list(result.keys())
+ keys.sort()
+ return keys
+ except Exception as exc:
+ self.fail('Error when getting AKS supported kubernetes version list for location {0} - {1}'.format(self.location, exc.message or str(exc)))
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMAKSVersion()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_applicationsecuritygroup_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_applicationsecuritygroup_facts.py
new file mode 100644
index 00000000..f8dd547d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_applicationsecuritygroup_facts.py
@@ -0,0 +1,229 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yunge Zhu, <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_applicationsecuritygroup_info
+short_description: Get Azure Application Security Group facts
+description:
+ - Get facts of Azure Application Security Group.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ name:
+ description:
+ - The name of the application security group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+
+'''
+
+EXAMPLES = '''
+ - name: List application security groups in specific resource group
+ community.azure.azure_rm_applicationsecuritygroup_info:
+ resource_group: myResourceGroup
+
+ - name: List application security groups in specific subscription
+ community.azure.azure_rm_applicationsecuritygroup_info:
+
+ - name: Get application security group by name
+ community.azure.azure_rm_applicationsecuritygroup_info:
+ resource_group: myResourceGroup
+ name: myApplicationSecurityGroup
+ tags:
+ - foo
+'''
+
+RETURN = '''
+applicationsecuritygroups:
+ description:
+ - List of application security groups.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description: Id of the application security group.
+ type: str
+ returned: always
+ sample:
+ "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationSecurityGroups/MyAsg"
+ location:
+ description:
+ - Location of the application security group.
+ type: str
+ returned: always
+ sample: eastus
+ name:
+ description:
+ - Name of the resource.
+ type: str
+ returned: always
+ sample: myAsg
+ provisioning_state:
+ description:
+ - Provisioning state of application security group.
+ type: str
+ returned: always
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.polling import LROPoller
+ from msrestazure.azure_operation import AzureOperationPoller
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+def applicationsecuritygroup_to_dict(asg):
+ return dict(
+ id=asg.id,
+ location=asg.location,
+ name=asg.name,
+ tags=asg.tags,
+ provisioning_state=asg.provisioning_state
+ )
+
+
+class AzureRMApplicationSecurityGroupInfo(AzureRMModuleBase):
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(type='list')
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+
+ self.results = dict(changed=False)
+
+ super(AzureRMApplicationSecurityGroupInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_check_mode=False,
+ supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+
+ is_old_facts = self.module._name == 'azure_rm_applicationsecuritygroup_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_applicationsecuritygroup_facts' module has been renamed to 'azure_rm_applicationsecuritygroup_info'",
+ version='2.13')
+
+ for key in list(self.module_arg_spec.keys()) + ['tags']:
+ if hasattr(self, key):
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ if self.resource_group:
+ self.results['applicationsecuritygroups'] = self.get()
+ else:
+ self.fail("resource_group is required when filtering by name")
+ elif self.resource_group:
+ self.results['applicationsecuritygroups'] = self.list_by_resource_group()
+ else:
+ self.results['applicationsecuritygroups'] = self.list_all()
+
+ return self.results
+
+ def get(self):
+ '''
+ Gets the properties of the specified Application Security Group.
+
+ :return: deserialized Application Security Group instance state dictionary
+ '''
+ self.log("Get the Application Security Group instance {0}".format(self.name))
+
+ results = []
+ try:
+ response = self.network_client.application_security_groups.get(resource_group_name=self.resource_group,
+ application_security_group_name=self.name)
+ self.log("Response : {0}".format(response))
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(applicationsecuritygroup_to_dict(response))
+ except CloudError as e:
+ self.fail('Did not find the Application Security Group instance.')
+ return results
+
+ def list_by_resource_group(self):
+ '''
+ Lists the properties of Application Security Groups in specific resource group.
+
+ :return: deserialized Application Security Group instance state dictionary
+ '''
+ self.log("Get the Application Security Groups in resource group {0}".format(self.resource_group))
+
+ results = []
+ try:
+ response = list(self.network_client.application_security_groups.list(resource_group_name=self.resource_group))
+ self.log("Response : {0}".format(response))
+
+ if response:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(applicationsecuritygroup_to_dict(item))
+ except CloudError as e:
+ self.log('Did not find the Application Security Group instance.')
+ return results
+
+ def list_all(self):
+ '''
+ Lists the properties of Application Security Groups in specific subscription.
+
+ :return: deserialized Application Security Group instance state dictionary
+ '''
+ self.log("Get the Application Security Groups in current subscription")
+
+ results = []
+ try:
+ response = list(self.network_client.application_security_groups.list_all())
+ self.log("Response : {0}".format(response))
+
+ if response:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(applicationsecuritygroup_to_dict(item))
+ except CloudError as e:
+ self.log('Did not find the Application Security Group instance.')
+ return results
+
+
+def main():
+ """Main execution"""
+ AzureRMApplicationSecurityGroupInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_applicationsecuritygroup_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_applicationsecuritygroup_info.py
new file mode 100644
index 00000000..f8dd547d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_applicationsecuritygroup_info.py
@@ -0,0 +1,229 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yunge Zhu, <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_applicationsecuritygroup_info
+short_description: Get Azure Application Security Group facts
+description:
+ - Get facts of Azure Application Security Group.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ name:
+ description:
+ - The name of the application security group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+
+'''
+
+EXAMPLES = '''
+ - name: List application security groups in specific resource group
+ community.azure.azure_rm_applicationsecuritygroup_info:
+ resource_group: myResourceGroup
+
+ - name: List application security groups in specific subscription
+ community.azure.azure_rm_applicationsecuritygroup_info:
+
+ - name: Get application security group by name
+ community.azure.azure_rm_applicationsecuritygroup_info:
+ resource_group: myResourceGroup
+ name: myApplicationSecurityGroup
+ tags:
+ - foo
+'''
+
+RETURN = '''
+applicationsecuritygroups:
+ description:
+ - List of application security groups.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description: Id of the application security group.
+ type: str
+ returned: always
+ sample:
+ "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationSecurityGroups/MyAsg"
+ location:
+ description:
+ - Location of the application security group.
+ type: str
+ returned: always
+ sample: eastus
+ name:
+ description:
+ - Name of the resource.
+ type: str
+ returned: always
+ sample: myAsg
+ provisioning_state:
+ description:
+ - Provisioning state of application security group.
+ type: str
+ returned: always
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.polling import LROPoller
+ from msrestazure.azure_operation import AzureOperationPoller
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+def applicationsecuritygroup_to_dict(asg):
+ return dict(
+ id=asg.id,
+ location=asg.location,
+ name=asg.name,
+ tags=asg.tags,
+ provisioning_state=asg.provisioning_state
+ )
+
+
+class AzureRMApplicationSecurityGroupInfo(AzureRMModuleBase):
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(type='list')
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+
+ self.results = dict(changed=False)
+
+ super(AzureRMApplicationSecurityGroupInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_check_mode=False,
+ supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+
+ is_old_facts = self.module._name == 'azure_rm_applicationsecuritygroup_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_applicationsecuritygroup_facts' module has been renamed to 'azure_rm_applicationsecuritygroup_info'",
+ version='2.13')
+
+ for key in list(self.module_arg_spec.keys()) + ['tags']:
+ if hasattr(self, key):
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ if self.resource_group:
+ self.results['applicationsecuritygroups'] = self.get()
+ else:
+ self.fail("resource_group is required when filtering by name")
+ elif self.resource_group:
+ self.results['applicationsecuritygroups'] = self.list_by_resource_group()
+ else:
+ self.results['applicationsecuritygroups'] = self.list_all()
+
+ return self.results
+
+ def get(self):
+ '''
+ Gets the properties of the specified Application Security Group.
+
+ :return: deserialized Application Security Group instance state dictionary
+ '''
+ self.log("Get the Application Security Group instance {0}".format(self.name))
+
+ results = []
+ try:
+ response = self.network_client.application_security_groups.get(resource_group_name=self.resource_group,
+ application_security_group_name=self.name)
+ self.log("Response : {0}".format(response))
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(applicationsecuritygroup_to_dict(response))
+ except CloudError as e:
+ self.fail('Did not find the Application Security Group instance.')
+ return results
+
+ def list_by_resource_group(self):
+ '''
+ Lists the properties of Application Security Groups in specific resource group.
+
+ :return: deserialized Application Security Group instance state dictionary
+ '''
+ self.log("Get the Application Security Groups in resource group {0}".format(self.resource_group))
+
+ results = []
+ try:
+ response = list(self.network_client.application_security_groups.list(resource_group_name=self.resource_group))
+ self.log("Response : {0}".format(response))
+
+ if response:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(applicationsecuritygroup_to_dict(item))
+ except CloudError as e:
+ self.log('Did not find the Application Security Group instance.')
+ return results
+
+ def list_all(self):
+ '''
+ Lists the properties of Application Security Groups in specific subscription.
+
+ :return: deserialized Application Security Group instance state dictionary
+ '''
+ self.log("Get the Application Security Groups in current subscription")
+
+ results = []
+ try:
+ response = list(self.network_client.application_security_groups.list_all())
+ self.log("Response : {0}".format(response))
+
+ if response:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(applicationsecuritygroup_to_dict(item))
+ except CloudError as e:
+ self.log('Did not find the Application Security Group instance.')
+ return results
+
+
+def main():
+ """Main execution"""
+ AzureRMApplicationSecurityGroupInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_appserviceplan_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_appserviceplan_facts.py
new file mode 100644
index 00000000..d255a697
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_appserviceplan_facts.py
@@ -0,0 +1,241 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yunge Zhu, <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_appserviceplan_info
+
+
+short_description: Get azure app service plan facts
+
+description:
+ - Get facts for a specific app service plan or all app service plans in a resource group, or all app service plan in current subscription.
+
+options:
+ name:
+ description:
+ - Only show results for a specific app service plan.
+ resource_group:
+ description:
+ - Limit results by resource group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for app service plan by name
+ community.azure.azure_rm_appserviceplan_info:
+ resource_group: myResourceGroup
+ name: myAppServicePlan
+
+ - name: Get azure_rm_appserviceplan_facts for app service plan in resource group
+ community.azure.azure_rm_appserviceplan_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts for app service plan with tags
+ community.azure.azure_rm_appserviceplan_info:
+ tags:
+ - testtag
+ - foo:bar
+'''
+
+RETURN = '''
+appserviceplans:
+ description: List of app service plans.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description: Id of the app service plan.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myPlan
+ name:
+ description: Name of the app service plan.
+ returned: always
+ type: str
+ resource_group:
+ description: Resource group of the app service plan.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ location:
+ description: Location of the app service plan.
+ returned: always
+ type: str
+ kind:
+ description: Kind of the app service plan.
+ returned: always
+ type: str
+ sample: app
+ sku:
+ description: Sku of the app service plan.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description: Name of sku.
+ returned: always
+ type: str
+ sample: S1
+ family:
+ description: Family of sku.
+ returned: always
+ type: str
+ sample: S
+ size:
+ description: Size of sku.
+ returned: always
+ type: str
+ sample: S1
+ tier:
+ description: Tier of sku.
+ returned: always
+ type: str
+ sample: Standard
+ capacity:
+ description: Capacity of sku.
+ returned: always
+ type: int
+ sample: 1
+'''
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+AZURE_OBJECT_CLASS = 'AppServicePlan'
+
+
+class AzureRMAppServicePlanInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(changed=False)
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.info_level = None
+
+ super(AzureRMAppServicePlanInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_appserviceplan_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_appserviceplan_facts' module has been renamed to 'azure_rm_appserviceplan_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ self.results['appserviceplans'] = self.list_by_name()
+ elif self.resource_group:
+ self.results['appserviceplans'] = self.list_by_resource_group()
+ else:
+ self.results['appserviceplans'] = self.list_all()
+
+ return self.results
+
+ def list_by_name(self):
+ self.log('Get app service plan {0}'.format(self.name))
+ item = None
+ result = []
+
+ try:
+ item = self.web_client.app_service_plans.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ curated_result = self.construct_curated_plan(item)
+ result = [curated_result]
+
+ return result
+
+ def list_by_resource_group(self):
+ self.log('List app service plans in resource groups {0}'.format(self.resource_group))
+ try:
+ response = list(self.web_client.app_service_plans.list_by_resource_group(self.resource_group))
+ except CloudError as exc:
+ self.fail("Error listing app service plan in resource groups {0} - {1}".format(self.resource_group, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ curated_output = self.construct_curated_plan(item)
+ results.append(curated_output)
+ return results
+
+ def list_all(self):
+ self.log('List app service plans in current subscription')
+ try:
+ response = list(self.web_client.app_service_plans.list())
+ except CloudError as exc:
+ self.fail("Error listing app service plans: {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ curated_output = self.construct_curated_plan(item)
+ results.append(curated_output)
+ return results
+
+ def construct_curated_plan(self, plan):
+ plan_facts = self.serialize_obj(plan, AZURE_OBJECT_CLASS)
+
+ curated_output = dict()
+ curated_output['id'] = plan_facts['id']
+ curated_output['name'] = plan_facts['name']
+ curated_output['resource_group'] = plan_facts['properties']['resourceGroup']
+ curated_output['location'] = plan_facts['location']
+ curated_output['tags'] = plan_facts.get('tags', None)
+ curated_output['is_linux'] = False
+ curated_output['kind'] = plan_facts['kind']
+ curated_output['sku'] = plan_facts['sku']
+
+ if plan_facts['properties'].get('reserved', None):
+ curated_output['is_linux'] = True
+
+ return curated_output
+
+
+def main():
+ AzureRMAppServicePlanInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_appserviceplan_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_appserviceplan_info.py
new file mode 100644
index 00000000..d255a697
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_appserviceplan_info.py
@@ -0,0 +1,241 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yunge Zhu, <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_appserviceplan_info
+
+
+short_description: Get azure app service plan facts
+
+description:
+ - Get facts for a specific app service plan or all app service plans in a resource group, or all app service plan in current subscription.
+
+options:
+ name:
+ description:
+ - Only show results for a specific app service plan.
+ resource_group:
+ description:
+ - Limit results by resource group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for app service plan by name
+ community.azure.azure_rm_appserviceplan_info:
+ resource_group: myResourceGroup
+ name: myAppServicePlan
+
+ - name: Get azure_rm_appserviceplan_facts for app service plan in resource group
+ community.azure.azure_rm_appserviceplan_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts for app service plan with tags
+ community.azure.azure_rm_appserviceplan_info:
+ tags:
+ - testtag
+ - foo:bar
+'''
+
+RETURN = '''
+appserviceplans:
+ description: List of app service plans.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description: Id of the app service plan.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myPlan
+ name:
+ description: Name of the app service plan.
+ returned: always
+ type: str
+ resource_group:
+ description: Resource group of the app service plan.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ location:
+ description: Location of the app service plan.
+ returned: always
+ type: str
+ kind:
+ description: Kind of the app service plan.
+ returned: always
+ type: str
+ sample: app
+ sku:
+ description: Sku of the app service plan.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description: Name of sku.
+ returned: always
+ type: str
+ sample: S1
+ family:
+ description: Family of sku.
+ returned: always
+ type: str
+ sample: S
+ size:
+ description: Size of sku.
+ returned: always
+ type: str
+ sample: S1
+ tier:
+ description: Tier of sku.
+ returned: always
+ type: str
+ sample: Standard
+ capacity:
+ description: Capacity of sku.
+ returned: always
+ type: int
+ sample: 1
+'''
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+AZURE_OBJECT_CLASS = 'AppServicePlan'
+
+
+class AzureRMAppServicePlanInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(changed=False)
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.info_level = None
+
+ super(AzureRMAppServicePlanInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_appserviceplan_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_appserviceplan_facts' module has been renamed to 'azure_rm_appserviceplan_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ self.results['appserviceplans'] = self.list_by_name()
+ elif self.resource_group:
+ self.results['appserviceplans'] = self.list_by_resource_group()
+ else:
+ self.results['appserviceplans'] = self.list_all()
+
+ return self.results
+
+ def list_by_name(self):
+ self.log('Get app service plan {0}'.format(self.name))
+ item = None
+ result = []
+
+ try:
+ item = self.web_client.app_service_plans.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ curated_result = self.construct_curated_plan(item)
+ result = [curated_result]
+
+ return result
+
+ def list_by_resource_group(self):
+ self.log('List app service plans in resource groups {0}'.format(self.resource_group))
+ try:
+ response = list(self.web_client.app_service_plans.list_by_resource_group(self.resource_group))
+ except CloudError as exc:
+ self.fail("Error listing app service plan in resource groups {0} - {1}".format(self.resource_group, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ curated_output = self.construct_curated_plan(item)
+ results.append(curated_output)
+ return results
+
+ def list_all(self):
+ self.log('List app service plans in current subscription')
+ try:
+ response = list(self.web_client.app_service_plans.list())
+ except CloudError as exc:
+ self.fail("Error listing app service plans: {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ curated_output = self.construct_curated_plan(item)
+ results.append(curated_output)
+ return results
+
+ def construct_curated_plan(self, plan):
+ plan_facts = self.serialize_obj(plan, AZURE_OBJECT_CLASS)
+
+ curated_output = dict()
+ curated_output['id'] = plan_facts['id']
+ curated_output['name'] = plan_facts['name']
+ curated_output['resource_group'] = plan_facts['properties']['resourceGroup']
+ curated_output['location'] = plan_facts['location']
+ curated_output['tags'] = plan_facts.get('tags', None)
+ curated_output['is_linux'] = False
+ curated_output['kind'] = plan_facts['kind']
+ curated_output['sku'] = plan_facts['sku']
+
+ if plan_facts['properties'].get('reserved', None):
+ curated_output['is_linux'] = True
+
+ return curated_output
+
+
+def main():
+ AzureRMAppServicePlanInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_automationaccount_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_automationaccount_facts.py
new file mode 100644
index 00000000..1930ae6b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_automationaccount_facts.py
@@ -0,0 +1,383 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_automationaccount_info
+short_description: Get Azure automation account facts
+description:
+ - Get facts of automation account.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ type: str
+ required: True
+ name:
+ description:
+ - The name of the automation account.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+ list_statistics:
+ description:
+ - List statistics details for a automation account.
+ - Note this will cost network overhead, suggest only used when I(name) set.
+ type: bool
+ list_usages:
+ description:
+ - List usage details for a automation account.
+ - Note this will cost network overhead, suggest only used when I(name) set.
+ type: bool
+ list_keys:
+ description:
+ - List keys for a automation account.
+ - Note this will cost network overhead, suggest only used when I(name) set.
+ type: bool
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+- name: Get details of an automation account
+ community.azure.azure_rm_automationaccount_info:
+ name: Testing
+ resource_group: myResourceGroup
+ list_statistics: yes
+ list_usages: yes
+ list_keys: yes
+
+- name: List automation account in a resource group
+ community.azure.azure_rm_automationaccount_info:
+ resource_group: myResourceGroup
+
+- name: List automation account in a resource group
+ community.azure.azure_rm_automationaccount_info:
+'''
+
+RETURN = '''
+automation_accounts:
+ description:
+ - List of automation account dicts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ type: str
+ returned: always
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups
+ /myResourceGroup/providers/Microsoft.Automation/automationAccounts/Testing"
+ resource_group:
+ description:
+ - Resource group name.
+ type: str
+ returned: always
+ sample: myResourceGroup
+ name:
+ description:
+ - Resource name.
+ type: str
+ returned: always
+ sample: Testing
+ location:
+ description:
+ - Resource location.
+ type: str
+ returned: always
+ sample: eastus
+ creation_time:
+ description:
+ - Resource creation date time.
+ type: str
+ returned: always
+ sample: "2019-04-26T02:55:16.500Z"
+ last_modified_time:
+ description:
+ - Resource last modified date time.
+ type: str
+ returned: always
+ sample: "2019-04-26T02:55:16.500Z"
+ state:
+ description:
+ - Resource state.
+ type: str
+ returned: always
+ sample: ok
+ keys:
+ description:
+ - Resource keys.
+ type: complex
+ returned: always
+ contains:
+ key_name:
+ description:
+ - Name of the key.
+ type: str
+ returned: always
+ sample: Primary
+ permissions:
+ description:
+ - Permission of the key.
+ type: str
+ returned: always
+ sample: Full
+ value:
+ description:
+ - Value of the key.
+ type: str
+ returned: always
+ sample: "MbepKTO6IyGwml0GaKBkKN"
+ statistics:
+ description:
+ - Resource statistics.
+ type: complex
+ returned: always
+ contains:
+ counter_property:
+ description:
+ - Property value of the statistic.
+ type: str
+ returned: always
+ sample: New
+ counter_value:
+ description:
+ - Value of the statistic.
+ type: int
+ returned: always
+ sample: 0
+ end_time:
+ description:
+ - EndTime of the statistic.
+ type: str
+ returned: always
+ sample: "2019-04-26T06:29:43.587518Z"
+ id:
+ description:
+ - ID of the statistic.
+ type: str
+ returned: always
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups
+ /myResourceGroup/providers/Microsoft.Automation/automationAccounts/Testing/statistics/New"
+ start_time:
+ description:
+ - StartTime of the statistic.
+ type: str
+ returned: always
+ sample: "2019-04-26T06:29:43.587518Z"
+ usages:
+ description:
+ - Resource usages.
+ type: complex
+ returned: always
+ contains:
+ current_value:
+ description:
+ - Current usage.
+ type: float
+ returned: always
+ sample: 0.0
+ limit:
+ description:
+ - Max limit, C(-1) for unlimited.
+ type: int
+ returned: always
+ sample: -1
+ name:
+ description:
+ - Usage counter name.
+ type: complex
+ returned: always
+ contains:
+ localized_value:
+ description:
+ - Localized name.
+ type: str
+ returned: always
+ sample: "SubscriptionUsage"
+ value:
+ description:
+ - Name value.
+ type: str
+ returned: always
+ sample: "SubscriptionUsage"
+ unit:
+ description:
+ - Usage unit name.
+ type: str
+ returned: always
+ sample: "Minute"
+ throttle_status:
+ description:
+ - Usage throttle status.
+ type: str
+ returned: always
+ sample: "NotThrottled"
+
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.tools import parse_resource_id
+except ImportError:
+ pass
+
+
+class AzureRMAutomationAccountInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ ),
+ list_statistics=dict(
+ type='bool'
+ ),
+ list_usages=dict(
+ type='bool'
+ ),
+ list_keys=dict(
+ type='bool'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict()
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ self.list_statistics = None
+ self.list_usages = None
+ self.list_keys = None
+
+ super(AzureRMAutomationAccountInfo, self).__init__(self.module_arg_spec, supports_tags=False, facts_module=True)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_automationaccount_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_automationaccount_facts' module has been renamed to 'azure_rm_automationaccount_info'", version='2.13')
+
+ for key in list(self.module_arg_spec):
+ setattr(self, key, kwargs[key])
+
+ if self.resource_group and self.name:
+ accounts = [self.get()]
+ elif self.resource_group:
+ accounts = self.list_by_resource_group()
+ else:
+ accounts = self.list_all()
+ self.results['automation_accounts'] = [self.to_dict(x) for x in accounts if self.has_tags(x.tags, self.tags)]
+ return self.results
+
+ def to_dict(self, account):
+ if not account:
+ return None
+ id_dict = parse_resource_id(account.id)
+ result = account.as_dict()
+ result['resource_group'] = id_dict['resource_group']
+ if self.list_statistics:
+ result['statistics'] = self.get_statics(id_dict['resource_group'], account.name)
+ if self.list_usages:
+ result['usages'] = self.get_usages(id_dict['resource_group'], account.name)
+ if self.list_keys:
+ result['keys'] = self.list_account_keys(id_dict['resource_group'], account.name)
+ return result
+
+ def get(self):
+ try:
+ return self.automation_client.automation_account.get(self.resource_group, self.name)
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when getting automation account {0}: {1}'.format(self.name, exc.message))
+
+ def list_by_resource_group(self):
+ result = []
+ try:
+ resp = self.automation_client.automation_account.list_by_resource_group(self.resource_group)
+ while True:
+ result.append(resp.next())
+ except StopIteration:
+ pass
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when listing automation account in resource group {0}: {1}'.format(self.resource_group, exc.message))
+ return result
+
+ def list_all(self):
+ result = []
+ try:
+ resp = self.automation_client.automation_account.list()
+ while True:
+ result.append(resp.next())
+ except StopIteration:
+ pass
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when listing automation account: {0}'.format(exc.message))
+ return result
+
+ def get_statics(self, resource_group, name):
+ result = []
+ try:
+ resp = self.automation_client.statistics.list_by_automation_account(resource_group, name)
+ while True:
+ result.append(resp.next().as_dict())
+ except StopIteration:
+ pass
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when getting statics for automation account {0}/{1}: {2}'.format(resource_group, name, exc.message))
+ return result
+
+ def get_usages(self, resource_group, name):
+ result = []
+ try:
+ resp = self.automation_client.usages.list_by_automation_account(resource_group, name)
+ while True:
+ result.append(resp.next().as_dict())
+ except StopIteration:
+ pass
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when getting usage for automation account {0}/{1}: {2}'.format(resource_group, name, exc.message))
+ return result
+
+ def list_account_keys(self, resource_group, name):
+ try:
+ resp = self.automation_client.keys.list_by_automation_account(resource_group, name)
+ return [x.as_dict() for x in resp.keys]
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when listing keys for automation account {0}/{1}: {2}'.format(resource_group, name, exc.message))
+
+
+def main():
+ AzureRMAutomationAccountInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_automationaccount_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_automationaccount_info.py
new file mode 100644
index 00000000..1930ae6b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_automationaccount_info.py
@@ -0,0 +1,383 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_automationaccount_info
+short_description: Get Azure automation account facts
+description:
+ - Get facts of automation account.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ type: str
+ required: True
+ name:
+ description:
+ - The name of the automation account.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+ list_statistics:
+ description:
+ - List statistics details for a automation account.
+ - Note this will cost network overhead, suggest only used when I(name) set.
+ type: bool
+ list_usages:
+ description:
+ - List usage details for a automation account.
+ - Note this will cost network overhead, suggest only used when I(name) set.
+ type: bool
+ list_keys:
+ description:
+ - List keys for a automation account.
+ - Note this will cost network overhead, suggest only used when I(name) set.
+ type: bool
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+- name: Get details of an automation account
+ community.azure.azure_rm_automationaccount_info:
+ name: Testing
+ resource_group: myResourceGroup
+ list_statistics: yes
+ list_usages: yes
+ list_keys: yes
+
+- name: List automation account in a resource group
+ community.azure.azure_rm_automationaccount_info:
+ resource_group: myResourceGroup
+
+- name: List automation account in a resource group
+ community.azure.azure_rm_automationaccount_info:
+'''
+
+RETURN = '''
+automation_accounts:
+ description:
+ - List of automation account dicts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ type: str
+ returned: always
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups
+ /myResourceGroup/providers/Microsoft.Automation/automationAccounts/Testing"
+ resource_group:
+ description:
+ - Resource group name.
+ type: str
+ returned: always
+ sample: myResourceGroup
+ name:
+ description:
+ - Resource name.
+ type: str
+ returned: always
+ sample: Testing
+ location:
+ description:
+ - Resource location.
+ type: str
+ returned: always
+ sample: eastus
+ creation_time:
+ description:
+ - Resource creation date time.
+ type: str
+ returned: always
+ sample: "2019-04-26T02:55:16.500Z"
+ last_modified_time:
+ description:
+ - Resource last modified date time.
+ type: str
+ returned: always
+ sample: "2019-04-26T02:55:16.500Z"
+ state:
+ description:
+ - Resource state.
+ type: str
+ returned: always
+ sample: ok
+ keys:
+ description:
+ - Resource keys.
+ type: complex
+ returned: always
+ contains:
+ key_name:
+ description:
+ - Name of the key.
+ type: str
+ returned: always
+ sample: Primary
+ permissions:
+ description:
+ - Permission of the key.
+ type: str
+ returned: always
+ sample: Full
+ value:
+ description:
+ - Value of the key.
+ type: str
+ returned: always
+ sample: "MbepKTO6IyGwml0GaKBkKN"
+ statistics:
+ description:
+ - Resource statistics.
+ type: complex
+ returned: always
+ contains:
+ counter_property:
+ description:
+ - Property value of the statistic.
+ type: str
+ returned: always
+ sample: New
+ counter_value:
+ description:
+ - Value of the statistic.
+ type: int
+ returned: always
+ sample: 0
+ end_time:
+ description:
+ - EndTime of the statistic.
+ type: str
+ returned: always
+ sample: "2019-04-26T06:29:43.587518Z"
+ id:
+ description:
+ - ID of the statistic.
+ type: str
+ returned: always
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups
+ /myResourceGroup/providers/Microsoft.Automation/automationAccounts/Testing/statistics/New"
+ start_time:
+ description:
+ - StartTime of the statistic.
+ type: str
+ returned: always
+ sample: "2019-04-26T06:29:43.587518Z"
+ usages:
+ description:
+ - Resource usages.
+ type: complex
+ returned: always
+ contains:
+ current_value:
+ description:
+ - Current usage.
+ type: float
+ returned: always
+ sample: 0.0
+ limit:
+ description:
+ - Max limit, C(-1) for unlimited.
+ type: int
+ returned: always
+ sample: -1
+ name:
+ description:
+ - Usage counter name.
+ type: complex
+ returned: always
+ contains:
+ localized_value:
+ description:
+ - Localized name.
+ type: str
+ returned: always
+ sample: "SubscriptionUsage"
+ value:
+ description:
+ - Name value.
+ type: str
+ returned: always
+ sample: "SubscriptionUsage"
+ unit:
+ description:
+ - Usage unit name.
+ type: str
+ returned: always
+ sample: "Minute"
+ throttle_status:
+ description:
+ - Usage throttle status.
+ type: str
+ returned: always
+ sample: "NotThrottled"
+
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.tools import parse_resource_id
+except ImportError:
+ pass
+
+
+class AzureRMAutomationAccountInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ ),
+ list_statistics=dict(
+ type='bool'
+ ),
+ list_usages=dict(
+ type='bool'
+ ),
+ list_keys=dict(
+ type='bool'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict()
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ self.list_statistics = None
+ self.list_usages = None
+ self.list_keys = None
+
+ super(AzureRMAutomationAccountInfo, self).__init__(self.module_arg_spec, supports_tags=False, facts_module=True)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_automationaccount_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_automationaccount_facts' module has been renamed to 'azure_rm_automationaccount_info'", version='2.13')
+
+ for key in list(self.module_arg_spec):
+ setattr(self, key, kwargs[key])
+
+ if self.resource_group and self.name:
+ accounts = [self.get()]
+ elif self.resource_group:
+ accounts = self.list_by_resource_group()
+ else:
+ accounts = self.list_all()
+ self.results['automation_accounts'] = [self.to_dict(x) for x in accounts if self.has_tags(x.tags, self.tags)]
+ return self.results
+
+ def to_dict(self, account):
+ if not account:
+ return None
+ id_dict = parse_resource_id(account.id)
+ result = account.as_dict()
+ result['resource_group'] = id_dict['resource_group']
+ if self.list_statistics:
+ result['statistics'] = self.get_statics(id_dict['resource_group'], account.name)
+ if self.list_usages:
+ result['usages'] = self.get_usages(id_dict['resource_group'], account.name)
+ if self.list_keys:
+ result['keys'] = self.list_account_keys(id_dict['resource_group'], account.name)
+ return result
+
+ def get(self):
+ try:
+ return self.automation_client.automation_account.get(self.resource_group, self.name)
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when getting automation account {0}: {1}'.format(self.name, exc.message))
+
+ def list_by_resource_group(self):
+ result = []
+ try:
+ resp = self.automation_client.automation_account.list_by_resource_group(self.resource_group)
+ while True:
+ result.append(resp.next())
+ except StopIteration:
+ pass
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when listing automation account in resource group {0}: {1}'.format(self.resource_group, exc.message))
+ return result
+
+ def list_all(self):
+ result = []
+ try:
+ resp = self.automation_client.automation_account.list()
+ while True:
+ result.append(resp.next())
+ except StopIteration:
+ pass
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when listing automation account: {0}'.format(exc.message))
+ return result
+
+ def get_statics(self, resource_group, name):
+ result = []
+ try:
+ resp = self.automation_client.statistics.list_by_automation_account(resource_group, name)
+ while True:
+ result.append(resp.next().as_dict())
+ except StopIteration:
+ pass
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when getting statics for automation account {0}/{1}: {2}'.format(resource_group, name, exc.message))
+ return result
+
+ def get_usages(self, resource_group, name):
+ result = []
+ try:
+ resp = self.automation_client.usages.list_by_automation_account(resource_group, name)
+ while True:
+ result.append(resp.next().as_dict())
+ except StopIteration:
+ pass
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when getting usage for automation account {0}/{1}: {2}'.format(resource_group, name, exc.message))
+ return result
+
+ def list_account_keys(self, resource_group, name):
+ try:
+ resp = self.automation_client.keys.list_by_automation_account(resource_group, name)
+ return [x.as_dict() for x in resp.keys]
+ except self.automation_models.ErrorResponseException as exc:
+ self.fail('Error when listing keys for automation account {0}/{1}: {2}'.format(resource_group, name, exc.message))
+
+
+def main():
+ AzureRMAutomationAccountInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_autoscale_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_autoscale_facts.py
new file mode 100644
index 00000000..209c2a4f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_autoscale_facts.py
@@ -0,0 +1,271 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_autoscale_info
+short_description: Get Azure Auto Scale Setting facts
+description:
+ - Get facts of Auto Scale Setting.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ name:
+ description:
+ - The name of the Auto Scale Setting.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Auto Scale Setting
+ community.azure.azure_rm_autoscale_info:
+ resource_group: myResourceGroup
+ name: auto_scale_name
+
+ - name: List instances of Auto Scale Setting
+ community.azure.azure_rm_autoscale_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+autoscales:
+ description: List of Azure Scale Settings dicts.
+ returned: always
+ type: list
+ sample: [{
+ "enabled": true,
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/microsoft.insights/autoscalesettings/scale",
+ "location": "eastus",
+ "name": "scale",
+ "notifications": [
+ {
+ "custom_emails": [
+ "yuwzho@microsoft.com"
+ ],
+ "send_to_subscription_administrator": true,
+ "send_to_subscription_co_administrators": false,
+ "webhooks": []
+ }
+ ],
+ "profiles": [
+ {
+ "count": "1",
+ "max_count": "1",
+ "min_count": "1",
+ "name": "Auto created scale condition 0",
+ "recurrence_days": [
+ "Monday"
+ ],
+ "recurrence_frequency": "Week",
+ "recurrence_hours": [
+ "6"
+ ],
+ "recurrence_mins": [
+ "0"
+ ],
+ "recurrence_timezone": "China Standard Time",
+ "rules": [
+ {
+ "cooldown": 5.0,
+ "direction": "Increase",
+ "metric_name": "Percentage CPU",
+ "metric_resource_uri": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsof
+ t.Compute/virtualMachineScaleSets/myVmss",
+ "operator": "GreaterThan",
+ "statistic": "Average",
+ "threshold": 70.0,
+ "time_aggregation": "Average",
+ "time_grain": 1.0,
+ "time_window": 10.0,
+ "type": "ChangeCount",
+ "value": "1"
+ }
+ ]
+ }
+ ],
+ "target": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScale
+ Sets/myVmss"
+ }]
+
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils._text import to_native
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+# duplicated in azure_rm_autoscale
+def timedelta_to_minutes(time):
+ if not time:
+ return 0
+ return time.days * 1440 + time.seconds / 60.0 + time.microseconds / 60000000.0
+
+
+def get_enum_value(item):
+ if 'value' in dir(item):
+ return to_native(item.value)
+ return to_native(item)
+
+
+def auto_scale_to_dict(instance):
+ if not instance:
+ return dict()
+ return dict(
+ id=to_native(instance.id or ''),
+ name=to_native(instance.name),
+ location=to_native(instance.location),
+ profiles=[profile_to_dict(p) for p in instance.profiles or []],
+ notifications=[notification_to_dict(n) for n in instance.notifications or []],
+ enabled=instance.enabled,
+ target=to_native(instance.target_resource_uri),
+ tags=instance.tags
+ )
+
+
+def rule_to_dict(rule):
+ if not rule:
+ return dict()
+ result = dict(metric_name=to_native(rule.metric_trigger.metric_name),
+ metric_resource_uri=to_native(rule.metric_trigger.metric_resource_uri),
+ time_grain=timedelta_to_minutes(rule.metric_trigger.time_grain),
+ statistic=get_enum_value(rule.metric_trigger.statistic),
+ time_window=timedelta_to_minutes(rule.metric_trigger.time_window),
+ time_aggregation=get_enum_value(rule.metric_trigger.time_aggregation),
+ operator=get_enum_value(rule.metric_trigger.operator),
+ threshold=float(rule.metric_trigger.threshold))
+ if rule.scale_action and to_native(rule.scale_action.direction) != 'None':
+ result['direction'] = get_enum_value(rule.scale_action.direction)
+ result['type'] = get_enum_value(rule.scale_action.type)
+ result['value'] = to_native(rule.scale_action.value)
+ result['cooldown'] = timedelta_to_minutes(rule.scale_action.cooldown)
+ return result
+
+
+def profile_to_dict(profile):
+ if not profile:
+ return dict()
+ result = dict(name=to_native(profile.name),
+ count=to_native(profile.capacity.default),
+ max_count=to_native(profile.capacity.maximum),
+ min_count=to_native(profile.capacity.minimum))
+
+ if profile.rules:
+ result['rules'] = [rule_to_dict(r) for r in profile.rules]
+ if profile.fixed_date:
+ result['fixed_date_timezone'] = profile.fixed_date.time_zone
+ result['fixed_date_start'] = profile.fixed_date.start
+ result['fixed_date_end'] = profile.fixed_date.end
+ if profile.recurrence:
+ if get_enum_value(profile.recurrence.frequency) != 'None':
+ result['recurrence_frequency'] = get_enum_value(profile.recurrence.frequency)
+ if profile.recurrence.schedule:
+ result['recurrence_timezone'] = to_native(str(profile.recurrence.schedule.time_zone))
+ result['recurrence_days'] = [to_native(r) for r in profile.recurrence.schedule.days]
+ result['recurrence_hours'] = [to_native(r) for r in profile.recurrence.schedule.hours]
+ result['recurrence_mins'] = [to_native(r) for r in profile.recurrence.schedule.minutes]
+ return result
+
+
+def notification_to_dict(notification):
+ if not notification:
+ return dict()
+ return dict(send_to_subscription_administrator=notification.email.send_to_subscription_administrator if notification.email else False,
+ send_to_subscription_co_administrators=notification.email.send_to_subscription_co_administrators if notification.email else False,
+ custom_emails=[to_native(e) for e in notification.email.custom_emails or []],
+ webhooks=[to_native(w.service_url) for w in notification.webhooks or []])
+
+
+class AzureRMAutoScaleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict()
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+
+ super(AzureRMAutoScaleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_autoscale_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_autoscale_facts' module has been renamed to 'azure_rm_autoscale_info'", version='2.13')
+
+ for key in list(self.module_arg_spec):
+ setattr(self, key, kwargs[key])
+
+ if self.resource_group and self.name:
+ self.results['autoscales'] = self.get()
+ elif self.resource_group:
+ self.results['autoscales'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ result = []
+ try:
+ instance = self.monitor_client.autoscale_settings.get(self.resource_group, self.name)
+ result = [auto_scale_to_dict(instance)]
+ except Exception as ex:
+ self.log('Could not get facts for autoscale {0} - {1}.'.format(self.name, str(ex)))
+ return result
+
+ def list_by_resource_group(self):
+ results = []
+ try:
+ response = self.monitor_client.autoscale_settings.list_by_resource_group(self.resource_group)
+ results = [auto_scale_to_dict(item) for item in response if self.has_tags(item.tags, self.tags)]
+ except Exception as ex:
+ self.log('Could not get facts for autoscale {0} - {1}.'.format(self.name, str(ex)))
+ return results
+
+
+def main():
+ AzureRMAutoScaleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_autoscale_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_autoscale_info.py
new file mode 100644
index 00000000..209c2a4f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_autoscale_info.py
@@ -0,0 +1,271 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_autoscale_info
+short_description: Get Azure Auto Scale Setting facts
+description:
+ - Get facts of Auto Scale Setting.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ name:
+ description:
+ - The name of the Auto Scale Setting.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Auto Scale Setting
+ community.azure.azure_rm_autoscale_info:
+ resource_group: myResourceGroup
+ name: auto_scale_name
+
+ - name: List instances of Auto Scale Setting
+ community.azure.azure_rm_autoscale_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+autoscales:
+ description: List of Azure Scale Settings dicts.
+ returned: always
+ type: list
+ sample: [{
+ "enabled": true,
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/microsoft.insights/autoscalesettings/scale",
+ "location": "eastus",
+ "name": "scale",
+ "notifications": [
+ {
+ "custom_emails": [
+ "yuwzho@microsoft.com"
+ ],
+ "send_to_subscription_administrator": true,
+ "send_to_subscription_co_administrators": false,
+ "webhooks": []
+ }
+ ],
+ "profiles": [
+ {
+ "count": "1",
+ "max_count": "1",
+ "min_count": "1",
+ "name": "Auto created scale condition 0",
+ "recurrence_days": [
+ "Monday"
+ ],
+ "recurrence_frequency": "Week",
+ "recurrence_hours": [
+ "6"
+ ],
+ "recurrence_mins": [
+ "0"
+ ],
+ "recurrence_timezone": "China Standard Time",
+ "rules": [
+ {
+ "cooldown": 5.0,
+ "direction": "Increase",
+ "metric_name": "Percentage CPU",
+ "metric_resource_uri": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsof
+ t.Compute/virtualMachineScaleSets/myVmss",
+ "operator": "GreaterThan",
+ "statistic": "Average",
+ "threshold": 70.0,
+ "time_aggregation": "Average",
+ "time_grain": 1.0,
+ "time_window": 10.0,
+ "type": "ChangeCount",
+ "value": "1"
+ }
+ ]
+ }
+ ],
+ "target": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScale
+ Sets/myVmss"
+ }]
+
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils._text import to_native
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+# duplicated in azure_rm_autoscale
+def timedelta_to_minutes(time):
+ if not time:
+ return 0
+ return time.days * 1440 + time.seconds / 60.0 + time.microseconds / 60000000.0
+
+
+def get_enum_value(item):
+ if 'value' in dir(item):
+ return to_native(item.value)
+ return to_native(item)
+
+
+def auto_scale_to_dict(instance):
+ if not instance:
+ return dict()
+ return dict(
+ id=to_native(instance.id or ''),
+ name=to_native(instance.name),
+ location=to_native(instance.location),
+ profiles=[profile_to_dict(p) for p in instance.profiles or []],
+ notifications=[notification_to_dict(n) for n in instance.notifications or []],
+ enabled=instance.enabled,
+ target=to_native(instance.target_resource_uri),
+ tags=instance.tags
+ )
+
+
+def rule_to_dict(rule):
+ if not rule:
+ return dict()
+ result = dict(metric_name=to_native(rule.metric_trigger.metric_name),
+ metric_resource_uri=to_native(rule.metric_trigger.metric_resource_uri),
+ time_grain=timedelta_to_minutes(rule.metric_trigger.time_grain),
+ statistic=get_enum_value(rule.metric_trigger.statistic),
+ time_window=timedelta_to_minutes(rule.metric_trigger.time_window),
+ time_aggregation=get_enum_value(rule.metric_trigger.time_aggregation),
+ operator=get_enum_value(rule.metric_trigger.operator),
+ threshold=float(rule.metric_trigger.threshold))
+ if rule.scale_action and to_native(rule.scale_action.direction) != 'None':
+ result['direction'] = get_enum_value(rule.scale_action.direction)
+ result['type'] = get_enum_value(rule.scale_action.type)
+ result['value'] = to_native(rule.scale_action.value)
+ result['cooldown'] = timedelta_to_minutes(rule.scale_action.cooldown)
+ return result
+
+
+def profile_to_dict(profile):
+ if not profile:
+ return dict()
+ result = dict(name=to_native(profile.name),
+ count=to_native(profile.capacity.default),
+ max_count=to_native(profile.capacity.maximum),
+ min_count=to_native(profile.capacity.minimum))
+
+ if profile.rules:
+ result['rules'] = [rule_to_dict(r) for r in profile.rules]
+ if profile.fixed_date:
+ result['fixed_date_timezone'] = profile.fixed_date.time_zone
+ result['fixed_date_start'] = profile.fixed_date.start
+ result['fixed_date_end'] = profile.fixed_date.end
+ if profile.recurrence:
+ if get_enum_value(profile.recurrence.frequency) != 'None':
+ result['recurrence_frequency'] = get_enum_value(profile.recurrence.frequency)
+ if profile.recurrence.schedule:
+ result['recurrence_timezone'] = to_native(str(profile.recurrence.schedule.time_zone))
+ result['recurrence_days'] = [to_native(r) for r in profile.recurrence.schedule.days]
+ result['recurrence_hours'] = [to_native(r) for r in profile.recurrence.schedule.hours]
+ result['recurrence_mins'] = [to_native(r) for r in profile.recurrence.schedule.minutes]
+ return result
+
+
+def notification_to_dict(notification):
+ if not notification:
+ return dict()
+ return dict(send_to_subscription_administrator=notification.email.send_to_subscription_administrator if notification.email else False,
+ send_to_subscription_co_administrators=notification.email.send_to_subscription_co_administrators if notification.email else False,
+ custom_emails=[to_native(e) for e in notification.email.custom_emails or []],
+ webhooks=[to_native(w.service_url) for w in notification.webhooks or []])
+
+
+class AzureRMAutoScaleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict()
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+
+ super(AzureRMAutoScaleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_autoscale_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_autoscale_facts' module has been renamed to 'azure_rm_autoscale_info'", version='2.13')
+
+ for key in list(self.module_arg_spec):
+ setattr(self, key, kwargs[key])
+
+ if self.resource_group and self.name:
+ self.results['autoscales'] = self.get()
+ elif self.resource_group:
+ self.results['autoscales'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ result = []
+ try:
+ instance = self.monitor_client.autoscale_settings.get(self.resource_group, self.name)
+ result = [auto_scale_to_dict(instance)]
+ except Exception as ex:
+ self.log('Could not get facts for autoscale {0} - {1}.'.format(self.name, str(ex)))
+ return result
+
+ def list_by_resource_group(self):
+ results = []
+ try:
+ response = self.monitor_client.autoscale_settings.list_by_resource_group(self.resource_group)
+ results = [auto_scale_to_dict(item) for item in response if self.has_tags(item.tags, self.tags)]
+ except Exception as ex:
+ self.log('Could not get facts for autoscale {0} - {1}.'.format(self.name, str(ex)))
+ return results
+
+
+def main():
+ AzureRMAutoScaleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_availabilityset_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_availabilityset_facts.py
new file mode 100644
index 00000000..15fa6e7f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_availabilityset_facts.py
@@ -0,0 +1,216 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2016, Julien Stroheker <juliens@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_availabilityset_info
+
+
+short_description: Get Azure Availability Set facts
+
+description:
+ - Get facts for a specific availability set or all availability sets.
+
+options:
+ name:
+ description:
+ - Limit results to a specific availability set.
+ resource_group:
+ description:
+ - The resource group to search for the desired availability set.
+ tags:
+ description:
+ - List of tags to be matched.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Julien Stroheker (@julienstroheker)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one availability set
+ community.azure.azure_rm_availabilityset_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all availability sets in a specific resource group
+ community.azure.azure_rm_availabilityset_info:
+ resource_group: myResourceGroup
+
+'''
+
+RETURN = '''
+azure_availabilityset:
+ description: List of availability sets dicts.
+ returned: always
+ type: complex
+ contains:
+ location:
+ description:
+ - Location where the resource lives.
+ type: str
+ sample: eastus2
+ name:
+ description:
+ - Resource name.
+ type: str
+ sample: myAvailabilitySet
+ properties:
+ description:
+ - The properties of the resource.
+ type: dict
+ contains:
+ platformFaultDomainCount:
+ description:
+ - Fault Domain count.
+ type: int
+ sample: 3
+ platformUpdateDomainCount:
+ description:
+ - Update Domain count.
+ type: int
+ sample: 2
+ virtualMachines:
+ description:
+ - A list of references to all virtualmachines in the availability set.
+ type: list
+ sample: []
+ sku:
+ description:
+ - Location where the resource lives.
+ type: str
+ sample: Aligned
+ type:
+ description:
+ - Resource type.
+ type: str
+ sample: "Microsoft.Compute/availabilitySets"
+ tags:
+ description:
+ - Resource tags.
+ type: dict
+ sample: { env: sandbox }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'AvailabilitySet'
+
+
+class AzureRMAvailabilitySetInfo(AzureRMModuleBase):
+ """Utility class to get availability set facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ ansible_info=dict(
+ azure_availabilitysets=[]
+ )
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMAvailabilitySetInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_availabilityset_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_availabilityset_facts' module has been renamed to 'azure_rm_availabilityset_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+ if self.name:
+ self.results['ansible_info']['azure_availabilitysets'] = self.get_item()
+ else:
+ self.results['ansible_info']['azure_availabilitysets'] = self.list_items()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single availability set"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.compute_client.availability_sets.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ avase = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ avase['name'] = item.name
+ avase['type'] = item.type
+ avase['sku'] = item.sku.name
+ result = [avase]
+
+ return result
+
+ def list_items(self):
+ """Get all availability sets"""
+
+ self.log('List all availability sets')
+
+ try:
+ response = self.compute_client.availability_sets.list(self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ avase = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ avase['name'] = item.name
+ avase['type'] = item.type
+ avase['sku'] = item.sku.name
+ results.append(avase)
+
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMAvailabilitySetInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_availabilityset_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_availabilityset_info.py
new file mode 100644
index 00000000..15fa6e7f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_availabilityset_info.py
@@ -0,0 +1,216 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2016, Julien Stroheker <juliens@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_availabilityset_info
+
+
+short_description: Get Azure Availability Set facts
+
+description:
+ - Get facts for a specific availability set or all availability sets.
+
+options:
+ name:
+ description:
+ - Limit results to a specific availability set.
+ resource_group:
+ description:
+ - The resource group to search for the desired availability set.
+ tags:
+ description:
+ - List of tags to be matched.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Julien Stroheker (@julienstroheker)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one availability set
+ community.azure.azure_rm_availabilityset_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all availability sets in a specific resource group
+ community.azure.azure_rm_availabilityset_info:
+ resource_group: myResourceGroup
+
+'''
+
+RETURN = '''
+azure_availabilityset:
+ description: List of availability sets dicts.
+ returned: always
+ type: complex
+ contains:
+ location:
+ description:
+ - Location where the resource lives.
+ type: str
+ sample: eastus2
+ name:
+ description:
+ - Resource name.
+ type: str
+ sample: myAvailabilitySet
+ properties:
+ description:
+ - The properties of the resource.
+ type: dict
+ contains:
+ platformFaultDomainCount:
+ description:
+ - Fault Domain count.
+ type: int
+ sample: 3
+ platformUpdateDomainCount:
+ description:
+ - Update Domain count.
+ type: int
+ sample: 2
+ virtualMachines:
+ description:
+ - A list of references to all virtualmachines in the availability set.
+ type: list
+ sample: []
+ sku:
+ description:
+ - Location where the resource lives.
+ type: str
+ sample: Aligned
+ type:
+ description:
+ - Resource type.
+ type: str
+ sample: "Microsoft.Compute/availabilitySets"
+ tags:
+ description:
+ - Resource tags.
+ type: dict
+ sample: { env: sandbox }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'AvailabilitySet'
+
+
+class AzureRMAvailabilitySetInfo(AzureRMModuleBase):
+ """Utility class to get availability set facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ ansible_info=dict(
+ azure_availabilitysets=[]
+ )
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMAvailabilitySetInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_availabilityset_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_availabilityset_facts' module has been renamed to 'azure_rm_availabilityset_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+ if self.name:
+ self.results['ansible_info']['azure_availabilitysets'] = self.get_item()
+ else:
+ self.results['ansible_info']['azure_availabilitysets'] = self.list_items()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single availability set"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.compute_client.availability_sets.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ avase = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ avase['name'] = item.name
+ avase['type'] = item.type
+ avase['sku'] = item.sku.name
+ result = [avase]
+
+ return result
+
+ def list_items(self):
+ """Get all availability sets"""
+
+ self.log('List all availability sets')
+
+ try:
+ response = self.compute_client.availability_sets.list(self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ avase = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ avase['name'] = item.name
+ avase['type'] = item.type
+ avase['sku'] = item.sku.name
+ results.append(avase)
+
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMAvailabilitySetInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnendpoint_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnendpoint_facts.py
new file mode 100644
index 00000000..eb991226
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnendpoint_facts.py
@@ -0,0 +1,315 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Hai Cao, <t-haicao@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_cdnendpoint_info
+
+
+short_description: Get Azure CDN endpoint facts
+
+description:
+ - Get facts for a specific Azure CDN endpoint or all Azure CDN endpoints.
+
+options:
+ resource_group:
+ description:
+ - Name of resource group where this CDN profile belongs to.
+ required: true
+ profile_name:
+ description:
+ - Name of CDN profile.
+ required: true
+ name:
+ description:
+ - Limit results to a specific Azure CDN endpoint.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Hai Cao (@caohai)
+ - Yunge zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for all endpoints in CDN profile
+ community.azure.azure_rm_cdnendpoint_info:
+ resource_group: myResourceGroup
+ profile_name: myCDNProfile
+
+ - name: Get facts of specific CDN endpoint
+ community.azure.azure_rm_cdnendpoint_info:
+ resource_group: myResourceGroup
+ profile_name: myCDNProfile
+ name: myEndpoint1
+'''
+
+RETURN = '''
+cdnendpoints:
+ description: List of Azure CDN endpoints.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group where the Azure CDN endpoint exists.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Name of the Azure CDN endpoint.
+ returned: always
+ type: str
+ sample: myEndpoint
+ profile_name:
+ description:
+ - Name of the Azure CDN profile that this endpoint is attached to.
+ returned: always
+ type: str
+ sample: myProfile
+ location:
+ description:
+ - Location of the Azure CDN endpoint.
+ type: str
+ sample: WestUS
+ id:
+ description:
+ - ID of the Azure CDN endpoint.
+ type: str
+ sample:
+ "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myCDN/providers/Microsoft.Cdn/profiles/myProfile/endpoints/myEndpoint1"
+ provisioning_state:
+ description:
+ - Provisioning status of the Azure CDN endpoint.
+ type: str
+ sample: Succeeded
+ resource_state:
+ description:
+ - Resource status of the profile.
+ type: str
+ sample: Running
+ is_compression_enabled:
+ description:
+ - Indicates whether content compression is enabled on CDN.
+ type: bool
+ sample: true
+ is_http_allowed:
+ description:
+ - Indicates whether HTTP traffic is allowed on the endpoint.
+ type: bool
+ sample: true
+ is_https_allowed:
+ description:
+ - Indicates whether HTTPS traffic is allowed on the endpoint.
+ type: bool
+ sample: true
+ query_string_caching_behavior:
+ description:
+ - Defines how CDN caches requests that include query strings.
+ type: str
+ sample: IgnoreQueryString
+ content_types_to_compress:
+ description:
+ - List of content types on which compression applies.
+ type: list
+ sample: [
+ "text/plain",
+ "text/html",
+ "text/css",
+ "text/javascript",
+ "application/x-javascript",
+ "application/javascript",
+ "application/json",
+ "application/xml"
+ ]
+ origins:
+ description:
+ - The source of the content being delivered via CDN.
+ sample: {
+ "host_name": "xxxxxxxx.blob.core.windows.net",
+ "http_port": null,
+ "https_port": null,
+ "name": "xxxxxxxx-blob-core-windows-net"
+ }
+ origin_host_header:
+ description:
+ - The host header value sent to the origin with each request.
+ type: str
+ sample: xxxxxxxx.blob.core.windows.net
+ origin_path:
+ description:
+ - A directory path on the origin that CDN can use to retrieve content from.
+ type: str
+ sample: /pic/
+ tags:
+ description:
+ - The tags of the Azure CDN endpoint.
+ type: list
+ sample: foo
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from azure.mgmt.cdn import CdnManagementClient
+ from azure.mgmt.cdn.models import ErrorResponseException
+ from azure.common import AzureHttpError
+except ImportError:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+AZURE_OBJECT_CLASS = 'endpoints'
+
+
+class AzureRMCdnEndpointInfo(AzureRMModuleBase):
+ """Utility class to get Azure Azure CDN endpoint facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ profile_name=dict(
+ type='str',
+ required=True
+ ),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ cdnendpoints=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.profile_name = None
+ self.tags = None
+
+ super(AzureRMCdnEndpointInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_cdnendpoint_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_cdnendpoint_facts' module has been renamed to 'azure_rm_cdnendpoint_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.cdn_client = self.get_mgmt_svc_client(CdnManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version='2017-04-02')
+
+ if self.name:
+ self.results['cdnendpoints'] = self.get_item()
+ else:
+ self.results['cdnendpoints'] = self.list_by_profile()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Azure CDN endpoint"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.cdn_client.endpoints.get(
+ self.resource_group, self.profile_name, self.name)
+ except ErrorResponseException:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_cdnendpoint(item)]
+
+ return result
+
+ def list_by_profile(self):
+ """Get all Azure Azure CDN endpoints within an Azure CDN profile"""
+
+ self.log('List all Azure CDN endpoints within an Azure CDN profile')
+
+ try:
+ response = self.cdn_client.endpoints.list_by_profile(
+ self.resource_group, self.profile_name)
+ except ErrorResponseException as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_cdnendpoint(item))
+
+ return results
+
+ def serialize_cdnendpoint(self, cdnendpoint):
+ '''
+ Convert a Azure CDN endpoint object to dict.
+ :param cdn: Azure CDN endpoint object
+ :return: dict
+ '''
+ result = self.serialize_obj(cdnendpoint, AZURE_OBJECT_CLASS)
+
+ new_result = {}
+ new_result['id'] = cdnendpoint.id
+ new_result['resource_group'] = re.sub('\\/.*', '', re.sub('.*resourcegroups\\/', '', result['id']))
+ new_result['profile_name'] = re.sub('\\/.*', '', re.sub('.*profiles\\/', '', result['id']))
+ new_result['name'] = cdnendpoint.name
+ new_result['type'] = cdnendpoint.type
+ new_result['location'] = cdnendpoint.location
+ new_result['resource_state'] = cdnendpoint.resource_state
+ new_result['provisioning_state'] = cdnendpoint.provisioning_state
+ new_result['query_string_caching_behavior'] = cdnendpoint.query_string_caching_behavior
+ new_result['is_compression_enabled'] = cdnendpoint.is_compression_enabled
+ new_result['is_http_allowed'] = cdnendpoint.is_http_allowed
+ new_result['is_https_allowed'] = cdnendpoint.is_https_allowed
+ new_result['content_types_to_compress'] = cdnendpoint.content_types_to_compress
+ new_result['origin_host_header'] = cdnendpoint.origin_host_header
+ new_result['origin_path'] = cdnendpoint.origin_path
+ new_result['origin'] = dict(
+ name=cdnendpoint.origins[0].name,
+ host_name=cdnendpoint.origins[0].host_name,
+ http_port=cdnendpoint.origins[0].http_port,
+ https_port=cdnendpoint.origins[0].https_port
+ )
+ new_result['tags'] = cdnendpoint.tags
+ return new_result
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMCdnEndpointInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnendpoint_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnendpoint_info.py
new file mode 100644
index 00000000..eb991226
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnendpoint_info.py
@@ -0,0 +1,315 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Hai Cao, <t-haicao@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_cdnendpoint_info
+
+
+short_description: Get Azure CDN endpoint facts
+
+description:
+ - Get facts for a specific Azure CDN endpoint or all Azure CDN endpoints.
+
+options:
+ resource_group:
+ description:
+ - Name of resource group where this CDN profile belongs to.
+ required: true
+ profile_name:
+ description:
+ - Name of CDN profile.
+ required: true
+ name:
+ description:
+ - Limit results to a specific Azure CDN endpoint.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Hai Cao (@caohai)
+ - Yunge zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for all endpoints in CDN profile
+ community.azure.azure_rm_cdnendpoint_info:
+ resource_group: myResourceGroup
+ profile_name: myCDNProfile
+
+ - name: Get facts of specific CDN endpoint
+ community.azure.azure_rm_cdnendpoint_info:
+ resource_group: myResourceGroup
+ profile_name: myCDNProfile
+ name: myEndpoint1
+'''
+
+RETURN = '''
+cdnendpoints:
+ description: List of Azure CDN endpoints.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group where the Azure CDN endpoint exists.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Name of the Azure CDN endpoint.
+ returned: always
+ type: str
+ sample: myEndpoint
+ profile_name:
+ description:
+ - Name of the Azure CDN profile that this endpoint is attached to.
+ returned: always
+ type: str
+ sample: myProfile
+ location:
+ description:
+ - Location of the Azure CDN endpoint.
+ type: str
+ sample: WestUS
+ id:
+ description:
+ - ID of the Azure CDN endpoint.
+ type: str
+ sample:
+ "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myCDN/providers/Microsoft.Cdn/profiles/myProfile/endpoints/myEndpoint1"
+ provisioning_state:
+ description:
+ - Provisioning status of the Azure CDN endpoint.
+ type: str
+ sample: Succeeded
+ resource_state:
+ description:
+ - Resource status of the profile.
+ type: str
+ sample: Running
+ is_compression_enabled:
+ description:
+ - Indicates whether content compression is enabled on CDN.
+ type: bool
+ sample: true
+ is_http_allowed:
+ description:
+ - Indicates whether HTTP traffic is allowed on the endpoint.
+ type: bool
+ sample: true
+ is_https_allowed:
+ description:
+ - Indicates whether HTTPS traffic is allowed on the endpoint.
+ type: bool
+ sample: true
+ query_string_caching_behavior:
+ description:
+ - Defines how CDN caches requests that include query strings.
+ type: str
+ sample: IgnoreQueryString
+ content_types_to_compress:
+ description:
+ - List of content types on which compression applies.
+ type: list
+ sample: [
+ "text/plain",
+ "text/html",
+ "text/css",
+ "text/javascript",
+ "application/x-javascript",
+ "application/javascript",
+ "application/json",
+ "application/xml"
+ ]
+ origins:
+ description:
+ - The source of the content being delivered via CDN.
+ sample: {
+ "host_name": "xxxxxxxx.blob.core.windows.net",
+ "http_port": null,
+ "https_port": null,
+ "name": "xxxxxxxx-blob-core-windows-net"
+ }
+ origin_host_header:
+ description:
+ - The host header value sent to the origin with each request.
+ type: str
+ sample: xxxxxxxx.blob.core.windows.net
+ origin_path:
+ description:
+ - A directory path on the origin that CDN can use to retrieve content from.
+ type: str
+ sample: /pic/
+ tags:
+ description:
+ - The tags of the Azure CDN endpoint.
+ type: list
+ sample: foo
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from azure.mgmt.cdn import CdnManagementClient
+ from azure.mgmt.cdn.models import ErrorResponseException
+ from azure.common import AzureHttpError
+except ImportError:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+AZURE_OBJECT_CLASS = 'endpoints'
+
+
+class AzureRMCdnEndpointInfo(AzureRMModuleBase):
+ """Utility class to get Azure Azure CDN endpoint facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ profile_name=dict(
+ type='str',
+ required=True
+ ),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ cdnendpoints=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.profile_name = None
+ self.tags = None
+
+ super(AzureRMCdnEndpointInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_cdnendpoint_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_cdnendpoint_facts' module has been renamed to 'azure_rm_cdnendpoint_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.cdn_client = self.get_mgmt_svc_client(CdnManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version='2017-04-02')
+
+ if self.name:
+ self.results['cdnendpoints'] = self.get_item()
+ else:
+ self.results['cdnendpoints'] = self.list_by_profile()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Azure CDN endpoint"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.cdn_client.endpoints.get(
+ self.resource_group, self.profile_name, self.name)
+ except ErrorResponseException:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_cdnendpoint(item)]
+
+ return result
+
+ def list_by_profile(self):
+ """Get all Azure Azure CDN endpoints within an Azure CDN profile"""
+
+ self.log('List all Azure CDN endpoints within an Azure CDN profile')
+
+ try:
+ response = self.cdn_client.endpoints.list_by_profile(
+ self.resource_group, self.profile_name)
+ except ErrorResponseException as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_cdnendpoint(item))
+
+ return results
+
+ def serialize_cdnendpoint(self, cdnendpoint):
+ '''
+ Convert a Azure CDN endpoint object to dict.
+ :param cdn: Azure CDN endpoint object
+ :return: dict
+ '''
+ result = self.serialize_obj(cdnendpoint, AZURE_OBJECT_CLASS)
+
+ new_result = {}
+ new_result['id'] = cdnendpoint.id
+ new_result['resource_group'] = re.sub('\\/.*', '', re.sub('.*resourcegroups\\/', '', result['id']))
+ new_result['profile_name'] = re.sub('\\/.*', '', re.sub('.*profiles\\/', '', result['id']))
+ new_result['name'] = cdnendpoint.name
+ new_result['type'] = cdnendpoint.type
+ new_result['location'] = cdnendpoint.location
+ new_result['resource_state'] = cdnendpoint.resource_state
+ new_result['provisioning_state'] = cdnendpoint.provisioning_state
+ new_result['query_string_caching_behavior'] = cdnendpoint.query_string_caching_behavior
+ new_result['is_compression_enabled'] = cdnendpoint.is_compression_enabled
+ new_result['is_http_allowed'] = cdnendpoint.is_http_allowed
+ new_result['is_https_allowed'] = cdnendpoint.is_https_allowed
+ new_result['content_types_to_compress'] = cdnendpoint.content_types_to_compress
+ new_result['origin_host_header'] = cdnendpoint.origin_host_header
+ new_result['origin_path'] = cdnendpoint.origin_path
+ new_result['origin'] = dict(
+ name=cdnendpoint.origins[0].name,
+ host_name=cdnendpoint.origins[0].host_name,
+ http_port=cdnendpoint.origins[0].http_port,
+ https_port=cdnendpoint.origins[0].https_port
+ )
+ new_result['tags'] = cdnendpoint.tags
+ return new_result
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMCdnEndpointInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnprofile_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnprofile_facts.py
new file mode 100644
index 00000000..62375aad
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnprofile_facts.py
@@ -0,0 +1,268 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Hai Cao, <t-haicao@microsoft.com>, Yunge Zhu <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_cdnprofile_info
+
+
+short_description: Get Azure CDN profile facts
+
+description:
+ - Get facts for a specific Azure CDN profile or all CDN profiles.
+
+options:
+ name:
+ description:
+ - Limit results to a specific CDN profile.
+ resource_group:
+ description:
+ - The resource group to search for the desired CDN profile.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Hai Cao (@caohai)
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one CDN profile
+ community.azure.azure_rm_cdnprofile_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all CDN profiles
+ community.azure.azure_rm_cdnprofile_info:
+
+ - name: Get facts by tags
+ community.azure.azure_rm_cdnprofile_info:
+ tags:
+ - Environment:Test
+'''
+
+RETURN = '''
+cdnprofiles:
+ description: List of CDN profiles.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group where the CDN profile exists.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Name of the CDN profile.
+ returned: always
+ type: str
+ sample: Testing
+ location:
+ description:
+ - Location of the CDN profile.
+ type: str
+ sample: WestUS
+ id:
+ description:
+ - ID of the CDN profile.
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.Cdn/profiles/myCDN
+ provisioning_state:
+ description:
+ - Provisioning status of the profile.
+ type: str
+ sample: Succeeded
+ resource_state:
+ description:
+ - Resource status of the profile.
+ type: str
+ sample: Active
+ sku:
+ description:
+ - The pricing tier, defines a CDN provider, feature list and rate of the CDN profile.
+ type: str
+ sample: standard_verizon
+ type:
+ description:
+ - The type of the CDN profile.
+ type: str
+ sample: Microsoft.Cdn/profiles
+ tags:
+ description:
+ - The tags of the CDN profile.
+ type: list
+ sample: [
+ {"foo": "bar"}
+ ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from azure.mgmt.cdn.models import ErrorResponseException
+ from azure.common import AzureHttpError
+ from azure.mgmt.cdn import CdnManagementClient
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+AZURE_OBJECT_CLASS = 'profiles'
+
+
+class AzureRMCdnprofileInfo(AzureRMModuleBase):
+ """Utility class to get Azure CDN profile facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ cdnprofiles=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.cdn_client = None
+
+ super(AzureRMCdnprofileInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_cdnprofile_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_cdnprofile_facts' module has been renamed to 'azure_rm_cdnprofile_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.cdn_client = self.get_cdn_client()
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ self.results['cdnprofiles'] = self.get_item()
+ elif self.resource_group:
+ self.results['cdnprofiles'] = self.list_resource_group()
+ else:
+ self.results['cdnprofiles'] = self.list_all()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure CDN profile"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.cdn_client.profiles.get(
+ self.resource_group, self.name)
+ except ErrorResponseException:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_cdnprofile(item)]
+
+ return result
+
+ def list_resource_group(self):
+ """Get all Azure CDN profiles within a resource group"""
+
+ self.log('List all Azure CDNs within a resource group')
+
+ try:
+ response = self.cdn_client.profiles.list_by_resource_group(
+ self.resource_group)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_cdnprofile(item))
+
+ return results
+
+ def list_all(self):
+ """Get all Azure CDN profiles within a subscription"""
+ self.log('List all CDN profiles within a subscription')
+ try:
+ response = self.cdn_client.profiles.list()
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_cdnprofile(item))
+ return results
+
+ def serialize_cdnprofile(self, cdnprofile):
+ '''
+ Convert a CDN profile object to dict.
+ :param cdn: CDN profile object
+ :return: dict
+ '''
+ result = self.serialize_obj(cdnprofile, AZURE_OBJECT_CLASS)
+
+ new_result = {}
+ new_result['id'] = cdnprofile.id
+ new_result['resource_group'] = re.sub('\\/.*', '', re.sub('.*resourcegroups\\/', '', result['id']))
+ new_result['name'] = cdnprofile.name
+ new_result['type'] = cdnprofile.type
+ new_result['location'] = cdnprofile.location
+ new_result['resource_state'] = cdnprofile.resource_state
+ new_result['sku'] = cdnprofile.sku.name
+ new_result['provisioning_state'] = cdnprofile.provisioning_state
+ new_result['tags'] = cdnprofile.tags
+ return new_result
+
+ def get_cdn_client(self):
+ if not self.cdn_client:
+ self.cdn_client = self.get_mgmt_svc_client(CdnManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version='2017-04-02')
+ return self.cdn_client
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMCdnprofileInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnprofile_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnprofile_info.py
new file mode 100644
index 00000000..62375aad
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cdnprofile_info.py
@@ -0,0 +1,268 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Hai Cao, <t-haicao@microsoft.com>, Yunge Zhu <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_cdnprofile_info
+
+
+short_description: Get Azure CDN profile facts
+
+description:
+ - Get facts for a specific Azure CDN profile or all CDN profiles.
+
+options:
+ name:
+ description:
+ - Limit results to a specific CDN profile.
+ resource_group:
+ description:
+ - The resource group to search for the desired CDN profile.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Hai Cao (@caohai)
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one CDN profile
+ community.azure.azure_rm_cdnprofile_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all CDN profiles
+ community.azure.azure_rm_cdnprofile_info:
+
+ - name: Get facts by tags
+ community.azure.azure_rm_cdnprofile_info:
+ tags:
+ - Environment:Test
+'''
+
+RETURN = '''
+cdnprofiles:
+ description: List of CDN profiles.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group where the CDN profile exists.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Name of the CDN profile.
+ returned: always
+ type: str
+ sample: Testing
+ location:
+ description:
+ - Location of the CDN profile.
+ type: str
+ sample: WestUS
+ id:
+ description:
+ - ID of the CDN profile.
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.Cdn/profiles/myCDN
+ provisioning_state:
+ description:
+ - Provisioning status of the profile.
+ type: str
+ sample: Succeeded
+ resource_state:
+ description:
+ - Resource status of the profile.
+ type: str
+ sample: Active
+ sku:
+ description:
+ - The pricing tier, defines a CDN provider, feature list and rate of the CDN profile.
+ type: str
+ sample: standard_verizon
+ type:
+ description:
+ - The type of the CDN profile.
+ type: str
+ sample: Microsoft.Cdn/profiles
+ tags:
+ description:
+ - The tags of the CDN profile.
+ type: list
+ sample: [
+ {"foo": "bar"}
+ ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from azure.mgmt.cdn.models import ErrorResponseException
+ from azure.common import AzureHttpError
+ from azure.mgmt.cdn import CdnManagementClient
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+AZURE_OBJECT_CLASS = 'profiles'
+
+
+class AzureRMCdnprofileInfo(AzureRMModuleBase):
+ """Utility class to get Azure CDN profile facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ cdnprofiles=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.cdn_client = None
+
+ super(AzureRMCdnprofileInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_cdnprofile_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_cdnprofile_facts' module has been renamed to 'azure_rm_cdnprofile_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.cdn_client = self.get_cdn_client()
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ self.results['cdnprofiles'] = self.get_item()
+ elif self.resource_group:
+ self.results['cdnprofiles'] = self.list_resource_group()
+ else:
+ self.results['cdnprofiles'] = self.list_all()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure CDN profile"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.cdn_client.profiles.get(
+ self.resource_group, self.name)
+ except ErrorResponseException:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_cdnprofile(item)]
+
+ return result
+
+ def list_resource_group(self):
+ """Get all Azure CDN profiles within a resource group"""
+
+ self.log('List all Azure CDNs within a resource group')
+
+ try:
+ response = self.cdn_client.profiles.list_by_resource_group(
+ self.resource_group)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_cdnprofile(item))
+
+ return results
+
+ def list_all(self):
+ """Get all Azure CDN profiles within a subscription"""
+ self.log('List all CDN profiles within a subscription')
+ try:
+ response = self.cdn_client.profiles.list()
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_cdnprofile(item))
+ return results
+
+ def serialize_cdnprofile(self, cdnprofile):
+ '''
+ Convert a CDN profile object to dict.
+ :param cdn: CDN profile object
+ :return: dict
+ '''
+ result = self.serialize_obj(cdnprofile, AZURE_OBJECT_CLASS)
+
+ new_result = {}
+ new_result['id'] = cdnprofile.id
+ new_result['resource_group'] = re.sub('\\/.*', '', re.sub('.*resourcegroups\\/', '', result['id']))
+ new_result['name'] = cdnprofile.name
+ new_result['type'] = cdnprofile.type
+ new_result['location'] = cdnprofile.location
+ new_result['resource_state'] = cdnprofile.resource_state
+ new_result['sku'] = cdnprofile.sku.name
+ new_result['provisioning_state'] = cdnprofile.provisioning_state
+ new_result['tags'] = cdnprofile.tags
+ return new_result
+
+ def get_cdn_client(self):
+ if not self.cdn_client:
+ self.cdn_client = self.get_mgmt_svc_client(CdnManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version='2017-04-02')
+ return self.cdn_client
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMCdnprofileInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerinstance_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerinstance_facts.py
new file mode 100644
index 00000000..710370f7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerinstance_facts.py
@@ -0,0 +1,320 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_containerinstance_info
+short_description: Get Azure Container Instance facts
+description:
+ - Get facts of Container Instance.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ name:
+ description:
+ - The name of the container instance.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get specific Container Instance facts
+ community.azure.azure_rm_containerinstance_info:
+ resource_group: myResourceGroup
+ name: myContainer
+
+ - name: List Container Instances in a specified resource group name
+ community.azure.azure_rm_containerinstance_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+container_groups:
+ description: A list of Container Instance dictionaries.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The resource id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/contain
+ erGroups/myContainer"
+ resource_group:
+ description:
+ - Resource group where the container exists.
+ returned: always
+ type: str
+ sample: testrg
+ name:
+ description:
+ - The resource name.
+ returned: always
+ type: str
+ sample: mycontainers
+ location:
+ description:
+ - The resource location.
+ returned: always
+ type: str
+ sample: westus
+ os_type:
+ description:
+ - The OS type of containers.
+ returned: always
+ type: str
+ sample: linux
+ ip_address:
+ description:
+ - IP address of the container instance.
+ returned: always
+ type: str
+ sample: 173.15.18.1
+ dns_name_label:
+ description:
+ - The Dns name label for the IP.
+ returned: always
+ type: str
+ sample: mydomain
+ ports:
+ description:
+ - List of ports exposed by the container instance.
+ returned: always
+ type: list
+ sample: [ 80, 81 ]
+ containers:
+ description:
+ - The containers within the container group.
+ returned: always
+ type: complex
+ sample: containers
+ contains:
+ name:
+ description:
+ - The name of the container instance.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance
+ /containerGroups/myContainer"
+ image:
+ description:
+ - The container image name.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance
+ /containerGroups/myContainer"
+ memory:
+ description:
+ - The required memory of the containers in GB.
+ returned: always
+ type: float
+ sample: 1.5
+ cpu:
+ description:
+ - The required number of CPU cores of the containers.
+ returned: always
+ type: int
+ sample: 1
+ ports:
+ description:
+ - List of ports exposed within the container group.
+ returned: always
+ type: list
+ sample: [ 80, 81 ]
+ commands:
+ description:
+ - List of commands to execute within the container instance in exec form.
+ returned: always
+ type: list
+ sample: [ "pip install abc" ]
+ environment_variables:
+ description:
+ - List of container environment variables.
+ type: complex
+ contains:
+ name:
+ description:
+ - Environment variable name.
+ type: str
+ value:
+ description:
+ - Environment variable value.
+ type: str
+ tags:
+ description: Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { "tag1": "abc" }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.containerinstance import ContainerInstanceManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMContainerInstanceInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False,
+ )
+ self.resource_group = None
+ self.name = None
+
+ super(AzureRMContainerInstanceInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_containerinstance_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_containerinstance_facts' module has been renamed to 'azure_rm_containerinstance_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.name is not None):
+ self.results['containerinstances'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['containerinstances'] = self.list_by_resource_group()
+ else:
+ self.results['containerinstances'] = self.list_all()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.containerinstance_client.container_groups.get(resource_group_name=self.resource_group,
+ container_group_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Container Instances.')
+
+ if response is not None and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.containerinstance_client.container_groups.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not list facts for Container Instances.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def list_all(self):
+ response = None
+ results = []
+ try:
+ response = self.containerinstance_client.container_groups.list()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not list facts for Container Instances.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ containers = d['containers']
+ ports = d['ip_address']['ports'] if 'ip_address' in d else []
+ resource_group = d['id'].split('resourceGroups/')[1].split('/')[0]
+
+ for port_index in range(len(ports)):
+ ports[port_index] = ports[port_index]['port']
+
+ for container_index in range(len(containers)):
+ old_container = containers[container_index]
+ new_container = {
+ 'name': old_container['name'],
+ 'image': old_container['image'],
+ 'memory': old_container['resources']['requests']['memory_in_gb'],
+ 'cpu': old_container['resources']['requests']['cpu'],
+ 'ports': [],
+ 'commands': old_container.get('command'),
+ 'environment_variables': old_container.get('environment_variables')
+ }
+ for port_index in range(len(old_container['ports'])):
+ new_container['ports'].append(old_container['ports'][port_index]['port'])
+ containers[container_index] = new_container
+
+ d = {
+ 'id': d['id'],
+ 'resource_group': resource_group,
+ 'name': d['name'],
+ 'os_type': d['os_type'],
+ 'dns_name_label': d['ip_address'].get('dns_name_label'),
+ 'ip_address': d['ip_address']['ip'] if 'ip_address' in d else '',
+ 'ports': ports,
+ 'location': d['location'],
+ 'containers': containers,
+ 'restart_policy': _camel_to_snake(d.get('restart_policy')) if d.get('restart_policy') else None,
+ 'tags': d.get('tags', None)
+ }
+ return d
+
+
+def main():
+ AzureRMContainerInstanceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerinstance_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerinstance_info.py
new file mode 100644
index 00000000..710370f7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerinstance_info.py
@@ -0,0 +1,320 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_containerinstance_info
+short_description: Get Azure Container Instance facts
+description:
+ - Get facts of Container Instance.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ name:
+ description:
+ - The name of the container instance.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get specific Container Instance facts
+ community.azure.azure_rm_containerinstance_info:
+ resource_group: myResourceGroup
+ name: myContainer
+
+ - name: List Container Instances in a specified resource group name
+ community.azure.azure_rm_containerinstance_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+container_groups:
+ description: A list of Container Instance dictionaries.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The resource id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/contain
+ erGroups/myContainer"
+ resource_group:
+ description:
+ - Resource group where the container exists.
+ returned: always
+ type: str
+ sample: testrg
+ name:
+ description:
+ - The resource name.
+ returned: always
+ type: str
+ sample: mycontainers
+ location:
+ description:
+ - The resource location.
+ returned: always
+ type: str
+ sample: westus
+ os_type:
+ description:
+ - The OS type of containers.
+ returned: always
+ type: str
+ sample: linux
+ ip_address:
+ description:
+ - IP address of the container instance.
+ returned: always
+ type: str
+ sample: 173.15.18.1
+ dns_name_label:
+ description:
+ - The Dns name label for the IP.
+ returned: always
+ type: str
+ sample: mydomain
+ ports:
+ description:
+ - List of ports exposed by the container instance.
+ returned: always
+ type: list
+ sample: [ 80, 81 ]
+ containers:
+ description:
+ - The containers within the container group.
+ returned: always
+ type: complex
+ sample: containers
+ contains:
+ name:
+ description:
+ - The name of the container instance.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance
+ /containerGroups/myContainer"
+ image:
+ description:
+ - The container image name.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance
+ /containerGroups/myContainer"
+ memory:
+ description:
+ - The required memory of the containers in GB.
+ returned: always
+ type: float
+ sample: 1.5
+ cpu:
+ description:
+ - The required number of CPU cores of the containers.
+ returned: always
+ type: int
+ sample: 1
+ ports:
+ description:
+ - List of ports exposed within the container group.
+ returned: always
+ type: list
+ sample: [ 80, 81 ]
+ commands:
+ description:
+ - List of commands to execute within the container instance in exec form.
+ returned: always
+ type: list
+ sample: [ "pip install abc" ]
+ environment_variables:
+ description:
+ - List of container environment variables.
+ type: complex
+ contains:
+ name:
+ description:
+ - Environment variable name.
+ type: str
+ value:
+ description:
+ - Environment variable value.
+ type: str
+ tags:
+ description: Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { "tag1": "abc" }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.containerinstance import ContainerInstanceManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMContainerInstanceInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False,
+ )
+ self.resource_group = None
+ self.name = None
+
+ super(AzureRMContainerInstanceInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_containerinstance_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_containerinstance_facts' module has been renamed to 'azure_rm_containerinstance_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.name is not None):
+ self.results['containerinstances'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['containerinstances'] = self.list_by_resource_group()
+ else:
+ self.results['containerinstances'] = self.list_all()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.containerinstance_client.container_groups.get(resource_group_name=self.resource_group,
+ container_group_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Container Instances.')
+
+ if response is not None and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.containerinstance_client.container_groups.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not list facts for Container Instances.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def list_all(self):
+ response = None
+ results = []
+ try:
+ response = self.containerinstance_client.container_groups.list()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not list facts for Container Instances.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ containers = d['containers']
+ ports = d['ip_address']['ports'] if 'ip_address' in d else []
+ resource_group = d['id'].split('resourceGroups/')[1].split('/')[0]
+
+ for port_index in range(len(ports)):
+ ports[port_index] = ports[port_index]['port']
+
+ for container_index in range(len(containers)):
+ old_container = containers[container_index]
+ new_container = {
+ 'name': old_container['name'],
+ 'image': old_container['image'],
+ 'memory': old_container['resources']['requests']['memory_in_gb'],
+ 'cpu': old_container['resources']['requests']['cpu'],
+ 'ports': [],
+ 'commands': old_container.get('command'),
+ 'environment_variables': old_container.get('environment_variables')
+ }
+ for port_index in range(len(old_container['ports'])):
+ new_container['ports'].append(old_container['ports'][port_index]['port'])
+ containers[container_index] = new_container
+
+ d = {
+ 'id': d['id'],
+ 'resource_group': resource_group,
+ 'name': d['name'],
+ 'os_type': d['os_type'],
+ 'dns_name_label': d['ip_address'].get('dns_name_label'),
+ 'ip_address': d['ip_address']['ip'] if 'ip_address' in d else '',
+ 'ports': ports,
+ 'location': d['location'],
+ 'containers': containers,
+ 'restart_policy': _camel_to_snake(d.get('restart_policy')) if d.get('restart_policy') else None,
+ 'tags': d.get('tags', None)
+ }
+ return d
+
+
+def main():
+ AzureRMContainerInstanceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerregistry_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerregistry_facts.py
new file mode 100644
index 00000000..32dc76a3
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerregistry_facts.py
@@ -0,0 +1,283 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_containerregistry_info
+short_description: Get Azure Container Registry facts
+description:
+ - Get facts for Container Registry.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group to which the container registry belongs.
+ required: True
+ name:
+ description:
+ - The name of the container registry.
+ retrieve_credentials:
+ description:
+ - Retrieve credentials for container registry.
+ type: bool
+ default: no
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Registry
+ community.azure.azure_rm_containerregistry_info:
+ resource_group: myResourceGroup
+ name: myRegistry
+
+ - name: List instances of Registry
+ community.azure.azure_rm_containerregistry_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+registries:
+ description:
+ - A list of dictionaries containing facts for registries.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registr
+ ies/myRegistry"
+ name:
+ description:
+ - The name of the resource.
+ returned: always
+ type: str
+ sample: myRegistry
+ location:
+ description:
+ - The location of the resource. This cannot be changed after the resource is created.
+ returned: always
+ type: str
+ sample: westus
+ admin_user_enabled:
+ description:
+ - Is admin user enabled.
+ returned: always
+ type: bool
+ sample: yes
+ sku:
+ description:
+ - The SKU name of the container registry.
+ returned: always
+ type: str
+ sample: Premium
+ provisioning_state:
+ description:
+ - Provisioning state of the container registry.
+ returned: always
+ type: str
+ sample: Succeeded
+ login_server:
+ description:
+ - Login server for the registry.
+ returned: always
+ type: str
+ sample: acrd08521b.azurecr.io
+ credentials:
+ description:
+ - Credentials, fields will be empty if admin user is not enabled for ACR.
+ returned: when C(retrieve_credentials) is set and C(admin_user_enabled) is set on ACR
+ type: complex
+ contains:
+ username:
+ description:
+ - The user name for container registry.
+ returned: when registry exists and C(admin_user_enabled) is set
+ type: str
+ sample: zim
+ password:
+ description:
+ - password value.
+ returned: when registry exists and C(admin_user_enabled) is set
+ type: str
+ sample: pass1value
+ password2:
+ description:
+ - password2 value.
+ returned: when registry exists and C(admin_user_enabled) is set
+ type: str
+ sample: pass2value
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { "tag1": "abc" }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.containerregistry import ContainerRegistryManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMContainerRegistryInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ ),
+ retrieve_credentials=dict(
+ type='bool',
+ default=False
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+ self.retrieve_credentials = False
+
+ super(AzureRMContainerRegistryInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_containerregistry_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_containerregistry_facts' module has been renamed to 'azure_rm_containerregistry_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ self.results['registries'] = self.get()
+ elif self.resource_group:
+ self.results['registries'] = self.list_by_resource_group()
+ else:
+ self.results['registries'] = self.list_all()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.containerregistry_client.registries.get(resource_group_name=self.resource_group,
+ registry_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Registries.')
+
+ if response is not None:
+ if self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_all(self):
+ response = None
+ results = []
+ try:
+ response = self.containerregistry_client.registries.list()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Registries.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.containerregistry_client.registries.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Registries.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ resource_group = d['id'].split('resourceGroups/')[1].split('/')[0]
+ name = d['name']
+ credentials = {}
+ admin_user_enabled = d['admin_user_enabled']
+
+ if self.retrieve_credentials and admin_user_enabled:
+ credentials = self.containerregistry_client.registries.list_credentials(resource_group, name).as_dict()
+ for index in range(len(credentials['passwords'])):
+ password = credentials['passwords'][index]
+ if password['name'] == 'password':
+ credentials['password'] = password['value']
+ elif password['name'] == 'password2':
+ credentials['password2'] = password['value']
+ credentials.pop('passwords')
+
+ d = {
+ 'resource_group': resource_group,
+ 'name': d['name'],
+ 'location': d['location'],
+ 'admin_user_enabled': admin_user_enabled,
+ 'sku': d['sku']['tier'].lower(),
+ 'provisioning_state': d['provisioning_state'],
+ 'login_server': d['login_server'],
+ 'id': d['id'],
+ 'tags': d.get('tags', None),
+ 'credentials': credentials
+ }
+ return d
+
+
+def main():
+ AzureRMContainerRegistryInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerregistry_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerregistry_info.py
new file mode 100644
index 00000000..32dc76a3
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_containerregistry_info.py
@@ -0,0 +1,283 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_containerregistry_info
+short_description: Get Azure Container Registry facts
+description:
+ - Get facts for Container Registry.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group to which the container registry belongs.
+ required: True
+ name:
+ description:
+ - The name of the container registry.
+ retrieve_credentials:
+ description:
+ - Retrieve credentials for container registry.
+ type: bool
+ default: no
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Registry
+ community.azure.azure_rm_containerregistry_info:
+ resource_group: myResourceGroup
+ name: myRegistry
+
+ - name: List instances of Registry
+ community.azure.azure_rm_containerregistry_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+registries:
+ description:
+ - A list of dictionaries containing facts for registries.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registr
+ ies/myRegistry"
+ name:
+ description:
+ - The name of the resource.
+ returned: always
+ type: str
+ sample: myRegistry
+ location:
+ description:
+ - The location of the resource. This cannot be changed after the resource is created.
+ returned: always
+ type: str
+ sample: westus
+ admin_user_enabled:
+ description:
+ - Is admin user enabled.
+ returned: always
+ type: bool
+ sample: yes
+ sku:
+ description:
+ - The SKU name of the container registry.
+ returned: always
+ type: str
+ sample: Premium
+ provisioning_state:
+ description:
+ - Provisioning state of the container registry.
+ returned: always
+ type: str
+ sample: Succeeded
+ login_server:
+ description:
+ - Login server for the registry.
+ returned: always
+ type: str
+ sample: acrd08521b.azurecr.io
+ credentials:
+ description:
+ - Credentials, fields will be empty if admin user is not enabled for ACR.
+ returned: when C(retrieve_credentials) is set and C(admin_user_enabled) is set on ACR
+ type: complex
+ contains:
+ username:
+ description:
+ - The user name for container registry.
+ returned: when registry exists and C(admin_user_enabled) is set
+ type: str
+ sample: zim
+ password:
+ description:
+ - password value.
+ returned: when registry exists and C(admin_user_enabled) is set
+ type: str
+ sample: pass1value
+ password2:
+ description:
+ - password2 value.
+ returned: when registry exists and C(admin_user_enabled) is set
+ type: str
+ sample: pass2value
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { "tag1": "abc" }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.containerregistry import ContainerRegistryManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMContainerRegistryInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ ),
+ retrieve_credentials=dict(
+ type='bool',
+ default=False
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+ self.retrieve_credentials = False
+
+ super(AzureRMContainerRegistryInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_containerregistry_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_containerregistry_facts' module has been renamed to 'azure_rm_containerregistry_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ self.results['registries'] = self.get()
+ elif self.resource_group:
+ self.results['registries'] = self.list_by_resource_group()
+ else:
+ self.results['registries'] = self.list_all()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.containerregistry_client.registries.get(resource_group_name=self.resource_group,
+ registry_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Registries.')
+
+ if response is not None:
+ if self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_all(self):
+ response = None
+ results = []
+ try:
+ response = self.containerregistry_client.registries.list()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Registries.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.containerregistry_client.registries.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Registries.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ resource_group = d['id'].split('resourceGroups/')[1].split('/')[0]
+ name = d['name']
+ credentials = {}
+ admin_user_enabled = d['admin_user_enabled']
+
+ if self.retrieve_credentials and admin_user_enabled:
+ credentials = self.containerregistry_client.registries.list_credentials(resource_group, name).as_dict()
+ for index in range(len(credentials['passwords'])):
+ password = credentials['passwords'][index]
+ if password['name'] == 'password':
+ credentials['password'] = password['value']
+ elif password['name'] == 'password2':
+ credentials['password2'] = password['value']
+ credentials.pop('passwords')
+
+ d = {
+ 'resource_group': resource_group,
+ 'name': d['name'],
+ 'location': d['location'],
+ 'admin_user_enabled': admin_user_enabled,
+ 'sku': d['sku']['tier'].lower(),
+ 'provisioning_state': d['provisioning_state'],
+ 'login_server': d['login_server'],
+ 'id': d['id'],
+ 'tags': d.get('tags', None),
+ 'credentials': credentials
+ }
+ return d
+
+
+def main():
+ AzureRMContainerRegistryInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_facts.py
new file mode 100644
index 00000000..4d77116f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_facts.py
@@ -0,0 +1,520 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_cosmosdbaccount_info
+short_description: Get Azure Cosmos DB Account facts
+description:
+ - Get facts of Azure Cosmos DB Account.
+
+options:
+ resource_group:
+ description:
+ - Name of an Azure resource group.
+ name:
+ description:
+ - Cosmos DB database account name.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ retrieve_keys:
+ description:
+ - Retrieve keys and connection strings.
+ type: str
+ choices:
+ - all
+ - readonly
+ retrieve_connection_strings:
+ description:
+ - Retrieve connection strings.
+ type: bool
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Database Account
+ community.azure.azure_rm_cosmosdbaccount_info:
+ resource_group: myResourceGroup
+ name: testaccount
+
+ - name: List instances of Database Account
+ azure_rm_cosmosdbaccousnt_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+accounts:
+ description: A list of dictionaries containing facts for Database Account.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The unique resource identifier of the database account.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DocumentDB/databaseAccount
+ s/testaccount"
+ resource_group:
+ description:
+ - Name of an Azure resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - The name of the database account.
+ returned: always
+ type: str
+ sample: testaccount
+ location:
+ description:
+ - The location of the resource group to which the resource belongs.
+ returned: always
+ type: str
+ sample: westus
+ kind:
+ description:
+ - Indicates the type of database account.
+ returned: always
+ type: str
+ sample: global_document_db
+ consistency_policy:
+ description:
+ - Consistency policy.
+ returned: always
+ type: complex
+ contains:
+ default_consistency_level:
+ description:
+ - Default consistency level.
+ returned: always
+ type: str
+ sample: session
+ max_interval_in_seconds:
+ description:
+ - Maximum interval in seconds.
+ returned: always
+ type: int
+ sample: 5
+ max_staleness_prefix:
+ description:
+ - Maximum staleness prefix.
+ returned: always
+ type: int
+ sample: 100
+ failover_policies:
+ description:
+ - The list of new failover policies for the failover priority change.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - Location name.
+ returned: always
+ type: str
+ sample: eastus
+ failover_priority:
+ description:
+ - Failover priority.
+ returned: always
+ type: int
+ sample: 0
+ id:
+ description:
+ - Read location ID.
+ returned: always
+ type: str
+ sample: testaccount-eastus
+ read_locations:
+ description:
+ - Read locations.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - Location name.
+ returned: always
+ type: str
+ sample: eastus
+ failover_priority:
+ description:
+ - Failover priority.
+ returned: always
+ type: int
+ sample: 0
+ id:
+ description:
+ - Read location ID.
+ returned: always
+ type: str
+ sample: testaccount-eastus
+ document_endpoint:
+ description:
+ - Document endpoint.
+ returned: always
+ type: str
+ sample: https://testaccount-eastus.documents.azure.com:443/
+ provisioning_state:
+ description:
+ - Provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+ write_locations:
+ description:
+ - Write locations.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - Location name.
+ returned: always
+ type: str
+ sample: eastus
+ failover_priority:
+ description:
+ - Failover priority.
+ returned: always
+ type: int
+ sample: 0
+ id:
+ description:
+ - Read location ID.
+ returned: always
+ type: str
+ sample: testaccount-eastus
+ document_endpoint:
+ description:
+ - Document endpoint.
+ returned: always
+ type: str
+ sample: https://testaccount-eastus.documents.azure.com:443/
+ provisioning_state:
+ description:
+ - Provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+ database_account_offer_type:
+ description:
+ - Offer type.
+ returned: always
+ type: str
+ sample: Standard
+ ip_range_filter:
+ description:
+ - Enable IP range filter.
+ returned: always
+ type: str
+ sample: 10.10.10.10
+ is_virtual_network_filter_enabled:
+ description:
+ - Enable virtual network filter.
+ returned: always
+ type: bool
+ sample: true
+ enable_automatic_failover:
+ description:
+ - Enable automatic failover.
+ returned: always
+ type: bool
+ sample: true
+ enable_cassandra:
+ description:
+ - Enable Cassandra.
+ returned: always
+ type: bool
+ sample: true
+ enable_table:
+ description:
+ - Enable Table.
+ returned: always
+ type: bool
+ sample: true
+ enable_gremlin:
+ description:
+ - Enable Gremlin.
+ returned: always
+ type: bool
+ sample: true
+ virtual_network_rules:
+ description:
+ - List of Virtual Network ACL rules configured for the Cosmos DB account.
+ type: list
+ contains:
+ subnet:
+ description:
+ - Resource id of a subnet.
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNet
+ works/testvnet/subnets/testsubnet1"
+ ignore_missing_vnet_service_endpoint:
+ description:
+ - Create Cosmos DB account without existing virtual network service endpoint.
+ type: bool
+ enable_multiple_write_locations:
+ description:
+ - Enable multiple write locations.
+ returned: always
+ type: bool
+ sample: true
+ document_endpoint:
+ description:
+ - Document endpoint.
+ returned: always
+ type: str
+ sample: https://testaccount.documents.azure.com:443/
+ provisioning_state:
+ description:
+ - Provisioning state of Cosmos DB.
+ returned: always
+ type: str
+ sample: Succeeded
+ primary_master_key:
+ description:
+ - Primary master key.
+ returned: when requested
+ type: str
+ sample: UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw==
+ secondary_master_key:
+ description:
+ - Primary master key.
+ returned: when requested
+ type: str
+ sample: UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw==
+ primary_readonly_master_key:
+ description:
+ - Primary master key.
+ returned: when requested
+ type: str
+ sample: UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw==
+ secondary_readonly_master_key:
+ description:
+ - Primary master key.
+ returned: when requested
+ type: str
+ sample: UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw==
+ connection_strings:
+ description:
+ - List of connection strings.
+ type: list
+ returned: when requested
+ contains:
+ connection_string:
+ description:
+ - Description of connection string.
+ type: str
+ returned: always
+ sample: Primary SQL Connection String
+ description:
+ description:
+ - Connection string.
+ type: str
+ returned: always
+ sample: "AccountEndpoint=https://testaccount.documents.azure.com:443/;AccountKey=fSEjathnk6ZeBTrXkud9j5kfhtSEQ
+ q3dpJxJga76h9BZkK2BJJrDzSO6DDn6yKads017OZBZ1YZWyq1cW4iuvA=="
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of "string":"string" pairs.
+ returned: always
+ type: dict
+ sample: { "tag1":"abc" }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.cosmosdb import CosmosDB
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMCosmosDBAccountInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ ),
+ retrieve_keys=dict(
+ type='str',
+ choices=['all', 'readonly']
+ ),
+ retrieve_connection_strings=dict(
+ type='bool'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ self.retrieve_keys = None
+ self.retrieve_connection_strings = None
+
+ super(AzureRMCosmosDBAccountInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_cosmosdbaccount_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_cosmosdbaccount_facts' module has been renamed to 'azure_rm_cosmosdbaccount_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(CosmosDB,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['accounts'] = self.get()
+ elif self.resource_group is not None:
+ self.results['accounts'] = self.list_all()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.database_accounts.get(resource_group_name=self.resource_group,
+ account_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Database Account.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.database_accounts.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Database Account.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def list_all(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.database_accounts.list()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Database Account.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id'),
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'name': d.get('name', None),
+ 'location': d.get('location', '').replace(' ', '').lower(),
+ 'kind': _camel_to_snake(d.get('kind', None)),
+ 'consistency_policy': {'default_consistency_level': _camel_to_snake(d['consistency_policy']['default_consistency_level']),
+ 'max_interval_in_seconds': d['consistency_policy']['max_interval_in_seconds'],
+ 'max_staleness_prefix': d['consistency_policy']['max_staleness_prefix']},
+ 'failover_policies': [{'name': fp['location_name'].replace(' ', '').lower(),
+ 'failover_priority': fp['failover_priority'],
+ 'id': fp['id']} for fp in d['failover_policies']],
+ 'read_locations': [{'name': rl['location_name'].replace(' ', '').lower(),
+ 'failover_priority': rl['failover_priority'],
+ 'id': rl['id'],
+ 'document_endpoint': rl['document_endpoint'],
+ 'provisioning_state': rl['provisioning_state']} for rl in d['read_locations']],
+ 'write_locations': [{'name': wl['location_name'].replace(' ', '').lower(),
+ 'failover_priority': wl['failover_priority'],
+ 'id': wl['id'],
+ 'document_endpoint': wl['document_endpoint'],
+ 'provisioning_state': wl['provisioning_state']} for wl in d['write_locations']],
+ 'database_account_offer_type': d.get('database_account_offer_type'),
+ 'ip_range_filter': d['ip_range_filter'],
+ 'is_virtual_network_filter_enabled': d.get('is_virtual_network_filter_enabled'),
+ 'enable_automatic_failover': d.get('enable_automatic_failover'),
+ 'enable_cassandra': 'EnableCassandra' in d.get('capabilities', []),
+ 'enable_table': 'EnableTable' in d.get('capabilities', []),
+ 'enable_gremlin': 'EnableGremlin' in d.get('capabilities', []),
+ 'virtual_network_rules': d.get('virtual_network_rules'),
+ 'enable_multiple_write_locations': d.get('enable_multiple_write_locations'),
+ 'document_endpoint': d.get('document_endpoint'),
+ 'provisioning_state': d.get('provisioning_state'),
+ 'tags': d.get('tags', None)
+ }
+
+ if self.retrieve_keys == 'all':
+ keys = self.mgmt_client.database_accounts.list_keys(resource_group_name=self.resource_group,
+ account_name=self.name)
+ d['primary_master_key'] = keys.primary_master_key
+ d['secondary_master_key'] = keys.secondary_master_key
+ d['primary_readonly_master_key'] = keys.primary_readonly_master_key
+ d['secondary_readonly_master_key'] = keys.secondary_readonly_master_key
+ elif self.retrieve_keys == 'readonly':
+ keys = self.mgmt_client.database_accounts.get_read_only_keys(resource_group_name=self.resource_group,
+ account_name=self.name)
+ d['primary_readonly_master_key'] = keys.primary_readonly_master_key
+ d['secondary_readonly_master_key'] = keys.secondary_readonly_master_key
+ if self.retrieve_connection_strings:
+ connection_strings = self.mgmt_client.database_accounts.list_connection_strings(resource_group_name=self.resource_group,
+ account_name=self.name)
+ d['connection_strings'] = connection_strings.as_dict()
+ return d
+
+
+def main():
+ AzureRMCosmosDBAccountInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_info.py
new file mode 100644
index 00000000..4d77116f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_cosmosdbaccount_info.py
@@ -0,0 +1,520 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_cosmosdbaccount_info
+short_description: Get Azure Cosmos DB Account facts
+description:
+ - Get facts of Azure Cosmos DB Account.
+
+options:
+ resource_group:
+ description:
+ - Name of an Azure resource group.
+ name:
+ description:
+ - Cosmos DB database account name.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ retrieve_keys:
+ description:
+ - Retrieve keys and connection strings.
+ type: str
+ choices:
+ - all
+ - readonly
+ retrieve_connection_strings:
+ description:
+ - Retrieve connection strings.
+ type: bool
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Database Account
+ community.azure.azure_rm_cosmosdbaccount_info:
+ resource_group: myResourceGroup
+ name: testaccount
+
+ - name: List instances of Database Account
+ azure_rm_cosmosdbaccousnt_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+accounts:
+ description: A list of dictionaries containing facts for Database Account.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The unique resource identifier of the database account.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DocumentDB/databaseAccount
+ s/testaccount"
+ resource_group:
+ description:
+ - Name of an Azure resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - The name of the database account.
+ returned: always
+ type: str
+ sample: testaccount
+ location:
+ description:
+ - The location of the resource group to which the resource belongs.
+ returned: always
+ type: str
+ sample: westus
+ kind:
+ description:
+ - Indicates the type of database account.
+ returned: always
+ type: str
+ sample: global_document_db
+ consistency_policy:
+ description:
+ - Consistency policy.
+ returned: always
+ type: complex
+ contains:
+ default_consistency_level:
+ description:
+ - Default consistency level.
+ returned: always
+ type: str
+ sample: session
+ max_interval_in_seconds:
+ description:
+ - Maximum interval in seconds.
+ returned: always
+ type: int
+ sample: 5
+ max_staleness_prefix:
+ description:
+ - Maximum staleness prefix.
+ returned: always
+ type: int
+ sample: 100
+ failover_policies:
+ description:
+ - The list of new failover policies for the failover priority change.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - Location name.
+ returned: always
+ type: str
+ sample: eastus
+ failover_priority:
+ description:
+ - Failover priority.
+ returned: always
+ type: int
+ sample: 0
+ id:
+ description:
+ - Read location ID.
+ returned: always
+ type: str
+ sample: testaccount-eastus
+ read_locations:
+ description:
+ - Read locations.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - Location name.
+ returned: always
+ type: str
+ sample: eastus
+ failover_priority:
+ description:
+ - Failover priority.
+ returned: always
+ type: int
+ sample: 0
+ id:
+ description:
+ - Read location ID.
+ returned: always
+ type: str
+ sample: testaccount-eastus
+ document_endpoint:
+ description:
+ - Document endpoint.
+ returned: always
+ type: str
+ sample: https://testaccount-eastus.documents.azure.com:443/
+ provisioning_state:
+ description:
+ - Provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+ write_locations:
+ description:
+ - Write locations.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - Location name.
+ returned: always
+ type: str
+ sample: eastus
+ failover_priority:
+ description:
+ - Failover priority.
+ returned: always
+ type: int
+ sample: 0
+ id:
+ description:
+ - Read location ID.
+ returned: always
+ type: str
+ sample: testaccount-eastus
+ document_endpoint:
+ description:
+ - Document endpoint.
+ returned: always
+ type: str
+ sample: https://testaccount-eastus.documents.azure.com:443/
+ provisioning_state:
+ description:
+ - Provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+ database_account_offer_type:
+ description:
+ - Offer type.
+ returned: always
+ type: str
+ sample: Standard
+ ip_range_filter:
+ description:
+ - Enable IP range filter.
+ returned: always
+ type: str
+ sample: 10.10.10.10
+ is_virtual_network_filter_enabled:
+ description:
+ - Enable virtual network filter.
+ returned: always
+ type: bool
+ sample: true
+ enable_automatic_failover:
+ description:
+ - Enable automatic failover.
+ returned: always
+ type: bool
+ sample: true
+ enable_cassandra:
+ description:
+ - Enable Cassandra.
+ returned: always
+ type: bool
+ sample: true
+ enable_table:
+ description:
+ - Enable Table.
+ returned: always
+ type: bool
+ sample: true
+ enable_gremlin:
+ description:
+ - Enable Gremlin.
+ returned: always
+ type: bool
+ sample: true
+ virtual_network_rules:
+ description:
+ - List of Virtual Network ACL rules configured for the Cosmos DB account.
+ type: list
+ contains:
+ subnet:
+ description:
+ - Resource id of a subnet.
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNet
+ works/testvnet/subnets/testsubnet1"
+ ignore_missing_vnet_service_endpoint:
+ description:
+ - Create Cosmos DB account without existing virtual network service endpoint.
+ type: bool
+ enable_multiple_write_locations:
+ description:
+ - Enable multiple write locations.
+ returned: always
+ type: bool
+ sample: true
+ document_endpoint:
+ description:
+ - Document endpoint.
+ returned: always
+ type: str
+ sample: https://testaccount.documents.azure.com:443/
+ provisioning_state:
+ description:
+ - Provisioning state of Cosmos DB.
+ returned: always
+ type: str
+ sample: Succeeded
+ primary_master_key:
+ description:
+ - Primary master key.
+ returned: when requested
+ type: str
+ sample: UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw==
+ secondary_master_key:
+ description:
+ - Primary master key.
+ returned: when requested
+ type: str
+ sample: UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw==
+ primary_readonly_master_key:
+ description:
+ - Primary master key.
+ returned: when requested
+ type: str
+ sample: UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw==
+ secondary_readonly_master_key:
+ description:
+ - Primary master key.
+ returned: when requested
+ type: str
+ sample: UIWoYD4YaD4LxW6k3Jy69qcHDMLX4aSttECQkEcwWF1RflLd6crWSGJs0R9kJwujehtfLGeQx4ISVSJfTpJkYw==
+ connection_strings:
+ description:
+ - List of connection strings.
+ type: list
+ returned: when requested
+ contains:
+ connection_string:
+ description:
+ - Description of connection string.
+ type: str
+ returned: always
+ sample: Primary SQL Connection String
+ description:
+ description:
+ - Connection string.
+ type: str
+ returned: always
+ sample: "AccountEndpoint=https://testaccount.documents.azure.com:443/;AccountKey=fSEjathnk6ZeBTrXkud9j5kfhtSEQ
+ q3dpJxJga76h9BZkK2BJJrDzSO6DDn6yKads017OZBZ1YZWyq1cW4iuvA=="
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of "string":"string" pairs.
+ returned: always
+ type: dict
+ sample: { "tag1":"abc" }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.cosmosdb import CosmosDB
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMCosmosDBAccountInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ ),
+ retrieve_keys=dict(
+ type='str',
+ choices=['all', 'readonly']
+ ),
+ retrieve_connection_strings=dict(
+ type='bool'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ self.retrieve_keys = None
+ self.retrieve_connection_strings = None
+
+ super(AzureRMCosmosDBAccountInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_cosmosdbaccount_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_cosmosdbaccount_facts' module has been renamed to 'azure_rm_cosmosdbaccount_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(CosmosDB,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['accounts'] = self.get()
+ elif self.resource_group is not None:
+ self.results['accounts'] = self.list_all()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.database_accounts.get(resource_group_name=self.resource_group,
+ account_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Database Account.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.database_accounts.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Database Account.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def list_all(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.database_accounts.list()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Database Account.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id'),
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'name': d.get('name', None),
+ 'location': d.get('location', '').replace(' ', '').lower(),
+ 'kind': _camel_to_snake(d.get('kind', None)),
+ 'consistency_policy': {'default_consistency_level': _camel_to_snake(d['consistency_policy']['default_consistency_level']),
+ 'max_interval_in_seconds': d['consistency_policy']['max_interval_in_seconds'],
+ 'max_staleness_prefix': d['consistency_policy']['max_staleness_prefix']},
+ 'failover_policies': [{'name': fp['location_name'].replace(' ', '').lower(),
+ 'failover_priority': fp['failover_priority'],
+ 'id': fp['id']} for fp in d['failover_policies']],
+ 'read_locations': [{'name': rl['location_name'].replace(' ', '').lower(),
+ 'failover_priority': rl['failover_priority'],
+ 'id': rl['id'],
+ 'document_endpoint': rl['document_endpoint'],
+ 'provisioning_state': rl['provisioning_state']} for rl in d['read_locations']],
+ 'write_locations': [{'name': wl['location_name'].replace(' ', '').lower(),
+ 'failover_priority': wl['failover_priority'],
+ 'id': wl['id'],
+ 'document_endpoint': wl['document_endpoint'],
+ 'provisioning_state': wl['provisioning_state']} for wl in d['write_locations']],
+ 'database_account_offer_type': d.get('database_account_offer_type'),
+ 'ip_range_filter': d['ip_range_filter'],
+ 'is_virtual_network_filter_enabled': d.get('is_virtual_network_filter_enabled'),
+ 'enable_automatic_failover': d.get('enable_automatic_failover'),
+ 'enable_cassandra': 'EnableCassandra' in d.get('capabilities', []),
+ 'enable_table': 'EnableTable' in d.get('capabilities', []),
+ 'enable_gremlin': 'EnableGremlin' in d.get('capabilities', []),
+ 'virtual_network_rules': d.get('virtual_network_rules'),
+ 'enable_multiple_write_locations': d.get('enable_multiple_write_locations'),
+ 'document_endpoint': d.get('document_endpoint'),
+ 'provisioning_state': d.get('provisioning_state'),
+ 'tags': d.get('tags', None)
+ }
+
+ if self.retrieve_keys == 'all':
+ keys = self.mgmt_client.database_accounts.list_keys(resource_group_name=self.resource_group,
+ account_name=self.name)
+ d['primary_master_key'] = keys.primary_master_key
+ d['secondary_master_key'] = keys.secondary_master_key
+ d['primary_readonly_master_key'] = keys.primary_readonly_master_key
+ d['secondary_readonly_master_key'] = keys.secondary_readonly_master_key
+ elif self.retrieve_keys == 'readonly':
+ keys = self.mgmt_client.database_accounts.get_read_only_keys(resource_group_name=self.resource_group,
+ account_name=self.name)
+ d['primary_readonly_master_key'] = keys.primary_readonly_master_key
+ d['secondary_readonly_master_key'] = keys.secondary_readonly_master_key
+ if self.retrieve_connection_strings:
+ connection_strings = self.mgmt_client.database_accounts.list_connection_strings(resource_group_name=self.resource_group,
+ account_name=self.name)
+ d['connection_strings'] = connection_strings.as_dict()
+ return d
+
+
+def main():
+ AzureRMCosmosDBAccountInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_deployment_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_deployment_facts.py
new file mode 100644
index 00000000..61ccdd7a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_deployment_facts.py
@@ -0,0 +1,249 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_deployment_info
+short_description: Get Azure Deployment facts
+description:
+ - Get facts of Azure Deployment.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ name:
+ description:
+ - The name of the deployment.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Deployment
+ community.azure.azure_rm_deployment_info:
+ resource_group: myResourceGroup
+ name: myDeployment
+'''
+
+RETURN = '''
+deployments:
+ description:
+ - A list of dictionaries containing facts for deployments.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the resource.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Resources/deployments/myDeployment"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ sample: myResourceGroup
+ name:
+ description:
+ - Deployment name.
+ returned: always
+ sample: myDeployment
+ provisioning_state:
+ description:
+ - Provisioning state of the deployment.
+ returned: always
+ sample: Succeeded
+ template_link:
+ description:
+ - Link to the template.
+ returned: always
+ sample: "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/d01a5c06f4f1bc03a049ca17bbbd6e06d62657b3/101-vm-simple-linux/
+ azuredeploy.json"
+ parameters:
+ description:
+ - Dictionary containing deployment parameters.
+ returned: always
+ type: complex
+ outputs:
+ description:
+ - Dictionary containing deployment outputs.
+ returned: always
+ output_resources:
+ description:
+ - List of resources.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkI
+ nterfaces/myNetworkInterface"
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myNetworkInterface
+ type:
+ description:
+ - Resource type.
+ returned: always
+ type: str
+ sample: Microsoft.Network/networkInterfaces
+ depends_on:
+ description:
+ - List of resource ids.
+ type: list
+ returned: always
+ sample:
+ - "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGropup/providers/Microsoft.Network/virtualNet
+ works/myVirtualNetwork"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDeploymentInfo(AzureRMModuleBase):
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+
+ super(AzureRMDeploymentInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_deployment_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_deployment_facts' module has been renamed to 'azure_rm_deployment_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ self.results['deployments'] = self.get()
+ else:
+ self.results['deployments'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.rm_client.deployments.get(self.resource_group, deployment_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Deployment.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.rm_client.deployments.list(self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Deployment.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ output_resources = {}
+ for dependency in d.get('properties', {}).get('dependencies'):
+ # go through dependent resources
+ depends_on = []
+ for depends_on_resource in dependency['depends_on']:
+ depends_on.append(depends_on_resource['id'])
+ # append if not in list
+ if not output_resources.get(depends_on_resource['id']):
+ sub_resource = {
+ 'id': depends_on_resource['id'],
+ 'name': depends_on_resource['resource_name'],
+ 'type': depends_on_resource['resource_type'],
+ 'depends_on': []
+ }
+ output_resources[depends_on_resource['id']] = sub_resource
+ resource = {
+ 'id': dependency['id'],
+ 'name': dependency['resource_name'],
+ 'type': dependency['resource_type'],
+ 'depends_on': depends_on
+ }
+ output_resources[dependency['id']] = resource
+
+ # convert dictionary to list
+ output_resources_list = []
+ for r in output_resources:
+ output_resources_list.append(output_resources[r])
+
+ d = {
+ 'id': d.get('id'),
+ 'resource_group': self.resource_group,
+ 'name': d.get('name'),
+ 'provisioning_state': d.get('properties', {}).get('provisioning_state'),
+ 'parameters': d.get('properties', {}).get('parameters'),
+ 'outputs': d.get('properties', {}).get('outputs'),
+ 'output_resources': output_resources_list,
+ 'template_link': d.get('properties', {}).get('template_link').get('uri')
+ }
+ return d
+
+
+def main():
+ AzureRMDeploymentInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_deployment_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_deployment_info.py
new file mode 100644
index 00000000..61ccdd7a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_deployment_info.py
@@ -0,0 +1,249 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_deployment_info
+short_description: Get Azure Deployment facts
+description:
+ - Get facts of Azure Deployment.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ name:
+ description:
+ - The name of the deployment.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Deployment
+ community.azure.azure_rm_deployment_info:
+ resource_group: myResourceGroup
+ name: myDeployment
+'''
+
+RETURN = '''
+deployments:
+ description:
+ - A list of dictionaries containing facts for deployments.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the resource.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Resources/deployments/myDeployment"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ sample: myResourceGroup
+ name:
+ description:
+ - Deployment name.
+ returned: always
+ sample: myDeployment
+ provisioning_state:
+ description:
+ - Provisioning state of the deployment.
+ returned: always
+ sample: Succeeded
+ template_link:
+ description:
+ - Link to the template.
+ returned: always
+ sample: "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/d01a5c06f4f1bc03a049ca17bbbd6e06d62657b3/101-vm-simple-linux/
+ azuredeploy.json"
+ parameters:
+ description:
+ - Dictionary containing deployment parameters.
+ returned: always
+ type: complex
+ outputs:
+ description:
+ - Dictionary containing deployment outputs.
+ returned: always
+ output_resources:
+ description:
+ - List of resources.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkI
+ nterfaces/myNetworkInterface"
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myNetworkInterface
+ type:
+ description:
+ - Resource type.
+ returned: always
+ type: str
+ sample: Microsoft.Network/networkInterfaces
+ depends_on:
+ description:
+ - List of resource ids.
+ type: list
+ returned: always
+ sample:
+ - "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGropup/providers/Microsoft.Network/virtualNet
+ works/myVirtualNetwork"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDeploymentInfo(AzureRMModuleBase):
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+
+ super(AzureRMDeploymentInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_deployment_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_deployment_facts' module has been renamed to 'azure_rm_deployment_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ self.results['deployments'] = self.get()
+ else:
+ self.results['deployments'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.rm_client.deployments.get(self.resource_group, deployment_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Deployment.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.rm_client.deployments.list(self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Deployment.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ output_resources = {}
+ for dependency in d.get('properties', {}).get('dependencies'):
+ # go through dependent resources
+ depends_on = []
+ for depends_on_resource in dependency['depends_on']:
+ depends_on.append(depends_on_resource['id'])
+ # append if not in list
+ if not output_resources.get(depends_on_resource['id']):
+ sub_resource = {
+ 'id': depends_on_resource['id'],
+ 'name': depends_on_resource['resource_name'],
+ 'type': depends_on_resource['resource_type'],
+ 'depends_on': []
+ }
+ output_resources[depends_on_resource['id']] = sub_resource
+ resource = {
+ 'id': dependency['id'],
+ 'name': dependency['resource_name'],
+ 'type': dependency['resource_type'],
+ 'depends_on': depends_on
+ }
+ output_resources[dependency['id']] = resource
+
+ # convert dictionary to list
+ output_resources_list = []
+ for r in output_resources:
+ output_resources_list.append(output_resources[r])
+
+ d = {
+ 'id': d.get('id'),
+ 'resource_group': self.resource_group,
+ 'name': d.get('name'),
+ 'provisioning_state': d.get('properties', {}).get('provisioning_state'),
+ 'parameters': d.get('properties', {}).get('parameters'),
+ 'outputs': d.get('properties', {}).get('outputs'),
+ 'output_resources': output_resources_list,
+ 'template_link': d.get('properties', {}).get('template_link').get('uri')
+ }
+ return d
+
+
+def main():
+ AzureRMDeploymentInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlab_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlab_facts.py
new file mode 100644
index 00000000..b0c6bcb7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlab_facts.py
@@ -0,0 +1,272 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlab_info
+short_description: Get Azure DevTest Lab facts
+description:
+ - Get facts of Azure DevTest Lab.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ type: str
+ name:
+ description:
+ - The name of the lab.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+'''
+
+EXAMPLES = '''
+ - name: List instances of DevTest Lab by resource group
+ community.azure.azure_rm_devtestlab_info:
+ resource_group: testrg
+
+ - name: List instances of DevTest Lab in subscription
+ community.azure.azure_rm_devtestlab_info:
+
+ - name: Get instance of DevTest Lab
+ community.azure.azure_rm_devtestlab_info:
+ resource_group: testrg
+ name: testlab
+'''
+
+RETURN = '''
+labs:
+ description:
+ - A list of dictionaries containing facts for Lab.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the resource.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab
+ resource_group:
+ description:
+ - The name of the resource.
+ returned: always
+ type: str
+ sample: testrg
+ name:
+ description:
+ - The name of the resource.
+ returned: always
+ type: str
+ sample: testlab
+ location:
+ description:
+ - The location of the resource.
+ returned: always
+ type: str
+ sample: eastus
+ storage_type:
+ description:
+ - Lab storage type.
+ returned: always
+ type: str
+ sample: standard
+ premium_data_disks:
+ description:
+ - Are premium data disks allowed.
+ returned: always
+ type: bool
+ sample: false
+ provisioning_state:
+ description:
+ - Lab provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+ artifacts_storage_account:
+ description:
+ - Artifacts storage account ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346
+ default_premium_storage_account:
+ description:
+ - Default premium storage account ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346
+ default_storage_account:
+ description:
+ - Default storage account ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346
+ premium_data_disk_storage_account:
+ description:
+ - Default storage account ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346
+ vault_name:
+ description:
+ - Key vault ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myLab6788
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDevTestLabInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDevTestLabInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlab_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlab_facts' module has been renamed to 'azure_rm_devtestlab_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.resource_group is not None:
+ if self.name is not None:
+ self.results['labs'] = self.get()
+ else:
+ self.results['labs'] = self.list_by_resource_group()
+ else:
+ self.results['labs'] = self.list_by_subscription()
+ return self.results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.labs.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Lab.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def list_by_subscription(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.labs.list_by_subscription()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Lab.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.labs.get(resource_group_name=self.resource_group,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Lab.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id', None),
+ 'resource_group': self.resource_group,
+ 'name': d.get('name', None),
+ 'location': d.get('location', '').replace(' ', '').lower(),
+ 'storage_type': d.get('lab_storage_type', '').lower(),
+ 'premium_data_disks': d.get('premium_data_disks') == 'Enabled',
+ 'provisioning_state': d.get('provisioning_state'),
+ 'artifacts_storage_account': d.get('artifacts_storage_account'),
+ 'default_premium_storage_account': d.get('default_premium_storage_account'),
+ 'default_storage_account': d.get('default_storage_account'),
+ 'premium_data_disk_storage_account': d.get('premium_data_disk_storage_account'),
+ 'vault_name': d.get('vault_name'),
+ 'tags': d.get('tags', None)
+ }
+ return d
+
+
+def main():
+ AzureRMDevTestLabInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlab_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlab_info.py
new file mode 100644
index 00000000..b0c6bcb7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlab_info.py
@@ -0,0 +1,272 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlab_info
+short_description: Get Azure DevTest Lab facts
+description:
+ - Get facts of Azure DevTest Lab.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ type: str
+ name:
+ description:
+ - The name of the lab.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+'''
+
+EXAMPLES = '''
+ - name: List instances of DevTest Lab by resource group
+ community.azure.azure_rm_devtestlab_info:
+ resource_group: testrg
+
+ - name: List instances of DevTest Lab in subscription
+ community.azure.azure_rm_devtestlab_info:
+
+ - name: Get instance of DevTest Lab
+ community.azure.azure_rm_devtestlab_info:
+ resource_group: testrg
+ name: testlab
+'''
+
+RETURN = '''
+labs:
+ description:
+ - A list of dictionaries containing facts for Lab.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the resource.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab
+ resource_group:
+ description:
+ - The name of the resource.
+ returned: always
+ type: str
+ sample: testrg
+ name:
+ description:
+ - The name of the resource.
+ returned: always
+ type: str
+ sample: testlab
+ location:
+ description:
+ - The location of the resource.
+ returned: always
+ type: str
+ sample: eastus
+ storage_type:
+ description:
+ - Lab storage type.
+ returned: always
+ type: str
+ sample: standard
+ premium_data_disks:
+ description:
+ - Are premium data disks allowed.
+ returned: always
+ type: bool
+ sample: false
+ provisioning_state:
+ description:
+ - Lab provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+ artifacts_storage_account:
+ description:
+ - Artifacts storage account ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346
+ default_premium_storage_account:
+ description:
+ - Default premium storage account ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346
+ default_storage_account:
+ description:
+ - Default storage account ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346
+ premium_data_disk_storage_account:
+ description:
+ - Default storage account ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myLab6346
+ vault_name:
+ description:
+ - Key vault ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myLab6788
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDevTestLabInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDevTestLabInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlab_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlab_facts' module has been renamed to 'azure_rm_devtestlab_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.resource_group is not None:
+ if self.name is not None:
+ self.results['labs'] = self.get()
+ else:
+ self.results['labs'] = self.list_by_resource_group()
+ else:
+ self.results['labs'] = self.list_by_subscription()
+ return self.results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.labs.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Lab.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def list_by_subscription(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.labs.list_by_subscription()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Lab.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.labs.get(resource_group_name=self.resource_group,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Lab.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id', None),
+ 'resource_group': self.resource_group,
+ 'name': d.get('name', None),
+ 'location': d.get('location', '').replace(' ', '').lower(),
+ 'storage_type': d.get('lab_storage_type', '').lower(),
+ 'premium_data_disks': d.get('premium_data_disks') == 'Enabled',
+ 'provisioning_state': d.get('provisioning_state'),
+ 'artifacts_storage_account': d.get('artifacts_storage_account'),
+ 'default_premium_storage_account': d.get('default_premium_storage_account'),
+ 'default_storage_account': d.get('default_storage_account'),
+ 'premium_data_disk_storage_account': d.get('premium_data_disk_storage_account'),
+ 'vault_name': d.get('vault_name'),
+ 'tags': d.get('tags', None)
+ }
+ return d
+
+
+def main():
+ AzureRMDevTestLabInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabarmtemplate_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabarmtemplate_facts.py
new file mode 100644
index 00000000..b5efdb60
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabarmtemplate_facts.py
@@ -0,0 +1,226 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabarmtemplate_info
+short_description: Get Azure DevTest Lab ARM Template facts
+description:
+ - Get facts of Azure DevTest Lab ARM Template.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ artifact_source_name:
+ description:
+ - The name of the artifact source.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the ARM template.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get information on DevTest Lab ARM Template
+ community.azure.azure_rm_devtestlabarmtemplate_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ artifact_source_name: public environment repo
+ name: WebApp
+'''
+
+RETURN = '''
+arm_templates:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab ARM Template.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the resource.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/art
+ ifactSources/public environment repo/armTemplates/WebApp"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - DevTest Lab name.
+ returned: always
+ sample: myLab
+ artifact_source_name:
+ description:
+ - Artifact source name.
+ returned: always
+ sample: public environment repo
+ name:
+ description:
+ - ARM Template name.
+ returned: always
+ sample: WebApp
+ display_name:
+ description:
+ - The tags of the resource.
+ returned: always
+ sample: Web App
+ description:
+ description:
+ - The tags of the resource.
+ returned: always
+ sample: This template creates an Azure Web App without a data store.
+ publisher:
+ description:
+ - The tags of the resource.
+ returned: always
+ sample: Microsoft
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlArmTemplateInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ artifact_source_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.artifact_source_name = None
+ self.name = None
+ super(AzureRMDtlArmTemplateInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabarmtemplate_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabarmtemplate_facts' module has been renamed to 'azure_rm_devtestlabarmtemplate_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['armtemplates'] = self.get()
+ else:
+ self.results['armtemplates'] = self.list()
+
+ return self.results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.arm_templates.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ artifact_source_name=self.artifact_source_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for DTL ARM Template.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.arm_templates.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ artifact_source_name=self.artifact_source_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for DTL ARM Template.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'lab_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'artifact_source_name': self.parse_resource_to_dict(d.get('id')).get('child_name_1'),
+ 'id': d.get('id', None),
+ 'name': d.get('name'),
+ 'display_name': d.get('display_name'),
+ 'description': d.get('description'),
+ 'publisher': d.get('publisher')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlArmTemplateInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabarmtemplate_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabarmtemplate_info.py
new file mode 100644
index 00000000..b5efdb60
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabarmtemplate_info.py
@@ -0,0 +1,226 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabarmtemplate_info
+short_description: Get Azure DevTest Lab ARM Template facts
+description:
+ - Get facts of Azure DevTest Lab ARM Template.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ artifact_source_name:
+ description:
+ - The name of the artifact source.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the ARM template.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get information on DevTest Lab ARM Template
+ community.azure.azure_rm_devtestlabarmtemplate_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ artifact_source_name: public environment repo
+ name: WebApp
+'''
+
+RETURN = '''
+arm_templates:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab ARM Template.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the resource.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/art
+ ifactSources/public environment repo/armTemplates/WebApp"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - DevTest Lab name.
+ returned: always
+ sample: myLab
+ artifact_source_name:
+ description:
+ - Artifact source name.
+ returned: always
+ sample: public environment repo
+ name:
+ description:
+ - ARM Template name.
+ returned: always
+ sample: WebApp
+ display_name:
+ description:
+ - The tags of the resource.
+ returned: always
+ sample: Web App
+ description:
+ description:
+ - The tags of the resource.
+ returned: always
+ sample: This template creates an Azure Web App without a data store.
+ publisher:
+ description:
+ - The tags of the resource.
+ returned: always
+ sample: Microsoft
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlArmTemplateInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ artifact_source_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.artifact_source_name = None
+ self.name = None
+ super(AzureRMDtlArmTemplateInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabarmtemplate_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabarmtemplate_facts' module has been renamed to 'azure_rm_devtestlabarmtemplate_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['armtemplates'] = self.get()
+ else:
+ self.results['armtemplates'] = self.list()
+
+ return self.results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.arm_templates.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ artifact_source_name=self.artifact_source_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for DTL ARM Template.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.arm_templates.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ artifact_source_name=self.artifact_source_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for DTL ARM Template.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'lab_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'artifact_source_name': self.parse_resource_to_dict(d.get('id')).get('child_name_1'),
+ 'id': d.get('id', None),
+ 'name': d.get('name'),
+ 'display_name': d.get('display_name'),
+ 'description': d.get('description'),
+ 'publisher': d.get('publisher')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlArmTemplateInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifact_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifact_facts.py
new file mode 100644
index 00000000..09611d13
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifact_facts.py
@@ -0,0 +1,250 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabartifact_info
+short_description: Get Azure DevTest Lab Artifact facts
+description:
+ - Get facts of Azure DevTest Lab Artifact.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ artifact_source_name:
+ description:
+ - The name of the artifact source.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the artifact.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of DevTest Lab Artifact
+ community.azure.azure_rm_devtestlabartifact_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ artifact_source_name: myArtifactSource
+ name: myArtifact
+'''
+
+RETURN = '''
+artifacts:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab Artifact.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/ar
+ tifactSources/myArtifactSource/artifacts/myArtifact"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ artifact_source_name:
+ description:
+ - The name of the artifact source.
+ returned: always
+ type: str
+ sample: myArtifactSource
+ name:
+ description:
+ - The name of the artifact.
+ returned: always
+ type: str
+ sample: myArtifact
+ description:
+ description:
+ - Description of the artifact.
+ returned: always
+ type: str
+ sample: Installs My Software
+ file_path:
+ description:
+ - Artifact's path in the repo.
+ returned: always
+ type: str
+ sample: Artifacts/myArtifact
+ publisher:
+ description:
+ - Publisher name.
+ returned: always
+ type: str
+ sample: MyPublisher
+ target_os_type:
+ description:
+ - Target OS type.
+ returned: always
+ type: str
+ sample: Linux
+ title:
+ description:
+ - Title of the artifact.
+ returned: always
+ type: str
+ sample: My Software
+ parameters:
+ description:
+ - A dictionary containing parameters definition of the artifact.
+ returned: always
+ type: complex
+ sample: {}
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMArtifactInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ artifact_source_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.artifact_source_name = None
+ self.name = None
+ super(AzureRMArtifactInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['artifacts'] = self.get()
+ else:
+ self.results['artifacts'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.artifacts.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ artifact_source_name=self.artifact_source_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Artifact.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.artifacts.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ artifact_source_name=self.artifact_source_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Artifact.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'lab_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'artifact_source_name': self.parse_resource_to_dict(d.get('id')).get('child_name_1'),
+ 'id': d.get('id'),
+ 'description': d.get('description'),
+ 'file_path': d.get('file_path'),
+ 'name': d.get('name'),
+ 'parameters': d.get('parameters'),
+ 'publisher': d.get('publisher'),
+ 'target_os_type': d.get('target_os_type'),
+ 'title': d.get('title')
+ }
+ return d
+
+
+def main():
+ AzureRMArtifactInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifact_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifact_info.py
new file mode 100644
index 00000000..09611d13
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifact_info.py
@@ -0,0 +1,250 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabartifact_info
+short_description: Get Azure DevTest Lab Artifact facts
+description:
+ - Get facts of Azure DevTest Lab Artifact.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ artifact_source_name:
+ description:
+ - The name of the artifact source.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the artifact.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of DevTest Lab Artifact
+ community.azure.azure_rm_devtestlabartifact_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ artifact_source_name: myArtifactSource
+ name: myArtifact
+'''
+
+RETURN = '''
+artifacts:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab Artifact.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/ar
+ tifactSources/myArtifactSource/artifacts/myArtifact"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ artifact_source_name:
+ description:
+ - The name of the artifact source.
+ returned: always
+ type: str
+ sample: myArtifactSource
+ name:
+ description:
+ - The name of the artifact.
+ returned: always
+ type: str
+ sample: myArtifact
+ description:
+ description:
+ - Description of the artifact.
+ returned: always
+ type: str
+ sample: Installs My Software
+ file_path:
+ description:
+ - Artifact's path in the repo.
+ returned: always
+ type: str
+ sample: Artifacts/myArtifact
+ publisher:
+ description:
+ - Publisher name.
+ returned: always
+ type: str
+ sample: MyPublisher
+ target_os_type:
+ description:
+ - Target OS type.
+ returned: always
+ type: str
+ sample: Linux
+ title:
+ description:
+ - Title of the artifact.
+ returned: always
+ type: str
+ sample: My Software
+ parameters:
+ description:
+ - A dictionary containing parameters definition of the artifact.
+ returned: always
+ type: complex
+ sample: {}
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMArtifactInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ artifact_source_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.artifact_source_name = None
+ self.name = None
+ super(AzureRMArtifactInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['artifacts'] = self.get()
+ else:
+ self.results['artifacts'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.artifacts.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ artifact_source_name=self.artifact_source_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Artifact.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.artifacts.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ artifact_source_name=self.artifact_source_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Artifact.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'lab_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'artifact_source_name': self.parse_resource_to_dict(d.get('id')).get('child_name_1'),
+ 'id': d.get('id'),
+ 'description': d.get('description'),
+ 'file_path': d.get('file_path'),
+ 'name': d.get('name'),
+ 'parameters': d.get('parameters'),
+ 'publisher': d.get('publisher'),
+ 'target_os_type': d.get('target_os_type'),
+ 'title': d.get('title')
+ }
+ return d
+
+
+def main():
+ AzureRMArtifactInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifactsource_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifactsource_facts.py
new file mode 100644
index 00000000..283c699a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifactsource_facts.py
@@ -0,0 +1,258 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabartifactsource_info
+short_description: Get Azure DevTest Lab Artifact Source facts
+description:
+ - Get facts of Azure DevTest Lab Artifact Source.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of DevTest Lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of DevTest Lab Artifact Source.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of DevTest Lab Artifact Source
+ community.azure.azure_rm_devtestlabartifactsource_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myArtifactSource
+'''
+
+RETURN = '''
+artifactsources:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab Artifact Source.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/ar
+ tifactSources/myArtifactSource"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the artifact source.
+ returned: always
+ type: str
+ sample: myArtifactSource
+ display_name:
+ description:
+ - The artifact source's display name.
+ returned: always
+ type: str
+ sample: Public Artifact Repo
+ source_type:
+ description:
+ - The artifact source's type.
+ returned: always
+ type: str
+ sample: github
+ is_enabled:
+ description:
+ - Is the artifact source enabled.
+ returned: always
+ type: str
+ sample: True
+ uri:
+ description:
+ - URI of the artifact source.
+ returned: always
+ type: str
+ sample: https://github.com/Azure/azure-devtestlab.git
+ folder_path:
+ description:
+ - The folder containing artifacts.
+ returned: always
+ type: str
+ sample: /Artifacts
+ arm_template_folder_path:
+ description:
+ - The folder containing Azure Resource Manager templates.
+ returned: always
+ type: str
+ sample: /Environments
+ provisioning_state:
+ description:
+ - Provisioning state of artifact source.
+ returned: always
+ type: str
+ sample: Succeeded
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlArtifactSourceInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlArtifactSourceInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabartifactsource_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabartifactsource_facts' module has been renamed to 'azure_rm_devtestlabartifactsource_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['artifactsources'] = self.get()
+ else:
+ self.results['artifactsources'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.artifact_sources.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Artifact Source.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.artifact_sources.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Artifact Source.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id'),
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'lab_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'name': d.get('name'),
+ 'display_name': d.get('display_name'),
+ 'tags': d.get('tags'),
+ 'source_type': d.get('source_type').lower(),
+ 'is_enabled': d.get('status') == 'Enabled',
+ 'uri': d.get('uri'),
+ 'arm_template_folder_path': d.get('arm_template_folder_path'),
+ 'folder_path': d.get('folder_path'),
+ 'provisioning_state': d.get('provisioning_state')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlArtifactSourceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifactsource_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifactsource_info.py
new file mode 100644
index 00000000..283c699a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabartifactsource_info.py
@@ -0,0 +1,258 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabartifactsource_info
+short_description: Get Azure DevTest Lab Artifact Source facts
+description:
+ - Get facts of Azure DevTest Lab Artifact Source.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of DevTest Lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of DevTest Lab Artifact Source.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of DevTest Lab Artifact Source
+ community.azure.azure_rm_devtestlabartifactsource_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myArtifactSource
+'''
+
+RETURN = '''
+artifactsources:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab Artifact Source.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/ar
+ tifactSources/myArtifactSource"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the artifact source.
+ returned: always
+ type: str
+ sample: myArtifactSource
+ display_name:
+ description:
+ - The artifact source's display name.
+ returned: always
+ type: str
+ sample: Public Artifact Repo
+ source_type:
+ description:
+ - The artifact source's type.
+ returned: always
+ type: str
+ sample: github
+ is_enabled:
+ description:
+ - Is the artifact source enabled.
+ returned: always
+ type: str
+ sample: True
+ uri:
+ description:
+ - URI of the artifact source.
+ returned: always
+ type: str
+ sample: https://github.com/Azure/azure-devtestlab.git
+ folder_path:
+ description:
+ - The folder containing artifacts.
+ returned: always
+ type: str
+ sample: /Artifacts
+ arm_template_folder_path:
+ description:
+ - The folder containing Azure Resource Manager templates.
+ returned: always
+ type: str
+ sample: /Environments
+ provisioning_state:
+ description:
+ - Provisioning state of artifact source.
+ returned: always
+ type: str
+ sample: Succeeded
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlArtifactSourceInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlArtifactSourceInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabartifactsource_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabartifactsource_facts' module has been renamed to 'azure_rm_devtestlabartifactsource_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['artifactsources'] = self.get()
+ else:
+ self.results['artifactsources'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.artifact_sources.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Artifact Source.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.artifact_sources.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Artifact Source.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id'),
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'lab_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'name': d.get('name'),
+ 'display_name': d.get('display_name'),
+ 'tags': d.get('tags'),
+ 'source_type': d.get('source_type').lower(),
+ 'is_enabled': d.get('status') == 'Enabled',
+ 'uri': d.get('uri'),
+ 'arm_template_folder_path': d.get('arm_template_folder_path'),
+ 'folder_path': d.get('folder_path'),
+ 'provisioning_state': d.get('provisioning_state')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlArtifactSourceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabcustomimage_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabcustomimage_facts.py
new file mode 100644
index 00000000..65a86687
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabcustomimage_facts.py
@@ -0,0 +1,229 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabcustomimage_info
+short_description: Get Azure DevTest Lab Custom Image facts
+description:
+ - Get facts of Azure Azure DevTest Lab Custom Image.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the custom image.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Custom Image
+ community.azure.azure_rm_devtestlabcustomimage_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myImage
+
+ - name: List instances of Custom Image in the lab
+ community.azure.azure_rm_devtestlabcustomimage_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myImage
+'''
+
+RETURN = '''
+custom_images:
+ description:
+ - A list of dictionaries containing facts for Custom Image.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/cu
+ stomimages/myImage"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the image.
+ returned: always
+ type: str
+ sample: myImage
+ managed_shapshot_id:
+ description:
+ - Managed snapshot id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.compute/snapshots/myImage"
+ source_vm_id:
+ description:
+ - Source VM id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx//resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab/v
+ irtualmachines/myLabVm"
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag':'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlCustomImageInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str',
+ required=True
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlCustomImageInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabcustomimage_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabcustomimage_facts' module has been renamed to 'azure_rm_devtestlabcustomimage_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['custom_images'] = self.get()
+ else:
+ self.results['custom_images'] = self.list()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.custom_images.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Custom Image.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.custom_images.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Custom Image.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'lab_name': self.lab_name,
+ 'name': d.get('name'),
+ 'id': d.get('id'),
+ 'managed_snapshot_id': d.get('managed_snapshot_id'),
+ 'source_vm_id': d.get('vm', {}).get('source_vm_id'),
+ 'tags': d.get('tags')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlCustomImageInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabcustomimage_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabcustomimage_info.py
new file mode 100644
index 00000000..65a86687
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabcustomimage_info.py
@@ -0,0 +1,229 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabcustomimage_info
+short_description: Get Azure DevTest Lab Custom Image facts
+description:
+ - Get facts of Azure Azure DevTest Lab Custom Image.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the custom image.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Custom Image
+ community.azure.azure_rm_devtestlabcustomimage_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myImage
+
+ - name: List instances of Custom Image in the lab
+ community.azure.azure_rm_devtestlabcustomimage_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myImage
+'''
+
+RETURN = '''
+custom_images:
+ description:
+ - A list of dictionaries containing facts for Custom Image.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/cu
+ stomimages/myImage"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the image.
+ returned: always
+ type: str
+ sample: myImage
+ managed_shapshot_id:
+ description:
+ - Managed snapshot id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.compute/snapshots/myImage"
+ source_vm_id:
+ description:
+ - Source VM id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx//resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab/v
+ irtualmachines/myLabVm"
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag':'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlCustomImageInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str',
+ required=True
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlCustomImageInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabcustomimage_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabcustomimage_facts' module has been renamed to 'azure_rm_devtestlabcustomimage_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['custom_images'] = self.get()
+ else:
+ self.results['custom_images'] = self.list()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.custom_images.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Custom Image.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.custom_images.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Custom Image.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'lab_name': self.lab_name,
+ 'name': d.get('name'),
+ 'id': d.get('id'),
+ 'managed_snapshot_id': d.get('managed_snapshot_id'),
+ 'source_vm_id': d.get('vm', {}).get('source_vm_id'),
+ 'tags': d.get('tags')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlCustomImageInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabenvironment_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabenvironment_facts.py
new file mode 100644
index 00000000..8a58ea0f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabenvironment_facts.py
@@ -0,0 +1,245 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabenvironment_info
+short_description: Get Azure Environment facts
+description:
+ - Get facts of Azure Environment.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ user_name:
+ description:
+ - The name of the user profile.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the environment.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Environment
+ community.azure.azure_rm_devtestlabenvironment_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ user_name: myUser
+ name: myEnvironment
+'''
+
+RETURN = '''
+environments:
+ description:
+ - A list of dictionaries containing facts for Environment.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/sc
+ hedules/xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxxx/environments/myEnvironment"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the environment.
+ returned: always
+ type: str
+ sample: myEnvironment
+ deployment_template:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/mylab/art
+ ifactSources/public environment repo/armTemplates/WebApp"
+ resource_group_id:
+ description:
+ - Target resource group id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myLab-myEnvironment-982571"
+ state:
+ description:
+ - Deployment state.
+ returned: always
+ type: str
+ sample: Succeeded
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlEnvironmentInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ user_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.user_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlEnvironmentInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabenvironment_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabenvironment_facts' module has been renamed to 'azure_rm_devtestlabenvironment_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['environments'] = self.get()
+ else:
+ self.results['environments'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.environments.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ user_name=self.user_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Environment.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.environments.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ user_name=self.user_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Environment.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'lab_name': self.lab_name,
+ 'name': d.get('name'),
+ 'user_name': self.user_name,
+ 'id': d.get('id', None),
+ 'deployment_template': d.get('deployment_properties', {}).get('arm_template_id'),
+ 'location': d.get('location'),
+ 'provisioning_state': d.get('provisioning_state'),
+ 'resource_group_id': d.get('resource_group_id'),
+ 'tags': d.get('tags', None)
+ }
+ return d
+
+
+def main():
+ AzureRMDtlEnvironmentInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabenvironment_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabenvironment_info.py
new file mode 100644
index 00000000..8a58ea0f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabenvironment_info.py
@@ -0,0 +1,245 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabenvironment_info
+short_description: Get Azure Environment facts
+description:
+ - Get facts of Azure Environment.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ user_name:
+ description:
+ - The name of the user profile.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the environment.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Environment
+ community.azure.azure_rm_devtestlabenvironment_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ user_name: myUser
+ name: myEnvironment
+'''
+
+RETURN = '''
+environments:
+ description:
+ - A list of dictionaries containing facts for Environment.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/sc
+ hedules/xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxxx/environments/myEnvironment"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the environment.
+ returned: always
+ type: str
+ sample: myEnvironment
+ deployment_template:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/mylab/art
+ ifactSources/public environment repo/armTemplates/WebApp"
+ resource_group_id:
+ description:
+ - Target resource group id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myLab-myEnvironment-982571"
+ state:
+ description:
+ - Deployment state.
+ returned: always
+ type: str
+ sample: Succeeded
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlEnvironmentInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ user_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.user_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlEnvironmentInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabenvironment_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabenvironment_facts' module has been renamed to 'azure_rm_devtestlabenvironment_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['environments'] = self.get()
+ else:
+ self.results['environments'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.environments.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ user_name=self.user_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Environment.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.environments.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ user_name=self.user_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Environment.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'lab_name': self.lab_name,
+ 'name': d.get('name'),
+ 'user_name': self.user_name,
+ 'id': d.get('id', None),
+ 'deployment_template': d.get('deployment_properties', {}).get('arm_template_id'),
+ 'location': d.get('location'),
+ 'provisioning_state': d.get('provisioning_state'),
+ 'resource_group_id': d.get('resource_group_id'),
+ 'tags': d.get('tags', None)
+ }
+ return d
+
+
+def main():
+ AzureRMDtlEnvironmentInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabpolicy_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabpolicy_facts.py
new file mode 100644
index 00000000..c0851719
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabpolicy_facts.py
@@ -0,0 +1,243 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabpolicy_info
+short_description: Get Azure DTL Policy facts
+description:
+ - Get facts of Azure DTL Policy.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ policy_set_name:
+ description:
+ - The name of the policy set.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the policy.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Policy
+ community.azure.azure_rm_devtestlabpolicy_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ policy_set_name: myPolicySet
+ name: myPolicy
+'''
+
+RETURN = '''
+policies:
+ description:
+ - A list of dictionaries containing facts for Policy.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/po
+ licysets/myPolicySet/policies/myPolicy"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the artifact source.
+ returned: always
+ type: str
+ sample: myArtifactSource
+ fact_name:
+ description:
+ - The name of the policy fact.
+ returned: always
+ type: str
+ sample: UserOwnedLabVmCount
+ evaluator_type:
+ description:
+ - Evaluator type for policy fact.
+ returned: always
+ type: str
+ sample: MaxValuePolicy
+ threshold:
+ description:
+ - Fact's threshold.
+ returned: always
+ type: str
+ sample: 5
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlPolicyInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ policy_set_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.policy_set_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlPolicyInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabpolicy_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabpolicy_facts' module has been renamed to 'azure_rm_devtestlabpolicy_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['policies'] = self.get()
+ else:
+ self.results['policies'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.policies.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ policy_set_name=self.policy_set_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Policy.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.policies.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ policy_set_name=self.policy_set_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Policy.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'policy_set_name': self.policy_set_name,
+ 'name': d.get('name'),
+ 'id': d.get('id'),
+ 'tags': d.get('tags'),
+ 'status': d.get('status'),
+ 'threshold': d.get('threshold'),
+ 'fact_name': d.get('fact_name'),
+ 'evaluator_type': d.get('evaluator_type')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlPolicyInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabpolicy_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabpolicy_info.py
new file mode 100644
index 00000000..c0851719
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabpolicy_info.py
@@ -0,0 +1,243 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabpolicy_info
+short_description: Get Azure DTL Policy facts
+description:
+ - Get facts of Azure DTL Policy.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ policy_set_name:
+ description:
+ - The name of the policy set.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the policy.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Policy
+ community.azure.azure_rm_devtestlabpolicy_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ policy_set_name: myPolicySet
+ name: myPolicy
+'''
+
+RETURN = '''
+policies:
+ description:
+ - A list of dictionaries containing facts for Policy.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/po
+ licysets/myPolicySet/policies/myPolicy"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the artifact source.
+ returned: always
+ type: str
+ sample: myArtifactSource
+ fact_name:
+ description:
+ - The name of the policy fact.
+ returned: always
+ type: str
+ sample: UserOwnedLabVmCount
+ evaluator_type:
+ description:
+ - Evaluator type for policy fact.
+ returned: always
+ type: str
+ sample: MaxValuePolicy
+ threshold:
+ description:
+ - Fact's threshold.
+ returned: always
+ type: str
+ sample: 5
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlPolicyInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ policy_set_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.policy_set_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlPolicyInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabpolicy_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabpolicy_facts' module has been renamed to 'azure_rm_devtestlabpolicy_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['policies'] = self.get()
+ else:
+ self.results['policies'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.policies.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ policy_set_name=self.policy_set_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Policy.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.policies.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ policy_set_name=self.policy_set_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Policy.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'policy_set_name': self.policy_set_name,
+ 'name': d.get('name'),
+ 'id': d.get('id'),
+ 'tags': d.get('tags'),
+ 'status': d.get('status'),
+ 'threshold': d.get('threshold'),
+ 'fact_name': d.get('fact_name'),
+ 'evaluator_type': d.get('evaluator_type')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlPolicyInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabschedule_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabschedule_facts.py
new file mode 100644
index 00000000..6a241e4b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabschedule_facts.py
@@ -0,0 +1,222 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabschedule_info
+short_description: Get Azure Schedule facts
+description:
+ - Get facts of Azure Schedule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the schedule.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Schedule
+ community.azure.azure_rm_devtestlabschedule_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: mySchedule
+'''
+
+RETURN = '''
+schedules:
+ description:
+ - A list of dictionaries containing facts for Schedule.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/sc
+ hedules/labvmsshutdown"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the environment.
+ returned: always
+ type: str
+ sample: lab_vms_shutdown
+ time:
+ description:
+ - Time of the schedule.
+ returned: always
+ type: str
+ sample: lab_vms_shutdown
+ time_zone_id:
+ description:
+ - Time zone id.
+ returned: always
+ type: str
+ sample: UTC+12
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake, _snake_to_camel
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlScheduleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlScheduleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabschedule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabschedule_facts' module has been renamed to 'azure_rm_devtestlabschedule_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+ if self.name:
+ self.results['schedules'] = self.get()
+ else:
+ self.results['schedules'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.schedules.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=_snake_to_camel(self.name))
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Schedule.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.schedules.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Schedule.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'lab_name': self.lab_name,
+ 'name': _camel_to_snake(d.get('name')),
+ 'id': d.get('id', None),
+ 'tags': d.get('tags', None),
+ 'time': d.get('daily_recurrence', {}).get('time'),
+ 'time_zone_id': d.get('time_zone_id')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlScheduleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabschedule_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabschedule_info.py
new file mode 100644
index 00000000..6a241e4b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabschedule_info.py
@@ -0,0 +1,222 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabschedule_info
+short_description: Get Azure Schedule facts
+description:
+ - Get facts of Azure Schedule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the schedule.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of Schedule
+ community.azure.azure_rm_devtestlabschedule_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: mySchedule
+'''
+
+RETURN = '''
+schedules:
+ description:
+ - A list of dictionaries containing facts for Schedule.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the artifact source.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DevTestLab/labs/myLab/sc
+ hedules/labvmsshutdown"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - The name of the environment.
+ returned: always
+ type: str
+ sample: lab_vms_shutdown
+ time:
+ description:
+ - Time of the schedule.
+ returned: always
+ type: str
+ sample: lab_vms_shutdown
+ time_zone_id:
+ description:
+ - Time zone id.
+ returned: always
+ type: str
+ sample: UTC+12
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'MyTag': 'MyValue' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake, _snake_to_camel
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlScheduleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlScheduleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabschedule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabschedule_facts' module has been renamed to 'azure_rm_devtestlabschedule_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+ if self.name:
+ self.results['schedules'] = self.get()
+ else:
+ self.results['schedules'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.schedules.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=_snake_to_camel(self.name))
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Schedule.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.schedules.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Schedule.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'lab_name': self.lab_name,
+ 'name': _camel_to_snake(d.get('name')),
+ 'id': d.get('id', None),
+ 'tags': d.get('tags', None),
+ 'time': d.get('daily_recurrence', {}).get('time'),
+ 'time_zone_id': d.get('time_zone_id')
+ }
+ return d
+
+
+def main():
+ AzureRMDtlScheduleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualmachine_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualmachine_facts.py
new file mode 100644
index 00000000..b5fb6311
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualmachine_facts.py
@@ -0,0 +1,329 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabvirtualmachine_info
+short_description: Get Azure DevTest Lab Virtual Machine facts
+description:
+ - Get facts of Azure DevTest Lab Virtual Machine.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the virtual machine.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of DTL Virtual Machine
+ community.azure.azure_rm_devtestlabvirtualmachine_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myVm
+'''
+
+RETURN = '''
+virtualmachines:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab Virtual Machine.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the virtual machine.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab/virt
+ ualmachines/myVm"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - Name of the virtual machine.
+ returned: always
+ type: str
+ sample: myVm
+ notes:
+ description:
+ - Notes of the virtual machine.
+ returned: always
+ type: str
+ sample: My VM notes
+ disallow_public_ip_address:
+ description:
+ - Whether public IP should be not allowed.
+ returned: always
+ type: bool
+ sample: false
+ expiration_date:
+ description:
+ - Virtual machine expiration date.
+ returned: always
+ type: str
+ sample: "2029-02-22T01:49:12.117974Z"
+ image:
+ description:
+ - Gallery image reference.
+ returned: always
+ type: complex
+ contains:
+ offer:
+ description:
+ - The offer of the gallery image.
+ returned: when created from gallery image
+ type: str
+ sample: UbuntuServer
+ os_type:
+ description:
+ - Operating system type.
+ returned: when created from gallery image
+ type: str
+ sample: Linux
+ sku:
+ description:
+ - The SKU of the gallery image.
+ returned: when created from gallery image
+ type: str
+ sample: 16.04-LTS
+ publisher:
+ description:
+ - The publisher of the gallery image.
+ returned: when created from gallery image
+ type: str
+ sample: Canonical
+ version:
+ description:
+ - The version of the gallery image.
+ returned: when created from gallery image
+ type: str
+ sample: latest
+ os_type:
+ description:
+ - Operating system type.
+ returned: always
+ type: str
+ sample: linux
+ vm_size:
+ description:
+ - Virtual machine size.
+ returned: always
+ type: str
+ sample: Standard_A2_v2
+ user_name:
+ description:
+ - Admin user name.
+ returned: always
+ type: str
+ sample: dtl_admin
+ storage_type:
+ description:
+ - Storage type to use for virtual machine.
+ returned: always
+ type: str
+ sample: standard
+ compute_vm_id:
+ description:
+ - Resource id of compute virtual machine.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myLab-myVm-097933/providers/Microsoft.Compute/virtualMachines/myVm
+ compute_vm_resource_group:
+ description:
+ - Resource group where compute virtual machine is created.
+ returned: always
+ type: str
+ sample: myLab-myVm-097933
+ compute_vm_name:
+ description:
+ - Name of compute virtual machine.
+ returned: always
+ type: str
+ sample: myVm
+ fqdn:
+ description:
+ - Fully qualified domain name.
+ returned: always
+ type: str
+ sample: myvm.eastus.cloudapp.azure.com
+ provisioning_state:
+ description:
+ - Provisioning state of the virtual network.
+ returned: always
+ type: str
+ sample: Succeeded
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'foo': 'bar' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlVirtualMachineInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlVirtualMachineInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabvirtualmachine_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabvirtualmachine_facts' module has been renamed to 'azure_rm_devtestlabvirtualmachine_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['virtualmachines'] = self.get()
+ else:
+ self.results['virtualmachines'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_machines.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Virtual Machine.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_machines.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Virtual Machine.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id', None),
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'lab_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'name': d.get('name'),
+ 'notes': d.get('notes'),
+ 'disallow_public_ip_address': d.get('disallow_public_ip_address'),
+ 'expiration_date': d.get('expiration_date'),
+ 'image': d.get('gallery_image_reference'),
+ 'os_type': d.get('os_type').lower(),
+ 'vm_size': d.get('size'),
+ 'user_name': d.get('user_name'),
+ 'storage_type': d.get('storage_type').lower(),
+ 'compute_vm_id': d.get('compute_id'),
+ 'compute_vm_resource_group': self.parse_resource_to_dict(d.get('compute_id')).get('resource_group'),
+ 'compute_vm_name': self.parse_resource_to_dict(d.get('compute_id')).get('name'),
+ 'fqdn': d.get('fqdn'),
+ 'provisioning_state': d.get('provisioning_state'),
+ 'tags': d.get('tags', None)
+ }
+ return d
+
+
+def main():
+ AzureRMDtlVirtualMachineInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualmachine_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualmachine_info.py
new file mode 100644
index 00000000..b5fb6311
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualmachine_info.py
@@ -0,0 +1,329 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabvirtualmachine_info
+short_description: Get Azure DevTest Lab Virtual Machine facts
+description:
+ - Get facts of Azure DevTest Lab Virtual Machine.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of the lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the virtual machine.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of DTL Virtual Machine
+ community.azure.azure_rm_devtestlabvirtualmachine_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myVm
+'''
+
+RETURN = '''
+virtualmachines:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab Virtual Machine.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the virtual machine.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab/virt
+ ualmachines/myVm"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - Name of the virtual machine.
+ returned: always
+ type: str
+ sample: myVm
+ notes:
+ description:
+ - Notes of the virtual machine.
+ returned: always
+ type: str
+ sample: My VM notes
+ disallow_public_ip_address:
+ description:
+ - Whether public IP should be not allowed.
+ returned: always
+ type: bool
+ sample: false
+ expiration_date:
+ description:
+ - Virtual machine expiration date.
+ returned: always
+ type: str
+ sample: "2029-02-22T01:49:12.117974Z"
+ image:
+ description:
+ - Gallery image reference.
+ returned: always
+ type: complex
+ contains:
+ offer:
+ description:
+ - The offer of the gallery image.
+ returned: when created from gallery image
+ type: str
+ sample: UbuntuServer
+ os_type:
+ description:
+ - Operating system type.
+ returned: when created from gallery image
+ type: str
+ sample: Linux
+ sku:
+ description:
+ - The SKU of the gallery image.
+ returned: when created from gallery image
+ type: str
+ sample: 16.04-LTS
+ publisher:
+ description:
+ - The publisher of the gallery image.
+ returned: when created from gallery image
+ type: str
+ sample: Canonical
+ version:
+ description:
+ - The version of the gallery image.
+ returned: when created from gallery image
+ type: str
+ sample: latest
+ os_type:
+ description:
+ - Operating system type.
+ returned: always
+ type: str
+ sample: linux
+ vm_size:
+ description:
+ - Virtual machine size.
+ returned: always
+ type: str
+ sample: Standard_A2_v2
+ user_name:
+ description:
+ - Admin user name.
+ returned: always
+ type: str
+ sample: dtl_admin
+ storage_type:
+ description:
+ - Storage type to use for virtual machine.
+ returned: always
+ type: str
+ sample: standard
+ compute_vm_id:
+ description:
+ - Resource id of compute virtual machine.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myLab-myVm-097933/providers/Microsoft.Compute/virtualMachines/myVm
+ compute_vm_resource_group:
+ description:
+ - Resource group where compute virtual machine is created.
+ returned: always
+ type: str
+ sample: myLab-myVm-097933
+ compute_vm_name:
+ description:
+ - Name of compute virtual machine.
+ returned: always
+ type: str
+ sample: myVm
+ fqdn:
+ description:
+ - Fully qualified domain name.
+ returned: always
+ type: str
+ sample: myvm.eastus.cloudapp.azure.com
+ provisioning_state:
+ description:
+ - Provisioning state of the virtual network.
+ returned: always
+ type: str
+ sample: Succeeded
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: "{ 'foo': 'bar' }"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDtlVirtualMachineInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMDtlVirtualMachineInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabvirtualmachine_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabvirtualmachine_facts' module has been renamed to 'azure_rm_devtestlabvirtualmachine_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['virtualmachines'] = self.get()
+ else:
+ self.results['virtualmachines'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_machines.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Virtual Machine.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_machines.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Virtual Machine.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id', None),
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'lab_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'name': d.get('name'),
+ 'notes': d.get('notes'),
+ 'disallow_public_ip_address': d.get('disallow_public_ip_address'),
+ 'expiration_date': d.get('expiration_date'),
+ 'image': d.get('gallery_image_reference'),
+ 'os_type': d.get('os_type').lower(),
+ 'vm_size': d.get('size'),
+ 'user_name': d.get('user_name'),
+ 'storage_type': d.get('storage_type').lower(),
+ 'compute_vm_id': d.get('compute_id'),
+ 'compute_vm_resource_group': self.parse_resource_to_dict(d.get('compute_id')).get('resource_group'),
+ 'compute_vm_name': self.parse_resource_to_dict(d.get('compute_id')).get('name'),
+ 'fqdn': d.get('fqdn'),
+ 'provisioning_state': d.get('provisioning_state'),
+ 'tags': d.get('tags', None)
+ }
+ return d
+
+
+def main():
+ AzureRMDtlVirtualMachineInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualnetwork_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualnetwork_facts.py
new file mode 100644
index 00000000..efde73fa
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualnetwork_facts.py
@@ -0,0 +1,221 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabvirtualnetwork_info
+short_description: Get Azure DevTest Lab Virtual Network facts
+description:
+ - Get facts of Azure DevTest Lab Virtual Network.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of DevTest Lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of DevTest Lab Virtual Network.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of DevTest Lab Virtual Network
+ community.azure.azure_rm_devtestlabvirtualnetwork_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myVirtualNetwork
+
+ - name: List all Virtual Networks in DevTest Lab
+ community.azure.azure_rm_devtestlabvirtualnetwork_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myVirtualNetwork
+'''
+
+RETURN = '''
+virtualnetworks:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab Virtual Network.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the virtual network.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab/virt
+ ualnetworks/myVirtualNetwork"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - Name of the virtual network.
+ returned: always
+ type: str
+ sample: myVirtualNetwork
+ description:
+ description:
+ - Description of the virtual network.
+ returned: always
+ type: str
+ sample: My Virtual Network
+ external_provider_resource_id:
+ description:
+ - Resource id of an external virtual network.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/my
+ VirtualNetwork"
+ provisioning_state:
+ description:
+ - Provisioning state of the virtual network.
+ returned: always
+ type: str
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDevTestLabVirtualNetworkInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ super(AzureRMDevTestLabVirtualNetworkInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabvirtualnetwork_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabvirtualnetwork_facts' module has been renamed to 'azure_rm_devtestlabvirtualnetwork_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['virtualnetworks'] = self.get()
+ else:
+ self.results['virtualnetworks'] = self.list()
+
+ return self.results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_networks.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not list Virtual Networks for DevTest Lab.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_networks.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Virtual Network.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'lab_name': self.lab_name,
+ 'name': d.get('name', None),
+ 'id': d.get('id', None),
+ 'external_provider_resource_id': d.get('external_provider_resource_id', None),
+ 'provisioning_state': d.get('provisioning_state', None),
+ 'description': d.get('description', None)
+ }
+ return d
+
+
+def main():
+ AzureRMDevTestLabVirtualNetworkInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualnetwork_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualnetwork_info.py
new file mode 100644
index 00000000..efde73fa
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_devtestlabvirtualnetwork_info.py
@@ -0,0 +1,221 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_devtestlabvirtualnetwork_info
+short_description: Get Azure DevTest Lab Virtual Network facts
+description:
+ - Get facts of Azure DevTest Lab Virtual Network.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ lab_name:
+ description:
+ - The name of DevTest Lab.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of DevTest Lab Virtual Network.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of DevTest Lab Virtual Network
+ community.azure.azure_rm_devtestlabvirtualnetwork_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myVirtualNetwork
+
+ - name: List all Virtual Networks in DevTest Lab
+ community.azure.azure_rm_devtestlabvirtualnetwork_info:
+ resource_group: myResourceGroup
+ lab_name: myLab
+ name: myVirtualNetwork
+'''
+
+RETURN = '''
+virtualnetworks:
+ description:
+ - A list of dictionaries containing facts for DevTest Lab Virtual Network.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The identifier of the virtual network.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab/virt
+ ualnetworks/myVirtualNetwork"
+ resource_group:
+ description:
+ - Name of the resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ lab_name:
+ description:
+ - Name of the lab.
+ returned: always
+ type: str
+ sample: myLab
+ name:
+ description:
+ - Name of the virtual network.
+ returned: always
+ type: str
+ sample: myVirtualNetwork
+ description:
+ description:
+ - Description of the virtual network.
+ returned: always
+ type: str
+ sample: My Virtual Network
+ external_provider_resource_id:
+ description:
+ - Resource id of an external virtual network.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/my
+ VirtualNetwork"
+ provisioning_state:
+ description:
+ - Provisioning state of the virtual network.
+ returned: always
+ type: str
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.devtestlabs import DevTestLabsClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMDevTestLabVirtualNetworkInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ lab_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.lab_name = None
+ self.name = None
+ super(AzureRMDevTestLabVirtualNetworkInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_devtestlabvirtualnetwork_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_devtestlabvirtualnetwork_facts' module has been renamed to 'azure_rm_devtestlabvirtualnetwork_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name:
+ self.results['virtualnetworks'] = self.get()
+ else:
+ self.results['virtualnetworks'] = self.list()
+
+ return self.results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_networks.list(resource_group_name=self.resource_group,
+ lab_name=self.lab_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not list Virtual Networks for DevTest Lab.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_networks.get(resource_group_name=self.resource_group,
+ lab_name=self.lab_name,
+ name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Virtual Network.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'lab_name': self.lab_name,
+ 'name': d.get('name', None),
+ 'id': d.get('id', None),
+ 'external_provider_resource_id': d.get('external_provider_resource_id', None),
+ 'provisioning_state': d.get('provisioning_state', None),
+ 'description': d.get('description', None)
+ }
+ return d
+
+
+def main():
+ AzureRMDevTestLabVirtualNetworkInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnsrecordset_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnsrecordset_facts.py
new file mode 100644
index 00000000..423ad49a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnsrecordset_facts.py
@@ -0,0 +1,294 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Obezimnaka Boms, <t-ozboms@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_dnsrecordset_info
+
+
+short_description: Get DNS Record Set facts
+
+description:
+ - Get facts for a specific DNS Record Set in a Zone, or a specific type in all Zones or in one Zone etc.
+
+options:
+ relative_name:
+ description:
+ - Only show results for a Record Set.
+ resource_group:
+ description:
+ - Limit results by resource group. Required when filtering by name or type.
+ zone_name:
+ description:
+ - Limit results by zones. Required when filtering by name or type.
+ record_type:
+ description:
+ - Limit record sets by record type.
+ top:
+ description:
+ - Limit the maximum number of record sets to return.
+ type: int
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Ozi Boms (@ozboms)
+
+'''
+
+EXAMPLES = '''
+- name: Get facts for one Record Set
+ community.azure.azure_rm_dnsrecordset_info:
+ resource_group: myResourceGroup
+ zone_name: example.com
+ relative_name: server10
+ record_type: A
+- name: Get facts for all Type A Record Sets in a Zone
+ community.azure.azure_rm_dnsrecordset_info:
+ resource_group: myResourceGroup
+ zone_name: example.com
+ record_type: A
+- name: Get all record sets in one zone
+ community.azure.azure_rm_dnsrecordset_info:
+ resource_group: myResourceGroup
+ zone_name: example.com
+'''
+
+RETURN = '''
+azure_dnsrecordset:
+ description:
+ - List of record set dicts.
+ returned: always
+ type: list
+ example: [
+ {
+ "etag": "60ac0480-44dd-4881-a2ed-680d20b3978e",
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/dnszones/newzone.com/A/servera",
+ "name": "servera",
+ "properties": {
+ "ARecords": [
+ {
+ "ipv4Address": "10.4.5.7"
+ },
+ {
+ "ipv4Address": "2.4.5.8"
+ }
+ ],
+ "TTL": 12900
+ },
+ "type": "Microsoft.Network/dnszones/A"
+ }]
+dnsrecordsets:
+ description:
+ - List of record set dicts, which shares the same hierarchy as M(community.azure.azure_rm_dnsrecordset) module's parameter.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - ID of the dns recordset.
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/dnszones/newzone.
+ com/A/servera"
+ relative_name:
+ description:
+ - Name of the dns recordset.
+ sample: servera
+ record_type:
+ description:
+ - The type of the record set.
+ - Can be C(A), C(AAAA), C(CNAME), C(MX), C(NS), C(SRV), C(TXT), C(PTR).
+ sample: A
+ time_to_live:
+ description:
+ - Time to live of the record set in seconds.
+ sample: 12900
+ records:
+ description:
+ - List of records depending on the type of recordset.
+ sample: [
+ {
+ "ipv4Address": "10.4.5.7"
+ },
+ {
+ "ipv4Address": "2.4.5.8"
+ }
+ ]
+ provisioning_state:
+ description:
+ - Provision state of the resource.
+ sample: Successed
+ fqdn:
+ description:
+ - Fully qualified domain name of the record set.
+ sample: www.newzone.com
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'RecordSet'
+
+
+RECORDSET_VALUE_MAP = dict(
+ A='arecords',
+ AAAA='aaaa_records',
+ CNAME='cname_record',
+ MX='mx_records',
+ NS='ns_records',
+ PTR='ptr_records',
+ SRV='srv_records',
+ TXT='txt_records',
+ SOA='soa_record',
+ CAA='caa_records'
+ # FUTURE: add missing record types from https://github.com/Azure/azure-sdk-for-python/blob/master/azure-mgmt-dns/azure/mgmt/dns/models/record_set.py
+)
+
+
+class AzureRMRecordSetInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ relative_name=dict(type='str'),
+ resource_group=dict(type='str'),
+ zone_name=dict(type='str'),
+ record_type=dict(type='str'),
+ top=dict(type='int')
+ )
+
+ # store the results of the module operation
+ self.results = dict(
+ changed=False,
+ )
+
+ self.relative_name = None
+ self.resource_group = None
+ self.zone_name = None
+ self.record_type = None
+ self.top = None
+
+ super(AzureRMRecordSetInfo, self).__init__(self.module_arg_spec)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_dnsrecordset_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_dnsrecordset_facts' module has been renamed to 'azure_rm_dnsrecordset_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if not self.top or self.top <= 0:
+ self.top = None
+
+ # create conditionals to catch errors when calling record facts
+ if self.relative_name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name or record type.")
+ if self.relative_name and not self.zone_name:
+ self.fail("Parameter error: DNS Zone required when filtering by name or record type.")
+
+ results = []
+ # list the conditions for what to return based on input
+ if self.relative_name is not None:
+ # if there is a name listed, they want only facts about that specific Record Set itself
+ results = self.get_item()
+ elif self.record_type:
+ # else, they just want all the record sets of a specific type
+ results = self.list_type()
+ elif self.zone_name:
+ # if there is a zone name listed, then they want all the record sets in a zone
+ results = self.list_zone()
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_dnsrecordset': self.serialize_list(results)
+ }
+ self.results['dnsrecordsets'] = self.curated_list(results)
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.relative_name))
+ item = None
+ results = []
+
+ # try to get information for specific Record Set
+ try:
+ item = self.dns_client.record_sets.get(self.resource_group, self.zone_name, self.relative_name, self.record_type)
+ except CloudError:
+ pass
+
+ results = [item]
+ return results
+
+ def list_type(self):
+ self.log('Lists the record sets of a specified type in a DNS zone')
+ try:
+ response = self.dns_client.record_sets.list_by_type(self.resource_group, self.zone_name, self.record_type, top=self.top)
+ except AzureHttpError as exc:
+ self.fail("Failed to list for record type {0} - {1}".format(self.record_type, str(exc)))
+
+ results = []
+ for item in response:
+ results.append(item)
+ return results
+
+ def list_zone(self):
+ self.log('Lists all record sets in a DNS zone')
+ try:
+ response = self.dns_client.record_sets.list_by_dns_zone(self.resource_group, self.zone_name, top=self.top)
+ except AzureHttpError as exc:
+ self.fail("Failed to list for zone {0} - {1}".format(self.zone_name, str(exc)))
+
+ results = []
+ for item in response:
+ results.append(item)
+ return results
+
+ def serialize_list(self, raws):
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raws] if raws else []
+
+ def curated_list(self, raws):
+ return [self.record_to_dict(item) for item in raws] if raws else []
+
+ def record_to_dict(self, record):
+ record_type = record.type[len('Microsoft.Network/dnszones/'):]
+ records = getattr(record, RECORDSET_VALUE_MAP.get(record_type))
+ if not isinstance(records, list):
+ records = [records]
+ return dict(
+ id=record.id,
+ relative_name=record.name,
+ record_type=record_type,
+ records=[x.as_dict() for x in records],
+ time_to_live=record.ttl,
+ fqdn=record.fqdn,
+ provisioning_state=record.provisioning_state
+ )
+
+
+def main():
+ AzureRMRecordSetInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnsrecordset_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnsrecordset_info.py
new file mode 100644
index 00000000..423ad49a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnsrecordset_info.py
@@ -0,0 +1,294 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Obezimnaka Boms, <t-ozboms@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_dnsrecordset_info
+
+
+short_description: Get DNS Record Set facts
+
+description:
+ - Get facts for a specific DNS Record Set in a Zone, or a specific type in all Zones or in one Zone etc.
+
+options:
+ relative_name:
+ description:
+ - Only show results for a Record Set.
+ resource_group:
+ description:
+ - Limit results by resource group. Required when filtering by name or type.
+ zone_name:
+ description:
+ - Limit results by zones. Required when filtering by name or type.
+ record_type:
+ description:
+ - Limit record sets by record type.
+ top:
+ description:
+ - Limit the maximum number of record sets to return.
+ type: int
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Ozi Boms (@ozboms)
+
+'''
+
+EXAMPLES = '''
+- name: Get facts for one Record Set
+ community.azure.azure_rm_dnsrecordset_info:
+ resource_group: myResourceGroup
+ zone_name: example.com
+ relative_name: server10
+ record_type: A
+- name: Get facts for all Type A Record Sets in a Zone
+ community.azure.azure_rm_dnsrecordset_info:
+ resource_group: myResourceGroup
+ zone_name: example.com
+ record_type: A
+- name: Get all record sets in one zone
+ community.azure.azure_rm_dnsrecordset_info:
+ resource_group: myResourceGroup
+ zone_name: example.com
+'''
+
+RETURN = '''
+azure_dnsrecordset:
+ description:
+ - List of record set dicts.
+ returned: always
+ type: list
+ example: [
+ {
+ "etag": "60ac0480-44dd-4881-a2ed-680d20b3978e",
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/dnszones/newzone.com/A/servera",
+ "name": "servera",
+ "properties": {
+ "ARecords": [
+ {
+ "ipv4Address": "10.4.5.7"
+ },
+ {
+ "ipv4Address": "2.4.5.8"
+ }
+ ],
+ "TTL": 12900
+ },
+ "type": "Microsoft.Network/dnszones/A"
+ }]
+dnsrecordsets:
+ description:
+ - List of record set dicts, which shares the same hierarchy as M(community.azure.azure_rm_dnsrecordset) module's parameter.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - ID of the dns recordset.
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/dnszones/newzone.
+ com/A/servera"
+ relative_name:
+ description:
+ - Name of the dns recordset.
+ sample: servera
+ record_type:
+ description:
+ - The type of the record set.
+ - Can be C(A), C(AAAA), C(CNAME), C(MX), C(NS), C(SRV), C(TXT), C(PTR).
+ sample: A
+ time_to_live:
+ description:
+ - Time to live of the record set in seconds.
+ sample: 12900
+ records:
+ description:
+ - List of records depending on the type of recordset.
+ sample: [
+ {
+ "ipv4Address": "10.4.5.7"
+ },
+ {
+ "ipv4Address": "2.4.5.8"
+ }
+ ]
+ provisioning_state:
+ description:
+ - Provision state of the resource.
+ sample: Successed
+ fqdn:
+ description:
+ - Fully qualified domain name of the record set.
+ sample: www.newzone.com
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'RecordSet'
+
+
+RECORDSET_VALUE_MAP = dict(
+ A='arecords',
+ AAAA='aaaa_records',
+ CNAME='cname_record',
+ MX='mx_records',
+ NS='ns_records',
+ PTR='ptr_records',
+ SRV='srv_records',
+ TXT='txt_records',
+ SOA='soa_record',
+ CAA='caa_records'
+ # FUTURE: add missing record types from https://github.com/Azure/azure-sdk-for-python/blob/master/azure-mgmt-dns/azure/mgmt/dns/models/record_set.py
+)
+
+
+class AzureRMRecordSetInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ relative_name=dict(type='str'),
+ resource_group=dict(type='str'),
+ zone_name=dict(type='str'),
+ record_type=dict(type='str'),
+ top=dict(type='int')
+ )
+
+ # store the results of the module operation
+ self.results = dict(
+ changed=False,
+ )
+
+ self.relative_name = None
+ self.resource_group = None
+ self.zone_name = None
+ self.record_type = None
+ self.top = None
+
+ super(AzureRMRecordSetInfo, self).__init__(self.module_arg_spec)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_dnsrecordset_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_dnsrecordset_facts' module has been renamed to 'azure_rm_dnsrecordset_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if not self.top or self.top <= 0:
+ self.top = None
+
+ # create conditionals to catch errors when calling record facts
+ if self.relative_name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name or record type.")
+ if self.relative_name and not self.zone_name:
+ self.fail("Parameter error: DNS Zone required when filtering by name or record type.")
+
+ results = []
+ # list the conditions for what to return based on input
+ if self.relative_name is not None:
+ # if there is a name listed, they want only facts about that specific Record Set itself
+ results = self.get_item()
+ elif self.record_type:
+ # else, they just want all the record sets of a specific type
+ results = self.list_type()
+ elif self.zone_name:
+ # if there is a zone name listed, then they want all the record sets in a zone
+ results = self.list_zone()
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_dnsrecordset': self.serialize_list(results)
+ }
+ self.results['dnsrecordsets'] = self.curated_list(results)
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.relative_name))
+ item = None
+ results = []
+
+ # try to get information for specific Record Set
+ try:
+ item = self.dns_client.record_sets.get(self.resource_group, self.zone_name, self.relative_name, self.record_type)
+ except CloudError:
+ pass
+
+ results = [item]
+ return results
+
+ def list_type(self):
+ self.log('Lists the record sets of a specified type in a DNS zone')
+ try:
+ response = self.dns_client.record_sets.list_by_type(self.resource_group, self.zone_name, self.record_type, top=self.top)
+ except AzureHttpError as exc:
+ self.fail("Failed to list for record type {0} - {1}".format(self.record_type, str(exc)))
+
+ results = []
+ for item in response:
+ results.append(item)
+ return results
+
+ def list_zone(self):
+ self.log('Lists all record sets in a DNS zone')
+ try:
+ response = self.dns_client.record_sets.list_by_dns_zone(self.resource_group, self.zone_name, top=self.top)
+ except AzureHttpError as exc:
+ self.fail("Failed to list for zone {0} - {1}".format(self.zone_name, str(exc)))
+
+ results = []
+ for item in response:
+ results.append(item)
+ return results
+
+ def serialize_list(self, raws):
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raws] if raws else []
+
+ def curated_list(self, raws):
+ return [self.record_to_dict(item) for item in raws] if raws else []
+
+ def record_to_dict(self, record):
+ record_type = record.type[len('Microsoft.Network/dnszones/'):]
+ records = getattr(record, RECORDSET_VALUE_MAP.get(record_type))
+ if not isinstance(records, list):
+ records = [records]
+ return dict(
+ id=record.id,
+ relative_name=record.name,
+ record_type=record_type,
+ records=[x.as_dict() for x in records],
+ time_to_live=record.ttl,
+ fqdn=record.fqdn,
+ provisioning_state=record.provisioning_state
+ )
+
+
+def main():
+ AzureRMRecordSetInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnszone_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnszone_facts.py
new file mode 100644
index 00000000..6bfa2e91
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnszone_facts.py
@@ -0,0 +1,258 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Obezimnaka Boms, <t-ozboms@microsoft.com>
+#
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_dnszone_info
+
+
+short_description: Get DNS zone facts
+
+description:
+ - Get facts for a specific DNS zone or all DNS zones within a resource group.
+
+options:
+ resource_group:
+ description:
+ - Limit results by resource group. Required when filtering by name.
+ name:
+ description:
+ - Only show results for a specific zone.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Obezimnaka Boms (@ozboms)
+
+'''
+
+EXAMPLES = '''
+- name: Get facts for one zone
+ community.azure.azure_rm_dnszone_info:
+ resource_group: myResourceGroup
+ name: foobar22
+
+- name: Get facts for all zones in a resource group
+ community.azure.azure_rm_dnszone_info:
+ resource_group: myResourceGroup
+
+- name: Get facts by tags
+ community.azure.azure_rm_dnszone_info:
+ tags:
+ - testing
+'''
+
+RETURN = '''
+azure_dnszones:
+ description:
+ - List of zone dicts.
+ returned: always
+ type: list
+ example: [{
+ "etag": "00000002-0000-0000-0dcb-df5776efd201",
+ "location": "global",
+ "properties": {
+ "maxNumberOfRecordSets": 5000,
+ "numberOfRecordSets": 15
+ },
+ "tags": {}
+ }]
+dnszones:
+ description:
+ - List of zone dicts, which share the same layout as azure_rm_dnszone module parameter.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - id of the DNS Zone.
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/dnszones/azure.com"
+ name:
+ description:
+ - name of the DNS zone.
+ sample: azure.com
+ type:
+ description:
+ - The type of this DNS zone (C(public) or C(private)).
+ sample: private
+ registration_virtual_networks:
+ description:
+ - A list of references to virtual networks that register hostnames in this DNS zone.
+ type: list
+ sample: ["/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/bar"]
+ resolution_virtual_networks:
+ description:
+ - A list of references to virtual networks that resolve records in this DNS zone.
+ type: list
+ sample: ["/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/deadbeef"]
+ number_of_record_sets:
+ description:
+ - The current number of record sets in this DNS zone.
+ type: int
+ sample: 2
+ max_number_of_record_sets:
+ description:
+ - The maximum number of record sets that can be created in this DNS zone.
+ type: int
+ sample: 5000
+ name_servers:
+ description:
+ - The name servers for this DNS zone.
+ type: list
+ sample: [
+ "ns1-03.azure-dns.com.",
+ "ns2-03.azure-dns.net.",
+ "ns3-03.azure-dns.org.",
+ "ns4-03.azure-dns.info."
+ ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils._text import to_native
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'DnsZone'
+
+
+class AzureRMDNSZoneInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ # store the results of the module operation
+ self.results = dict(
+ changed=False,
+ ansible_info=dict(azure_dnszones=[])
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMDNSZoneInfo, self).__init__(self.module_arg_spec)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_dnszone_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_dnszone_facts' module has been renamed to 'azure_rm_dnszone_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ results = []
+ # list the conditions and what to return based on user input
+ if self.name is not None:
+ # if there is a name, facts about that specific zone
+ results = self.get_item()
+ elif self.resource_group:
+ # all the zones listed in that specific resource group
+ results = self.list_resource_group()
+ else:
+ # all the zones in a subscription
+ results = self.list_items()
+
+ self.results['ansible_info']['azure_dnszones'] = self.serialize_items(results)
+ self.results['dnszones'] = self.curated_items(results)
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ results = []
+ # get specific zone
+ try:
+ item = self.dns_client.zones.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ # serialize result
+ if item and self.has_tags(item.tags, self.tags):
+ results = [item]
+ return results
+
+ def list_resource_group(self):
+ self.log('List items for resource group')
+ try:
+ response = self.dns_client.zones.list_by_resource_group(self.resource_group)
+ except AzureHttpError as exc:
+ self.fail("Failed to list for resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item)
+ return results
+
+ def list_items(self):
+ self.log('List all items')
+ try:
+ response = self.dns_client.zones.list()
+ except AzureHttpError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item)
+ return results
+
+ def serialize_items(self, raws):
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raws] if raws else []
+
+ def curated_items(self, raws):
+ return [self.zone_to_dict(item) for item in raws] if raws else []
+
+ def zone_to_dict(self, zone):
+ return dict(
+ id=zone.id,
+ name=zone.name,
+ number_of_record_sets=zone.number_of_record_sets,
+ max_number_of_record_sets=zone.max_number_of_record_sets,
+ name_servers=zone.name_servers,
+ tags=zone.tags,
+ type=zone.zone_type.value.lower(),
+ registration_virtual_networks=[to_native(x.id) for x in zone.registration_virtual_networks] if zone.registration_virtual_networks else None,
+ resolution_virtual_networks=[to_native(x.id) for x in zone.resolution_virtual_networks] if zone.resolution_virtual_networks else None
+ )
+
+
+def main():
+ AzureRMDNSZoneInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnszone_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnszone_info.py
new file mode 100644
index 00000000..6bfa2e91
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_dnszone_info.py
@@ -0,0 +1,258 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Obezimnaka Boms, <t-ozboms@microsoft.com>
+#
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_dnszone_info
+
+
+short_description: Get DNS zone facts
+
+description:
+ - Get facts for a specific DNS zone or all DNS zones within a resource group.
+
+options:
+ resource_group:
+ description:
+ - Limit results by resource group. Required when filtering by name.
+ name:
+ description:
+ - Only show results for a specific zone.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Obezimnaka Boms (@ozboms)
+
+'''
+
+EXAMPLES = '''
+- name: Get facts for one zone
+ community.azure.azure_rm_dnszone_info:
+ resource_group: myResourceGroup
+ name: foobar22
+
+- name: Get facts for all zones in a resource group
+ community.azure.azure_rm_dnszone_info:
+ resource_group: myResourceGroup
+
+- name: Get facts by tags
+ community.azure.azure_rm_dnszone_info:
+ tags:
+ - testing
+'''
+
+RETURN = '''
+azure_dnszones:
+ description:
+ - List of zone dicts.
+ returned: always
+ type: list
+ example: [{
+ "etag": "00000002-0000-0000-0dcb-df5776efd201",
+ "location": "global",
+ "properties": {
+ "maxNumberOfRecordSets": 5000,
+ "numberOfRecordSets": 15
+ },
+ "tags": {}
+ }]
+dnszones:
+ description:
+ - List of zone dicts, which share the same layout as azure_rm_dnszone module parameter.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - id of the DNS Zone.
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/dnszones/azure.com"
+ name:
+ description:
+ - name of the DNS zone.
+ sample: azure.com
+ type:
+ description:
+ - The type of this DNS zone (C(public) or C(private)).
+ sample: private
+ registration_virtual_networks:
+ description:
+ - A list of references to virtual networks that register hostnames in this DNS zone.
+ type: list
+ sample: ["/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/bar"]
+ resolution_virtual_networks:
+ description:
+ - A list of references to virtual networks that resolve records in this DNS zone.
+ type: list
+ sample: ["/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/deadbeef"]
+ number_of_record_sets:
+ description:
+ - The current number of record sets in this DNS zone.
+ type: int
+ sample: 2
+ max_number_of_record_sets:
+ description:
+ - The maximum number of record sets that can be created in this DNS zone.
+ type: int
+ sample: 5000
+ name_servers:
+ description:
+ - The name servers for this DNS zone.
+ type: list
+ sample: [
+ "ns1-03.azure-dns.com.",
+ "ns2-03.azure-dns.net.",
+ "ns3-03.azure-dns.org.",
+ "ns4-03.azure-dns.info."
+ ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils._text import to_native
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'DnsZone'
+
+
+class AzureRMDNSZoneInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ # store the results of the module operation
+ self.results = dict(
+ changed=False,
+ ansible_info=dict(azure_dnszones=[])
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMDNSZoneInfo, self).__init__(self.module_arg_spec)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_dnszone_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_dnszone_facts' module has been renamed to 'azure_rm_dnszone_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ results = []
+ # list the conditions and what to return based on user input
+ if self.name is not None:
+ # if there is a name, facts about that specific zone
+ results = self.get_item()
+ elif self.resource_group:
+ # all the zones listed in that specific resource group
+ results = self.list_resource_group()
+ else:
+ # all the zones in a subscription
+ results = self.list_items()
+
+ self.results['ansible_info']['azure_dnszones'] = self.serialize_items(results)
+ self.results['dnszones'] = self.curated_items(results)
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ results = []
+ # get specific zone
+ try:
+ item = self.dns_client.zones.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ # serialize result
+ if item and self.has_tags(item.tags, self.tags):
+ results = [item]
+ return results
+
+ def list_resource_group(self):
+ self.log('List items for resource group')
+ try:
+ response = self.dns_client.zones.list_by_resource_group(self.resource_group)
+ except AzureHttpError as exc:
+ self.fail("Failed to list for resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item)
+ return results
+
+ def list_items(self):
+ self.log('List all items')
+ try:
+ response = self.dns_client.zones.list()
+ except AzureHttpError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item)
+ return results
+
+ def serialize_items(self, raws):
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raws] if raws else []
+
+ def curated_items(self, raws):
+ return [self.zone_to_dict(item) for item in raws] if raws else []
+
+ def zone_to_dict(self, zone):
+ return dict(
+ id=zone.id,
+ name=zone.name,
+ number_of_record_sets=zone.number_of_record_sets,
+ max_number_of_record_sets=zone.max_number_of_record_sets,
+ name_servers=zone.name_servers,
+ tags=zone.tags,
+ type=zone.zone_type.value.lower(),
+ registration_virtual_networks=[to_native(x.id) for x in zone.registration_virtual_networks] if zone.registration_virtual_networks else None,
+ resolution_virtual_networks=[to_native(x.id) for x in zone.resolution_virtual_networks] if zone.resolution_virtual_networks else None
+ )
+
+
+def main():
+ AzureRMDNSZoneInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_functionapp_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_functionapp_facts.py
new file mode 100644
index 00000000..2fb06115
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_functionapp_facts.py
@@ -0,0 +1,206 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Thomas Stringer, <tomstr@microsoft.com>
+
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_functionapp_info
+short_description: Get Azure Function App facts
+description:
+ - Get facts for one Azure Function App or all Function Apps within a resource group.
+options:
+ name:
+ description:
+ - Only show results for a specific Function App.
+ resource_group:
+ description:
+ - Limit results to a resource group. Required when filtering by name.
+ aliases:
+ - resource_group_name
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Thomas Stringer (@trstringer)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one Function App
+ community.azure.azure_rm_functionapp_info:
+ resource_group: myResourceGroup
+ name: myfunctionapp
+
+ - name: Get facts for all Function Apps in a resource group
+ community.azure.azure_rm_functionapp_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts for all Function Apps by tags
+ community.azure.azure_rm_functionapp_info:
+ tags:
+ - testing
+'''
+
+RETURN = '''
+azure_functionapps:
+ description:
+ - List of Azure Function Apps dicts.
+ returned: always
+ type: list
+ example:
+ id: /subscriptions/.../resourceGroups/ansible-rg/providers/Microsoft.Web/sites/myfunctionapp
+ name: myfunctionapp
+ kind: functionapp
+ location: East US
+ type: Microsoft.Web/sites
+ state: Running
+ host_names:
+ - myfunctionapp.azurewebsites.net
+ repository_site_name: myfunctionapp
+ usage_state: Normal
+ enabled: true
+ enabled_host_names:
+ - myfunctionapp.azurewebsites.net
+ - myfunctionapp.scm.azurewebsites.net
+ availability_state: Normal
+ host_name_ssl_states:
+ - name: myfunctionapp.azurewebsites.net
+ ssl_state: Disabled
+ host_type: Standard
+ - name: myfunctionapp.scm.azurewebsites.net
+ ssl_state: Disabled
+ host_type: Repository
+ server_farm_id: /subscriptions/.../resourceGroups/ansible-rg/providers/Microsoft.Web/serverfarms/EastUSPlan
+ reserved: false
+ last_modified_time_utc: '2017-08-22T18:54:01.190Z'
+ scm_site_also_stopped: false
+ client_affinity_enabled: true
+ client_cert_enabled: false
+ host_names_disabled: false
+ outbound_ip_addresses: ............
+ container_size: 1536
+ daily_memory_time_quota: 0
+ resource_group: myResourceGroup
+ default_host_name: myfunctionapp.azurewebsites.net
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+class AzureRMFunctionAppInfo(AzureRMModuleBase):
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str', aliases=['resource_group_name']),
+ tags=dict(type='list'),
+ )
+
+ self.results = dict(
+ changed=False,
+ ansible_info=dict(azure_functionapps=[])
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMFunctionAppInfo, self).__init__(
+ self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_functionapp_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_functionapp_facts' module has been renamed to 'azure_rm_functionapp_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ self.results['ansible_info']['azure_functionapps'] = self.get_functionapp()
+ elif self.resource_group:
+ self.results['ansible_info']['azure_functionapps'] = self.list_resource_group()
+ else:
+ self.results['ansible_info']['azure_functionapps'] = self.list_all()
+
+ return self.results
+
+ def get_functionapp(self):
+ self.log('Get properties for Function App {0}'.format(self.name))
+ function_app = None
+ result = []
+
+ try:
+ function_app = self.web_client.web_apps.get(
+ self.resource_group,
+ self.name
+ )
+ except CloudError:
+ pass
+
+ if function_app and self.has_tags(function_app.tags, self.tags):
+ result = function_app.as_dict()
+
+ return [result]
+
+ def list_resource_group(self):
+ self.log('List items')
+ try:
+ response = self.web_client.web_apps.list_by_resource_group(self.resource_group)
+ except Exception as exc:
+ self.fail("Error listing for resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item.as_dict())
+ return results
+
+ def list_all(self):
+ self.log('List all items')
+ try:
+ response = self.web_client.web_apps.list_by_resource_group(self.resource_group)
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item.as_dict())
+ return results
+
+
+def main():
+ AzureRMFunctionAppInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_functionapp_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_functionapp_info.py
new file mode 100644
index 00000000..2fb06115
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_functionapp_info.py
@@ -0,0 +1,206 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Thomas Stringer, <tomstr@microsoft.com>
+
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_functionapp_info
+short_description: Get Azure Function App facts
+description:
+ - Get facts for one Azure Function App or all Function Apps within a resource group.
+options:
+ name:
+ description:
+ - Only show results for a specific Function App.
+ resource_group:
+ description:
+ - Limit results to a resource group. Required when filtering by name.
+ aliases:
+ - resource_group_name
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Thomas Stringer (@trstringer)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one Function App
+ community.azure.azure_rm_functionapp_info:
+ resource_group: myResourceGroup
+ name: myfunctionapp
+
+ - name: Get facts for all Function Apps in a resource group
+ community.azure.azure_rm_functionapp_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts for all Function Apps by tags
+ community.azure.azure_rm_functionapp_info:
+ tags:
+ - testing
+'''
+
+RETURN = '''
+azure_functionapps:
+ description:
+ - List of Azure Function Apps dicts.
+ returned: always
+ type: list
+ example:
+ id: /subscriptions/.../resourceGroups/ansible-rg/providers/Microsoft.Web/sites/myfunctionapp
+ name: myfunctionapp
+ kind: functionapp
+ location: East US
+ type: Microsoft.Web/sites
+ state: Running
+ host_names:
+ - myfunctionapp.azurewebsites.net
+ repository_site_name: myfunctionapp
+ usage_state: Normal
+ enabled: true
+ enabled_host_names:
+ - myfunctionapp.azurewebsites.net
+ - myfunctionapp.scm.azurewebsites.net
+ availability_state: Normal
+ host_name_ssl_states:
+ - name: myfunctionapp.azurewebsites.net
+ ssl_state: Disabled
+ host_type: Standard
+ - name: myfunctionapp.scm.azurewebsites.net
+ ssl_state: Disabled
+ host_type: Repository
+ server_farm_id: /subscriptions/.../resourceGroups/ansible-rg/providers/Microsoft.Web/serverfarms/EastUSPlan
+ reserved: false
+ last_modified_time_utc: '2017-08-22T18:54:01.190Z'
+ scm_site_also_stopped: false
+ client_affinity_enabled: true
+ client_cert_enabled: false
+ host_names_disabled: false
+ outbound_ip_addresses: ............
+ container_size: 1536
+ daily_memory_time_quota: 0
+ resource_group: myResourceGroup
+ default_host_name: myfunctionapp.azurewebsites.net
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+class AzureRMFunctionAppInfo(AzureRMModuleBase):
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str', aliases=['resource_group_name']),
+ tags=dict(type='list'),
+ )
+
+ self.results = dict(
+ changed=False,
+ ansible_info=dict(azure_functionapps=[])
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMFunctionAppInfo, self).__init__(
+ self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_functionapp_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_functionapp_facts' module has been renamed to 'azure_rm_functionapp_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ self.results['ansible_info']['azure_functionapps'] = self.get_functionapp()
+ elif self.resource_group:
+ self.results['ansible_info']['azure_functionapps'] = self.list_resource_group()
+ else:
+ self.results['ansible_info']['azure_functionapps'] = self.list_all()
+
+ return self.results
+
+ def get_functionapp(self):
+ self.log('Get properties for Function App {0}'.format(self.name))
+ function_app = None
+ result = []
+
+ try:
+ function_app = self.web_client.web_apps.get(
+ self.resource_group,
+ self.name
+ )
+ except CloudError:
+ pass
+
+ if function_app and self.has_tags(function_app.tags, self.tags):
+ result = function_app.as_dict()
+
+ return [result]
+
+ def list_resource_group(self):
+ self.log('List items')
+ try:
+ response = self.web_client.web_apps.list_by_resource_group(self.resource_group)
+ except Exception as exc:
+ self.fail("Error listing for resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item.as_dict())
+ return results
+
+ def list_all(self):
+ self.log('List all items')
+ try:
+ response = self.web_client.web_apps.list_by_resource_group(self.resource_group)
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item.as_dict())
+ return results
+
+
+def main():
+ AzureRMFunctionAppInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_hdinsightcluster_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_hdinsightcluster_facts.py
new file mode 100644
index 00000000..bd29e460
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_hdinsightcluster_facts.py
@@ -0,0 +1,321 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_hdinsightcluster_info
+short_description: Get Azure HDInsight Cluster facts
+description:
+ - Get facts of Azure HDInsight Cluster.
+
+options:
+ resource_group:
+ description:
+ - Name of an Azure resource group.
+ name:
+ description:
+ - HDInsight cluster name.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of HDInsight Cluster
+ community.azure.azure_rm_hdinsightcluster_info:
+ resource_group: myResourceGroup
+ name: myCluster
+
+ - name: List instances of HDInsight Cluster
+ community.azure.azure_rm_hdinsightcluster_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+clusters:
+ description:
+ - A list of dictionaries containing facts for HDInsight Cluster.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The unique resource identifier of the HDInsight Cluster.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.HDInsight/clusters/myCluster"
+ resource_group:
+ description:
+ - Name of an Azure resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - The name of the HDInsight Cluster.
+ returned: always
+ type: str
+ sample: testaccount
+ location:
+ description:
+ - The location of the resource group to which the resource belongs.
+ returned: always
+ type: str
+ sample: westus
+ cluster_version:
+ description:
+ - The version of the cluster.
+ returned: always
+ type: str
+ sample: 3.6.1000.67
+ os_type:
+ description:
+ - The type of operating system.
+ returned: always
+ type: str
+ sample: linux
+ tier:
+ description:
+ - The cluster tier.
+ returned: always
+ type: str
+ sample: standard
+ cluster_definition:
+ description:
+ - The cluster definition.
+ contains:
+ kind:
+ description:
+ - The type of cluster.
+ returned: always
+ type: str
+ sample: spark
+ compute_profile_roles:
+ description:
+ - The list of roles in the cluster.
+ type: list
+ contains:
+ name:
+ description:
+ - The name of the role.
+ returned: always
+ type: str
+ sample: headnode
+ target_instance_count:
+ description:
+ - The instance count of the cluster.
+ returned: always
+ type: int
+ sample: 2
+ vm_size:
+ description:
+ - The size of the VM.
+ returned: always
+ type: str
+ sample: Standard_D3
+ linux_profile:
+ description:
+ - The Linux OS profile.
+ contains:
+ username:
+ description:
+ - User name.
+ returned: always
+ type: str
+ sample: myuser
+ connectivity_endpoints:
+ description:
+ - Cluster's connectivity endpoints.
+ type: list
+ contains:
+ location:
+ description:
+ - Endpoint location.
+ returned: always
+ type: str
+ sample: myCluster-ssh.azurehdinsight.net
+ name:
+ description:
+ - Endpoint name.
+ returned: always
+ type: str
+ sample: SSH
+ port:
+ description:
+ - Endpoint port.
+ returned: always
+ type: int
+ sample: 22
+ protocol:
+ description:
+ - Endpoint protocol.
+ returned: always
+ type: str
+ sample: TCP
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: {}
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.hdinsight import HDInsightManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMHDInsightclusterInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+
+ super(AzureRMHDInsightclusterInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_hdinsightcluster_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_hdinsightcluster_facts' module has been renamed to 'azure_rm_hdinsightcluster_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(HDInsightManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['clusters'] = self.get()
+ elif self.resource_group is not None:
+ self.results['clusters'] = self.list_by_resource_group()
+ else:
+ self.results['clusters'] = self.list_all()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.clusters.get(resource_group_name=self.resource_group,
+ cluster_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for HDInsight Cluster.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.clusters.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for HDInsight Cluster.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def list_all(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.clusters.list()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for HDInsight Cluster.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id'),
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'name': d.get('name', None),
+ 'location': d.get('location', '').replace(' ', '').lower(),
+
+ 'cluster_version': d.get('properties', {}).get('cluster_version'),
+ 'os_type': d.get('properties', {}).get('os_type'),
+ 'tier': d.get('properties', {}).get('tier'),
+ 'cluster_definition': {
+ 'kind': d.get('properties', {}).get('cluster_definition', {}).get('kind')
+ },
+ 'compute_profile_roles': [{
+ 'name': item.get('name'),
+ 'target_instance_count': item.get('target_instance_count'),
+ 'vm_size': item.get('hardware_profile', {}).get('vm_size'),
+ 'linux_profile': {
+ 'username': item.get('os_profile', {}).get('linux_operating_system_profile', {}).get('username')
+ }
+ } for item in d.get('properties', []).get('compute_profile', {}).get('roles', [])],
+ 'connectivity_endpoints': d.get('properties', {}).get('connectivity_endpoints'),
+ 'tags': d.get('tags', None)
+ }
+
+ return d
+
+
+def main():
+ AzureRMHDInsightclusterInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_hdinsightcluster_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_hdinsightcluster_info.py
new file mode 100644
index 00000000..bd29e460
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_hdinsightcluster_info.py
@@ -0,0 +1,321 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_hdinsightcluster_info
+short_description: Get Azure HDInsight Cluster facts
+description:
+ - Get facts of Azure HDInsight Cluster.
+
+options:
+ resource_group:
+ description:
+ - Name of an Azure resource group.
+ name:
+ description:
+ - HDInsight cluster name.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of HDInsight Cluster
+ community.azure.azure_rm_hdinsightcluster_info:
+ resource_group: myResourceGroup
+ name: myCluster
+
+ - name: List instances of HDInsight Cluster
+ community.azure.azure_rm_hdinsightcluster_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+clusters:
+ description:
+ - A list of dictionaries containing facts for HDInsight Cluster.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - The unique resource identifier of the HDInsight Cluster.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.HDInsight/clusters/myCluster"
+ resource_group:
+ description:
+ - Name of an Azure resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - The name of the HDInsight Cluster.
+ returned: always
+ type: str
+ sample: testaccount
+ location:
+ description:
+ - The location of the resource group to which the resource belongs.
+ returned: always
+ type: str
+ sample: westus
+ cluster_version:
+ description:
+ - The version of the cluster.
+ returned: always
+ type: str
+ sample: 3.6.1000.67
+ os_type:
+ description:
+ - The type of operating system.
+ returned: always
+ type: str
+ sample: linux
+ tier:
+ description:
+ - The cluster tier.
+ returned: always
+ type: str
+ sample: standard
+ cluster_definition:
+ description:
+ - The cluster definition.
+ contains:
+ kind:
+ description:
+ - The type of cluster.
+ returned: always
+ type: str
+ sample: spark
+ compute_profile_roles:
+ description:
+ - The list of roles in the cluster.
+ type: list
+ contains:
+ name:
+ description:
+ - The name of the role.
+ returned: always
+ type: str
+ sample: headnode
+ target_instance_count:
+ description:
+ - The instance count of the cluster.
+ returned: always
+ type: int
+ sample: 2
+ vm_size:
+ description:
+ - The size of the VM.
+ returned: always
+ type: str
+ sample: Standard_D3
+ linux_profile:
+ description:
+ - The Linux OS profile.
+ contains:
+ username:
+ description:
+ - User name.
+ returned: always
+ type: str
+ sample: myuser
+ connectivity_endpoints:
+ description:
+ - Cluster's connectivity endpoints.
+ type: list
+ contains:
+ location:
+ description:
+ - Endpoint location.
+ returned: always
+ type: str
+ sample: myCluster-ssh.azurehdinsight.net
+ name:
+ description:
+ - Endpoint name.
+ returned: always
+ type: str
+ sample: SSH
+ port:
+ description:
+ - Endpoint port.
+ returned: always
+ type: int
+ sample: 22
+ protocol:
+ description:
+ - Endpoint protocol.
+ returned: always
+ type: str
+ sample: TCP
+ tags:
+ description:
+ - The tags of the resource.
+ returned: always
+ type: complex
+ sample: {}
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.hdinsight import HDInsightManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMHDInsightclusterInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+
+ super(AzureRMHDInsightclusterInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_hdinsightcluster_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_hdinsightcluster_facts' module has been renamed to 'azure_rm_hdinsightcluster_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(HDInsightManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['clusters'] = self.get()
+ elif self.resource_group is not None:
+ self.results['clusters'] = self.list_by_resource_group()
+ else:
+ self.results['clusters'] = self.list_all()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.clusters.get(resource_group_name=self.resource_group,
+ cluster_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for HDInsight Cluster.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.clusters.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for HDInsight Cluster.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def list_all(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.clusters.list()
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for HDInsight Cluster.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id'),
+ 'resource_group': self.parse_resource_to_dict(d.get('id')).get('resource_group'),
+ 'name': d.get('name', None),
+ 'location': d.get('location', '').replace(' ', '').lower(),
+
+ 'cluster_version': d.get('properties', {}).get('cluster_version'),
+ 'os_type': d.get('properties', {}).get('os_type'),
+ 'tier': d.get('properties', {}).get('tier'),
+ 'cluster_definition': {
+ 'kind': d.get('properties', {}).get('cluster_definition', {}).get('kind')
+ },
+ 'compute_profile_roles': [{
+ 'name': item.get('name'),
+ 'target_instance_count': item.get('target_instance_count'),
+ 'vm_size': item.get('hardware_profile', {}).get('vm_size'),
+ 'linux_profile': {
+ 'username': item.get('os_profile', {}).get('linux_operating_system_profile', {}).get('username')
+ }
+ } for item in d.get('properties', []).get('compute_profile', {}).get('roles', [])],
+ 'connectivity_endpoints': d.get('properties', {}).get('connectivity_endpoints'),
+ 'tags': d.get('tags', None)
+ }
+
+ return d
+
+
+def main():
+ AzureRMHDInsightclusterInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_image_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_image_facts.py
new file mode 100644
index 00000000..142d51d8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_image_facts.py
@@ -0,0 +1,307 @@
+#!/usr/bin/python
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_image_info
+
+
+short_description: Get facts about azure custom images
+
+description:
+ - List azure custom images. The images can be listed where scope of listing can be based on subscription, resource group, name or tags.
+
+options:
+ resource_group:
+ description:
+ - Name of resource group.
+ name:
+ description:
+ - Name of the image to filter from existing images.
+ tags:
+ description:
+ - List of tags to be matched.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Madhura Naniwadekar (@Madhura-CSI)
+'''
+
+
+EXAMPLES = '''
+- name: List images with name
+ community.azure.azure_rm_image_info:
+ name: test-image
+ resource_group: myResourceGroup
+
+- name: List images by resource group
+ community.azure.azure_rm_image_info:
+ resource_group: myResourceGroup
+ tags:
+ - testing
+ - foo:bar
+
+- name: List all available images under current subscription
+ community.azure.azure_rm_image_info:
+'''
+
+
+RETURN = '''
+images:
+ description:
+ - List of image dicts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Id of the image.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/xx
+ name:
+ description:
+ - Name of the image.
+ returned: always
+ type: str
+ resource_group:
+ description:
+ - Resource group of the image.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ location:
+ description:
+ - Location of the image.
+ returned: always
+ type: str
+ os_disk:
+ description:
+ - Id of os disk for image.
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/xx
+ os_disk_caching:
+ description:
+ - Specifies caching requirements for the image.
+ returned: always
+ type: str
+ os_state:
+ description:
+ - Specifies image operating system state. Possible values are C(Generalized) or C(Specialized).
+ returned: always
+ type: str
+ sample: Generalized
+ os_storage_account_type:
+ description:
+ - Specifies the storage account type for the managed disk.
+ type: str
+ sample: Standard_LRS
+ os_type:
+ description:
+ - Type of OS for image.
+ returned: always
+ type: str
+ sample: Linux
+ provisioning_state:
+ description:
+ - State of image.
+ returned: always
+ type: str
+ sample: Succeeded
+ source:
+ description:
+ - Resource id of source VM from which the image is created.
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/xx
+ tags:
+ description:
+ - Dictionary of tags associated with the image.
+ type: complex
+ data_disks:
+ description:
+ - List of data disks associated with the image.
+ type: complex
+ returned: always
+ contains:
+ caching:
+ description:
+ - Type of caching of data disk.
+ sample: read_only
+ disk_size_gb:
+ description:
+ - Specifies the size of empty data disks in gigabytes.
+ returned: always
+ type: int
+ sample: 50
+ lun:
+ description:
+ - Specifies the logical unit number of the data disk.
+ returned: always
+ type: int
+ sample: 0
+ storage_account_type:
+ description:
+ - Specifies the storage account type for the managed disk data disk.
+ type: str
+ sample: Standard_LRS
+ managed_disk_id:
+ description:
+ - Id of managed disk.
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/xx
+ blob_uri:
+ description:
+ - The virtual hard disk.
+'''
+
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMImageInfo(AzureRMModuleBase):
+
+ def __init__(self, **kwargs):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str'),
+ name=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.format = None
+ self.tags = None
+
+ super(AzureRMImageInfo, self).__init__(
+ derived_arg_spec=self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_image_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_image_facts' module has been renamed to 'azure_rm_image_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and self.resource_group:
+ self.results['images'] = self.get_image(self.resource_group, self.name)
+ elif self.name and not self.resource_group:
+ self.results['images'] = self.list_images(self.name)
+ elif not self.name and self.resource_group:
+ self.results['images'] = self.list_images_by_resource_group(self.resource_group)
+ elif not self.name and not self.resource_group:
+ self.results['images'] = self.list_images()
+ return self.results
+
+ def get_image(self, resource_group, image_name):
+ '''
+ Returns image details based on its name
+ '''
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ result = []
+ item = None
+ try:
+ item = self.compute_client.images.get(resource_group, image_name)
+ except CloudError as exc:
+ self.fail('Failed to list images - {0}'.format(str(exc)))
+
+ result = [self.format_item(item)]
+ return result
+
+ def list_images_by_resource_group(self, resource_group):
+ '''
+ Returns image details based on its resource group
+ '''
+
+ self.log('List images filtered by resource group')
+ response = None
+ try:
+ response = self.compute_client.images.list_by_resource_group(resource_group)
+ except CloudError as exc:
+ self.fail("Failed to list images: {0}".format(str(exc)))
+
+ return [self.format_item(x) for x in response if self.has_tags(x.tags, self.tags)] if response else []
+
+ def list_images(self, image_name=None):
+ '''
+ Returns image details in current subscription
+ '''
+
+ self.log('List images within current subscription')
+ response = None
+ results = []
+ try:
+ response = self.compute_client.images.list()
+ except CloudError as exc:
+ self.fail("Failed to list all images: {0}".format(str(exc)))
+
+ results = [self.format_item(x) for x in response if self.has_tags(x.tags, self.tags)] if response else []
+ if image_name:
+ results = [result for result in results if result['name'] == image_name]
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+
+ for data_disk in d['storage_profile']['data_disks']:
+ if 'managed_disk' in data_disk.keys():
+ data_disk['managed_disk_id'] = data_disk['managed_disk']['id']
+ data_disk.pop('managed_disk', None)
+
+ d = {
+ 'id': d['id'],
+ 'resource_group': d['id'].split('/')[4],
+ 'name': d['name'],
+ 'location': d['location'],
+ 'tags': d.get('tags'),
+ 'source': d['source_virtual_machine']['id'] if 'source_virtual_machine' in d.keys() else None,
+ 'os_type': d['storage_profile']['os_disk']['os_type'],
+ 'os_state': d['storage_profile']['os_disk']['os_state'],
+ 'os_disk_caching': d['storage_profile']['os_disk']['caching'],
+ 'os_storage_account_type': d['storage_profile']['os_disk']['storage_account_type'],
+ 'os_disk': d['storage_profile']['os_disk']['managed_disk']['id'] if 'managed_disk' in d['storage_profile']['os_disk'].keys() else None,
+ 'os_blob_uri': d['storage_profile']['os_disk']['blob_uri'] if 'blob_uri' in d['storage_profile']['os_disk'].keys() else None,
+ 'provisioning_state': d['provisioning_state'],
+ 'data_disks': d['storage_profile']['data_disks']
+ }
+ return d
+
+
+def main():
+ AzureRMImageInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_image_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_image_info.py
new file mode 100644
index 00000000..142d51d8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_image_info.py
@@ -0,0 +1,307 @@
+#!/usr/bin/python
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_image_info
+
+
+short_description: Get facts about azure custom images
+
+description:
+ - List azure custom images. The images can be listed where scope of listing can be based on subscription, resource group, name or tags.
+
+options:
+ resource_group:
+ description:
+ - Name of resource group.
+ name:
+ description:
+ - Name of the image to filter from existing images.
+ tags:
+ description:
+ - List of tags to be matched.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Madhura Naniwadekar (@Madhura-CSI)
+'''
+
+
+EXAMPLES = '''
+- name: List images with name
+ community.azure.azure_rm_image_info:
+ name: test-image
+ resource_group: myResourceGroup
+
+- name: List images by resource group
+ community.azure.azure_rm_image_info:
+ resource_group: myResourceGroup
+ tags:
+ - testing
+ - foo:bar
+
+- name: List all available images under current subscription
+ community.azure.azure_rm_image_info:
+'''
+
+
+RETURN = '''
+images:
+ description:
+ - List of image dicts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Id of the image.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/xx
+ name:
+ description:
+ - Name of the image.
+ returned: always
+ type: str
+ resource_group:
+ description:
+ - Resource group of the image.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ location:
+ description:
+ - Location of the image.
+ returned: always
+ type: str
+ os_disk:
+ description:
+ - Id of os disk for image.
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/xx
+ os_disk_caching:
+ description:
+ - Specifies caching requirements for the image.
+ returned: always
+ type: str
+ os_state:
+ description:
+ - Specifies image operating system state. Possible values are C(Generalized) or C(Specialized).
+ returned: always
+ type: str
+ sample: Generalized
+ os_storage_account_type:
+ description:
+ - Specifies the storage account type for the managed disk.
+ type: str
+ sample: Standard_LRS
+ os_type:
+ description:
+ - Type of OS for image.
+ returned: always
+ type: str
+ sample: Linux
+ provisioning_state:
+ description:
+ - State of image.
+ returned: always
+ type: str
+ sample: Succeeded
+ source:
+ description:
+ - Resource id of source VM from which the image is created.
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/xx
+ tags:
+ description:
+ - Dictionary of tags associated with the image.
+ type: complex
+ data_disks:
+ description:
+ - List of data disks associated with the image.
+ type: complex
+ returned: always
+ contains:
+ caching:
+ description:
+ - Type of caching of data disk.
+ sample: read_only
+ disk_size_gb:
+ description:
+ - Specifies the size of empty data disks in gigabytes.
+ returned: always
+ type: int
+ sample: 50
+ lun:
+ description:
+ - Specifies the logical unit number of the data disk.
+ returned: always
+ type: int
+ sample: 0
+ storage_account_type:
+ description:
+ - Specifies the storage account type for the managed disk data disk.
+ type: str
+ sample: Standard_LRS
+ managed_disk_id:
+ description:
+ - Id of managed disk.
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/xx
+ blob_uri:
+ description:
+ - The virtual hard disk.
+'''
+
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMImageInfo(AzureRMModuleBase):
+
+ def __init__(self, **kwargs):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str'),
+ name=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.format = None
+ self.tags = None
+
+ super(AzureRMImageInfo, self).__init__(
+ derived_arg_spec=self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_image_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_image_facts' module has been renamed to 'azure_rm_image_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and self.resource_group:
+ self.results['images'] = self.get_image(self.resource_group, self.name)
+ elif self.name and not self.resource_group:
+ self.results['images'] = self.list_images(self.name)
+ elif not self.name and self.resource_group:
+ self.results['images'] = self.list_images_by_resource_group(self.resource_group)
+ elif not self.name and not self.resource_group:
+ self.results['images'] = self.list_images()
+ return self.results
+
+ def get_image(self, resource_group, image_name):
+ '''
+ Returns image details based on its name
+ '''
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ result = []
+ item = None
+ try:
+ item = self.compute_client.images.get(resource_group, image_name)
+ except CloudError as exc:
+ self.fail('Failed to list images - {0}'.format(str(exc)))
+
+ result = [self.format_item(item)]
+ return result
+
+ def list_images_by_resource_group(self, resource_group):
+ '''
+ Returns image details based on its resource group
+ '''
+
+ self.log('List images filtered by resource group')
+ response = None
+ try:
+ response = self.compute_client.images.list_by_resource_group(resource_group)
+ except CloudError as exc:
+ self.fail("Failed to list images: {0}".format(str(exc)))
+
+ return [self.format_item(x) for x in response if self.has_tags(x.tags, self.tags)] if response else []
+
+ def list_images(self, image_name=None):
+ '''
+ Returns image details in current subscription
+ '''
+
+ self.log('List images within current subscription')
+ response = None
+ results = []
+ try:
+ response = self.compute_client.images.list()
+ except CloudError as exc:
+ self.fail("Failed to list all images: {0}".format(str(exc)))
+
+ results = [self.format_item(x) for x in response if self.has_tags(x.tags, self.tags)] if response else []
+ if image_name:
+ results = [result for result in results if result['name'] == image_name]
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+
+ for data_disk in d['storage_profile']['data_disks']:
+ if 'managed_disk' in data_disk.keys():
+ data_disk['managed_disk_id'] = data_disk['managed_disk']['id']
+ data_disk.pop('managed_disk', None)
+
+ d = {
+ 'id': d['id'],
+ 'resource_group': d['id'].split('/')[4],
+ 'name': d['name'],
+ 'location': d['location'],
+ 'tags': d.get('tags'),
+ 'source': d['source_virtual_machine']['id'] if 'source_virtual_machine' in d.keys() else None,
+ 'os_type': d['storage_profile']['os_disk']['os_type'],
+ 'os_state': d['storage_profile']['os_disk']['os_state'],
+ 'os_disk_caching': d['storage_profile']['os_disk']['caching'],
+ 'os_storage_account_type': d['storage_profile']['os_disk']['storage_account_type'],
+ 'os_disk': d['storage_profile']['os_disk']['managed_disk']['id'] if 'managed_disk' in d['storage_profile']['os_disk'].keys() else None,
+ 'os_blob_uri': d['storage_profile']['os_disk']['blob_uri'] if 'blob_uri' in d['storage_profile']['os_disk'].keys() else None,
+ 'provisioning_state': d['provisioning_state'],
+ 'data_disks': d['storage_profile']['data_disks']
+ }
+ return d
+
+
+def main():
+ AzureRMImageInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loadbalancer_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loadbalancer_facts.py
new file mode 100644
index 00000000..e23f8fb8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loadbalancer_facts.py
@@ -0,0 +1,177 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2016, Thomas Stringer <tomstr@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_loadbalancer_info
+
+
+short_description: Get load balancer facts
+
+description:
+ - Get facts for a specific load balancer or all load balancers.
+
+options:
+ name:
+ description:
+ - Limit results to a specific resource group.
+ resource_group:
+ description:
+ - The resource group to search for the desired load balancer.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Thomas Stringer (@trstringer)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one load balancer
+ community.azure.azure_rm_loadbalancer_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all load balancers
+ community.azure.azure_rm_loadbalancer_info:
+
+ - name: Get facts for all load balancers in a specific resource group
+ community.azure.azure_rm_loadbalancer_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by tags
+ community.azure.azure_rm_loadbalancer_info:
+ tags:
+ - testing
+'''
+
+RETURN = '''
+azure_loadbalancers:
+ description:
+ - List of load balancer dicts.
+ returned: always
+ type: list
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'LoadBalancer'
+
+
+class AzureRMLoadBalancerInfo(AzureRMModuleBase):
+ """Utility class to get load balancer facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ ansible_info=dict(
+ azure_loadbalancers=[]
+ )
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMLoadBalancerInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_loadbalancer_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_loadbalancer_facts' module has been renamed to 'azure_rm_loadbalancer_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.results['ansible_info']['azure_loadbalancers'] = (
+ self.get_item() if self.name
+ else self.list_items()
+ )
+
+ return self.results
+
+ def get_item(self):
+ """Get a single load balancer"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.network_client.load_balancers.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_obj(item, AZURE_OBJECT_CLASS)]
+
+ return result
+
+ def list_items(self):
+ """Get all load balancers"""
+
+ self.log('List all load balancers')
+
+ if self.resource_group:
+ try:
+ response = self.network_client.load_balancers.list(self.resource_group)
+ except AzureHttpError as exc:
+ self.fail('Failed to list items in resource group {0} - {1}'.format(self.resource_group, str(exc)))
+ else:
+ try:
+ response = self.network_client.load_balancers.list_all()
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_obj(item, AZURE_OBJECT_CLASS))
+
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMLoadBalancerInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loadbalancer_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loadbalancer_info.py
new file mode 100644
index 00000000..e23f8fb8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loadbalancer_info.py
@@ -0,0 +1,177 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2016, Thomas Stringer <tomstr@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_loadbalancer_info
+
+
+short_description: Get load balancer facts
+
+description:
+ - Get facts for a specific load balancer or all load balancers.
+
+options:
+ name:
+ description:
+ - Limit results to a specific resource group.
+ resource_group:
+ description:
+ - The resource group to search for the desired load balancer.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Thomas Stringer (@trstringer)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one load balancer
+ community.azure.azure_rm_loadbalancer_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all load balancers
+ community.azure.azure_rm_loadbalancer_info:
+
+ - name: Get facts for all load balancers in a specific resource group
+ community.azure.azure_rm_loadbalancer_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by tags
+ community.azure.azure_rm_loadbalancer_info:
+ tags:
+ - testing
+'''
+
+RETURN = '''
+azure_loadbalancers:
+ description:
+ - List of load balancer dicts.
+ returned: always
+ type: list
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'LoadBalancer'
+
+
+class AzureRMLoadBalancerInfo(AzureRMModuleBase):
+ """Utility class to get load balancer facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ ansible_info=dict(
+ azure_loadbalancers=[]
+ )
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMLoadBalancerInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_loadbalancer_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_loadbalancer_facts' module has been renamed to 'azure_rm_loadbalancer_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ self.results['ansible_info']['azure_loadbalancers'] = (
+ self.get_item() if self.name
+ else self.list_items()
+ )
+
+ return self.results
+
+ def get_item(self):
+ """Get a single load balancer"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.network_client.load_balancers.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_obj(item, AZURE_OBJECT_CLASS)]
+
+ return result
+
+ def list_items(self):
+ """Get all load balancers"""
+
+ self.log('List all load balancers')
+
+ if self.resource_group:
+ try:
+ response = self.network_client.load_balancers.list(self.resource_group)
+ except AzureHttpError as exc:
+ self.fail('Failed to list items in resource group {0} - {1}'.format(self.resource_group, str(exc)))
+ else:
+ try:
+ response = self.network_client.load_balancers.list_all()
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_obj(item, AZURE_OBJECT_CLASS))
+
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMLoadBalancerInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_lock_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_lock_facts.py
new file mode 100644
index 00000000..396be25e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_lock_facts.py
@@ -0,0 +1,223 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_lock_info
+short_description: Manage Azure locks
+description:
+ - Create, delete an Azure lock.
+options:
+ name:
+ description:
+ - Name of the lock.
+ type: str
+ required: true
+ managed_resource_id:
+ description:
+ - ID of the resource where need to manage the lock.
+ - Get this via facts module.
+ - Cannot be set mutual with I(resource_group).
+ - Manage subscription if both I(managed_resource_id) and I(resource_group) not defined.
+ - "'/subscriptions/{subscriptionId}' for subscriptions."
+ - "'/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups."
+ - "'/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{namespace}/{resourceType}/{resourceName}' for resources."
+ - Can get all locks with 'child scope' for this resource, use I(managed_resource_id) in response for further management.
+ type: str
+ resource_group:
+ description:
+ - Resource group name where need to manage the lock.
+ - The lock is in the resource group level.
+ - Cannot be set mutual with I(managed_resource_id).
+ - Query subscription if both I(managed_resource_id) and I(resource_group) not defined.
+ - Can get all locks with 'child scope' in this resource group, use the I(managed_resource_id) in response for further management.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+- name: Get myLock details of myVM
+ community.azure.azure_rm_lock_info:
+ name: myLock
+ managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM
+
+- name: List locks of myVM
+ community.azure.azure_rm_lock_info:
+ managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM
+
+- name: List locks of myResourceGroup
+ community.azure.azure_rm_lock_info:
+ resource_group: myResourceGroup
+
+- name: List locks of myResourceGroup
+ community.azure.azure_rm_lock_info:
+ managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup
+
+- name: List locks of mySubscription
+ community.azure.azure_rm_lock_info:
+
+- name: List locks of mySubscription
+ community.azure.azure_rm_lock_info:
+ managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+'''
+
+RETURN = '''
+locks:
+ description:
+ - List of locks dicts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - ID of the Lock.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/locks/myLock"
+ name:
+ description:
+ - Name of the lock.
+ returned: always
+ type: str
+ sample: myLock
+ level:
+ description:
+ - Type level of the lock.
+ returned: always
+ type: str
+ sample: can_not_delete
+ notes:
+ description:
+ - Notes of the lock added by creator.
+ returned: always
+ type: str
+ sample: "This is a lock"
+''' # NOQA
+
+import json
+import re
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common_rest import GenericRestClient
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMLockInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ managed_resource_id=dict(type='str')
+ )
+
+ self.results = dict(
+ changed=False,
+ locks=[]
+ )
+
+ mutually_exclusive = [['resource_group', 'managed_resource_id']]
+
+ self.name = None
+ self.resource_group = None
+ self.managed_resource_id = None
+ self._mgmt_client = None
+ self._query_parameters = {'api-version': '2016-09-01'}
+ self._header_parameters = {'Content-Type': 'application/json; charset=utf-8'}
+
+ super(AzureRMLockInfo, self).__init__(self.module_arg_spec, facts_module=True, mutually_exclusive=mutually_exclusive, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_lock_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_lock_facts' module has been renamed to 'azure_rm_lock_info'", version='2.13')
+
+ for key in self.module_arg_spec.keys():
+ setattr(self, key, kwargs[key])
+
+ self._mgmt_client = self.get_mgmt_svc_client(GenericRestClient, base_url=self._cloud_environment.endpoints.resource_manager)
+ changed = False
+ # construct scope id
+ scope = self.get_scope()
+ url = '/{0}/providers/Microsoft.Authorization/locks'.format(scope)
+ if self.name:
+ url = '{0}/{1}'.format(url, self.name)
+ locks = self.list_locks(url)
+ resp = locks.get('value') if 'value' in locks else [locks]
+ self.results['locks'] = [self.to_dict(x) for x in resp]
+ return self.results
+
+ def to_dict(self, lock):
+ resp = dict(
+ id=lock['id'],
+ name=lock['name'],
+ level=_camel_to_snake(lock['properties']['level']),
+ managed_resource_id=re.sub('/providers/Microsoft.Authorization/locks/.+', '', lock['id'])
+ )
+ if lock['properties'].get('notes'):
+ resp['notes'] = lock['properties']['notes']
+ if lock['properties'].get('owners'):
+ resp['owners'] = [x['application_id'] for x in lock['properties']['owners']]
+ return resp
+
+ def list_locks(self, url):
+ try:
+ resp = self._mgmt_client.query(url=url,
+ method='GET',
+ query_parameters=self._query_parameters,
+ header_parameters=self._header_parameters,
+ body=None,
+ expected_status_codes=[200],
+ polling_timeout=None,
+ polling_interval=None)
+ return json.loads(resp.text)
+ except CloudError as exc:
+ self.fail('Error when finding locks {0}: {1}'.format(url, exc.message))
+
+ def get_scope(self):
+ '''
+ Get the resource scope of the lock management.
+ '/subscriptions/{subscriptionId}' for subscriptions,
+ '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups,
+ '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{namespace}/{resourceType}/{resourceName}' for resources.
+ '''
+ if self.managed_resource_id:
+ return self.managed_resource_id
+ elif self.resource_group:
+ return '/subscriptions/{0}/resourcegroups/{1}'.format(self.subscription_id, self.resource_group)
+ else:
+ return '/subscriptions/{0}'.format(self.subscription_id)
+
+
+def main():
+ AzureRMLockInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_lock_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_lock_info.py
new file mode 100644
index 00000000..396be25e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_lock_info.py
@@ -0,0 +1,223 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_lock_info
+short_description: Manage Azure locks
+description:
+ - Create, delete an Azure lock.
+options:
+ name:
+ description:
+ - Name of the lock.
+ type: str
+ required: true
+ managed_resource_id:
+ description:
+ - ID of the resource where need to manage the lock.
+ - Get this via facts module.
+ - Cannot be set mutual with I(resource_group).
+ - Manage subscription if both I(managed_resource_id) and I(resource_group) not defined.
+ - "'/subscriptions/{subscriptionId}' for subscriptions."
+ - "'/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups."
+ - "'/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{namespace}/{resourceType}/{resourceName}' for resources."
+ - Can get all locks with 'child scope' for this resource, use I(managed_resource_id) in response for further management.
+ type: str
+ resource_group:
+ description:
+ - Resource group name where need to manage the lock.
+ - The lock is in the resource group level.
+ - Cannot be set mutual with I(managed_resource_id).
+ - Query subscription if both I(managed_resource_id) and I(resource_group) not defined.
+ - Can get all locks with 'child scope' in this resource group, use the I(managed_resource_id) in response for further management.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+- name: Get myLock details of myVM
+ community.azure.azure_rm_lock_info:
+ name: myLock
+ managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM
+
+- name: List locks of myVM
+ community.azure.azure_rm_lock_info:
+ managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM
+
+- name: List locks of myResourceGroup
+ community.azure.azure_rm_lock_info:
+ resource_group: myResourceGroup
+
+- name: List locks of myResourceGroup
+ community.azure.azure_rm_lock_info:
+ managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup
+
+- name: List locks of mySubscription
+ community.azure.azure_rm_lock_info:
+
+- name: List locks of mySubscription
+ community.azure.azure_rm_lock_info:
+ managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+'''
+
+RETURN = '''
+locks:
+ description:
+ - List of locks dicts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - ID of the Lock.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Authorization/locks/myLock"
+ name:
+ description:
+ - Name of the lock.
+ returned: always
+ type: str
+ sample: myLock
+ level:
+ description:
+ - Type level of the lock.
+ returned: always
+ type: str
+ sample: can_not_delete
+ notes:
+ description:
+ - Notes of the lock added by creator.
+ returned: always
+ type: str
+ sample: "This is a lock"
+''' # NOQA
+
+import json
+import re
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common_rest import GenericRestClient
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMLockInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ managed_resource_id=dict(type='str')
+ )
+
+ self.results = dict(
+ changed=False,
+ locks=[]
+ )
+
+ mutually_exclusive = [['resource_group', 'managed_resource_id']]
+
+ self.name = None
+ self.resource_group = None
+ self.managed_resource_id = None
+ self._mgmt_client = None
+ self._query_parameters = {'api-version': '2016-09-01'}
+ self._header_parameters = {'Content-Type': 'application/json; charset=utf-8'}
+
+ super(AzureRMLockInfo, self).__init__(self.module_arg_spec, facts_module=True, mutually_exclusive=mutually_exclusive, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_lock_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_lock_facts' module has been renamed to 'azure_rm_lock_info'", version='2.13')
+
+ for key in self.module_arg_spec.keys():
+ setattr(self, key, kwargs[key])
+
+ self._mgmt_client = self.get_mgmt_svc_client(GenericRestClient, base_url=self._cloud_environment.endpoints.resource_manager)
+ changed = False
+ # construct scope id
+ scope = self.get_scope()
+ url = '/{0}/providers/Microsoft.Authorization/locks'.format(scope)
+ if self.name:
+ url = '{0}/{1}'.format(url, self.name)
+ locks = self.list_locks(url)
+ resp = locks.get('value') if 'value' in locks else [locks]
+ self.results['locks'] = [self.to_dict(x) for x in resp]
+ return self.results
+
+ def to_dict(self, lock):
+ resp = dict(
+ id=lock['id'],
+ name=lock['name'],
+ level=_camel_to_snake(lock['properties']['level']),
+ managed_resource_id=re.sub('/providers/Microsoft.Authorization/locks/.+', '', lock['id'])
+ )
+ if lock['properties'].get('notes'):
+ resp['notes'] = lock['properties']['notes']
+ if lock['properties'].get('owners'):
+ resp['owners'] = [x['application_id'] for x in lock['properties']['owners']]
+ return resp
+
+ def list_locks(self, url):
+ try:
+ resp = self._mgmt_client.query(url=url,
+ method='GET',
+ query_parameters=self._query_parameters,
+ header_parameters=self._header_parameters,
+ body=None,
+ expected_status_codes=[200],
+ polling_timeout=None,
+ polling_interval=None)
+ return json.loads(resp.text)
+ except CloudError as exc:
+ self.fail('Error when finding locks {0}: {1}'.format(url, exc.message))
+
+ def get_scope(self):
+ '''
+ Get the resource scope of the lock management.
+ '/subscriptions/{subscriptionId}' for subscriptions,
+ '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups,
+ '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{namespace}/{resourceType}/{resourceName}' for resources.
+ '''
+ if self.managed_resource_id:
+ return self.managed_resource_id
+ elif self.resource_group:
+ return '/subscriptions/{0}/resourcegroups/{1}'.format(self.subscription_id, self.resource_group)
+ else:
+ return '/subscriptions/{0}'.format(self.subscription_id)
+
+
+def main():
+ AzureRMLockInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loganalyticsworkspace_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loganalyticsworkspace_facts.py
new file mode 100644
index 00000000..abc91caf
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loganalyticsworkspace_facts.py
@@ -0,0 +1,269 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_loganalyticsworkspace_info
+short_description: Get facts of Azure Log Analytics workspaces
+description:
+ - Get, query Azure Log Analytics workspaces.
+options:
+ resource_group:
+ description:
+ - Name of resource group.
+ required: True
+ name:
+ description:
+ - Name of the workspace.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ show_intelligence_packs:
+ description:
+ - Show the intelligence packs for a workspace.
+ - Note this will cost one more network overhead for each workspace, expected slow response.
+ show_management_groups:
+ description:
+ - Show the management groups for a workspace.
+ - Note this will cost one more network overhead for each workspace, expected slow response.
+ show_shared_keys:
+ description:
+ - Show the shared keys for a workspace.
+ - Note this will cost one more network overhead for each workspace, expected slow response.
+ show_usages:
+ description:
+ - Show the list of usages for a workspace.
+ - Note this will cost one more network overhead for each workspace, expected slow response.
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+- name: Query a workspace
+ community.azure.azure_rm_loganalyticsworkspace_info:
+ resource_group: myResourceGroup
+ name: myLogAnalyticsWorkspace
+ show_intelligence_packs: true
+ show_management_groups: true
+ show_shared_keys: true
+ show_usages: true
+'''
+
+RETURN = '''
+id:
+ description:
+ - Workspace resource path.
+ type: str
+ returned: success
+ example: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/m
+ yLogAnalyticsWorkspace"
+location:
+ description:
+ - Resource location.
+ type: str
+ returned: success
+ example: "eastus"
+sku:
+ description:
+ - The SKU of the workspace.
+ type: str
+ returned: success
+ example: "per_gb2018"
+retention_in_days:
+ description:
+ - The workspace data retention in days.
+ - -1 means Unlimited retention for I(sku=unlimited).
+ - 730 days is the maximum allowed for all other SKUs.
+ type: int
+ returned: success
+ example: 40
+intelligence_packs:
+ description:
+ - Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace.
+ type: list
+ returned: success
+ example: [ {'name': 'CapacityPerformance', 'enabled': true} ]
+management_groups:
+ description:
+ - Management groups connected to the workspace.
+ type: dict
+ returned: success
+ example: {'value': []}
+shared_keys:
+ description:
+ - Shared keys for the workspace.
+ type: dict
+ returned: success
+ example: {
+ 'primarySharedKey': 'BozLY1JnZbxu0jWUQSY8iRPEM8ObmpP8rW+8bUl3+HpDJI+n689SxXgTgU7k1qdxo/WugRLxechxbolAfHM5uA==',
+ 'secondarySharedKey': '7tDt5W0JBrCQKtQA3igfFltLSzJeyr9LmuT+B/ibzd8cdC1neZ1ePOQLBx5NUzc0q2VUIK0cLhWNyFvo/hT8Ww=='
+ }
+usages:
+ description:
+ - Usage metrics for the workspace.
+ type: dict
+ returned: success
+ example: {
+ 'value': [
+ {
+ 'name': {
+ 'value': 'DataAnalyzed',
+ 'localizedValue': 'Data Analyzed'
+ },
+ 'unit': 'Bytes',
+ 'currentValue': 0,
+ 'limit': 524288000,
+ 'nextResetTime': '2017-10-03T00:00:00Z',
+ 'quotaPeriod': 'P1D'
+ }
+ ]
+ }
+''' # NOQA
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, format_resource_id
+from ansible.module_utils.common.dict_transformations import _snake_to_camel, _camel_to_snake
+
+try:
+ from msrestazure.tools import parse_resource_id
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMLogAnalyticsWorkspaceInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str', required=True),
+ name=dict(type='str'),
+ tags=dict(type='list'),
+ show_shared_keys=dict(type='bool'),
+ show_intelligence_packs=dict(type='bool'),
+ show_usages=dict(type='bool'),
+ show_management_groups=dict(type='bool')
+ )
+
+ self.results = dict(
+ changed=False,
+ workspaces=[]
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ self.show_intelligence_packs = None
+ self.show_shared_keys = None
+ self.show_usages = None
+ self.show_management_groups = None
+
+ super(AzureRMLogAnalyticsWorkspaceInfo, self).__init__(self.module_arg_spec, supports_tags=False, facts_module=True)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_loganalyticsworkspace_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_loganalyticsworkspace_facts' module has been renamed to 'azure_rm_loganalyticsworkspace_info'",
+ version='2.13')
+
+ for key in list(self.module_arg_spec.keys()):
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ item = self.get_workspace()
+ response = [item] if item else []
+ else:
+ response = self.list_by_resource_group()
+
+ self.results['workspaces'] = [self.to_dict(x) for x in response if self.has_tags(x.tags, self.tags)]
+ return self.results
+
+ def get_workspace(self):
+ try:
+ return self.log_analytics_client.workspaces.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+ return None
+
+ def list_by_resource_group(self):
+ try:
+ return self.log_analytics_client.workspaces.list_by_resource_group(self.resource_group)
+ except CloudError:
+ pass
+ return []
+
+ def list_intelligence_packs(self):
+ try:
+ response = self.log_analytics_client.workspaces.list_intelligence_packs(self.resource_group, self.name)
+ return [x.as_dict() for x in response]
+ except CloudError as exc:
+ self.fail('Error when listing intelligence packs {0}'.format(exc.message or str(exc)))
+
+ def list_management_groups(self):
+ result = []
+ try:
+ response = self.log_analytics_client.workspaces.list_management_groups(self.resource_group, self.name)
+ while True:
+ result.append(response.next().as_dict())
+ except StopIteration:
+ pass
+ except CloudError as exc:
+ self.fail('Error when listing management groups {0}'.format(exc.message or str(exc)))
+ return result
+
+ def list_usages(self):
+ result = []
+ try:
+ response = self.log_analytics_client.workspaces.list_usages(self.resource_group, self.name)
+ while True:
+ result.append(response.next().as_dict())
+ except StopIteration:
+ pass
+ except CloudError as exc:
+ self.fail('Error when listing usages {0}'.format(exc.message or str(exc)))
+ return result
+
+ def get_shared_keys(self):
+ try:
+ return self.log_analytics_client.workspaces.get_shared_keys(self.resource_group, self.name).as_dict()
+ except CloudError as exc:
+ self.fail('Error when getting shared key {0}'.format(exc.message or str(exc)))
+
+ def to_dict(self, workspace):
+ result = workspace.as_dict()
+ result['sku'] = _camel_to_snake(workspace.sku.name)
+ if self.show_intelligence_packs:
+ result['intelligence_packs'] = self.list_intelligence_packs()
+ if self.show_management_groups:
+ result['management_groups'] = self.list_management_groups()
+ if self.show_shared_keys:
+ result['shared_keys'] = self.get_shared_keys()
+ if self.show_usages:
+ result['usages'] = self.list_usages()
+ return result
+
+
+def main():
+ AzureRMLogAnalyticsWorkspaceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loganalyticsworkspace_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loganalyticsworkspace_info.py
new file mode 100644
index 00000000..abc91caf
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_loganalyticsworkspace_info.py
@@ -0,0 +1,269 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_loganalyticsworkspace_info
+short_description: Get facts of Azure Log Analytics workspaces
+description:
+ - Get, query Azure Log Analytics workspaces.
+options:
+ resource_group:
+ description:
+ - Name of resource group.
+ required: True
+ name:
+ description:
+ - Name of the workspace.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ show_intelligence_packs:
+ description:
+ - Show the intelligence packs for a workspace.
+ - Note this will cost one more network overhead for each workspace, expected slow response.
+ show_management_groups:
+ description:
+ - Show the management groups for a workspace.
+ - Note this will cost one more network overhead for each workspace, expected slow response.
+ show_shared_keys:
+ description:
+ - Show the shared keys for a workspace.
+ - Note this will cost one more network overhead for each workspace, expected slow response.
+ show_usages:
+ description:
+ - Show the list of usages for a workspace.
+ - Note this will cost one more network overhead for each workspace, expected slow response.
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+- name: Query a workspace
+ community.azure.azure_rm_loganalyticsworkspace_info:
+ resource_group: myResourceGroup
+ name: myLogAnalyticsWorkspace
+ show_intelligence_packs: true
+ show_management_groups: true
+ show_shared_keys: true
+ show_usages: true
+'''
+
+RETURN = '''
+id:
+ description:
+ - Workspace resource path.
+ type: str
+ returned: success
+ example: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/m
+ yLogAnalyticsWorkspace"
+location:
+ description:
+ - Resource location.
+ type: str
+ returned: success
+ example: "eastus"
+sku:
+ description:
+ - The SKU of the workspace.
+ type: str
+ returned: success
+ example: "per_gb2018"
+retention_in_days:
+ description:
+ - The workspace data retention in days.
+ - -1 means Unlimited retention for I(sku=unlimited).
+ - 730 days is the maximum allowed for all other SKUs.
+ type: int
+ returned: success
+ example: 40
+intelligence_packs:
+ description:
+ - Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace.
+ type: list
+ returned: success
+ example: [ {'name': 'CapacityPerformance', 'enabled': true} ]
+management_groups:
+ description:
+ - Management groups connected to the workspace.
+ type: dict
+ returned: success
+ example: {'value': []}
+shared_keys:
+ description:
+ - Shared keys for the workspace.
+ type: dict
+ returned: success
+ example: {
+ 'primarySharedKey': 'BozLY1JnZbxu0jWUQSY8iRPEM8ObmpP8rW+8bUl3+HpDJI+n689SxXgTgU7k1qdxo/WugRLxechxbolAfHM5uA==',
+ 'secondarySharedKey': '7tDt5W0JBrCQKtQA3igfFltLSzJeyr9LmuT+B/ibzd8cdC1neZ1ePOQLBx5NUzc0q2VUIK0cLhWNyFvo/hT8Ww=='
+ }
+usages:
+ description:
+ - Usage metrics for the workspace.
+ type: dict
+ returned: success
+ example: {
+ 'value': [
+ {
+ 'name': {
+ 'value': 'DataAnalyzed',
+ 'localizedValue': 'Data Analyzed'
+ },
+ 'unit': 'Bytes',
+ 'currentValue': 0,
+ 'limit': 524288000,
+ 'nextResetTime': '2017-10-03T00:00:00Z',
+ 'quotaPeriod': 'P1D'
+ }
+ ]
+ }
+''' # NOQA
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, format_resource_id
+from ansible.module_utils.common.dict_transformations import _snake_to_camel, _camel_to_snake
+
+try:
+ from msrestazure.tools import parse_resource_id
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMLogAnalyticsWorkspaceInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str', required=True),
+ name=dict(type='str'),
+ tags=dict(type='list'),
+ show_shared_keys=dict(type='bool'),
+ show_intelligence_packs=dict(type='bool'),
+ show_usages=dict(type='bool'),
+ show_management_groups=dict(type='bool')
+ )
+
+ self.results = dict(
+ changed=False,
+ workspaces=[]
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ self.show_intelligence_packs = None
+ self.show_shared_keys = None
+ self.show_usages = None
+ self.show_management_groups = None
+
+ super(AzureRMLogAnalyticsWorkspaceInfo, self).__init__(self.module_arg_spec, supports_tags=False, facts_module=True)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_loganalyticsworkspace_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_loganalyticsworkspace_facts' module has been renamed to 'azure_rm_loganalyticsworkspace_info'",
+ version='2.13')
+
+ for key in list(self.module_arg_spec.keys()):
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ item = self.get_workspace()
+ response = [item] if item else []
+ else:
+ response = self.list_by_resource_group()
+
+ self.results['workspaces'] = [self.to_dict(x) for x in response if self.has_tags(x.tags, self.tags)]
+ return self.results
+
+ def get_workspace(self):
+ try:
+ return self.log_analytics_client.workspaces.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+ return None
+
+ def list_by_resource_group(self):
+ try:
+ return self.log_analytics_client.workspaces.list_by_resource_group(self.resource_group)
+ except CloudError:
+ pass
+ return []
+
+ def list_intelligence_packs(self):
+ try:
+ response = self.log_analytics_client.workspaces.list_intelligence_packs(self.resource_group, self.name)
+ return [x.as_dict() for x in response]
+ except CloudError as exc:
+ self.fail('Error when listing intelligence packs {0}'.format(exc.message or str(exc)))
+
+ def list_management_groups(self):
+ result = []
+ try:
+ response = self.log_analytics_client.workspaces.list_management_groups(self.resource_group, self.name)
+ while True:
+ result.append(response.next().as_dict())
+ except StopIteration:
+ pass
+ except CloudError as exc:
+ self.fail('Error when listing management groups {0}'.format(exc.message or str(exc)))
+ return result
+
+ def list_usages(self):
+ result = []
+ try:
+ response = self.log_analytics_client.workspaces.list_usages(self.resource_group, self.name)
+ while True:
+ result.append(response.next().as_dict())
+ except StopIteration:
+ pass
+ except CloudError as exc:
+ self.fail('Error when listing usages {0}'.format(exc.message or str(exc)))
+ return result
+
+ def get_shared_keys(self):
+ try:
+ return self.log_analytics_client.workspaces.get_shared_keys(self.resource_group, self.name).as_dict()
+ except CloudError as exc:
+ self.fail('Error when getting shared key {0}'.format(exc.message or str(exc)))
+
+ def to_dict(self, workspace):
+ result = workspace.as_dict()
+ result['sku'] = _camel_to_snake(workspace.sku.name)
+ if self.show_intelligence_packs:
+ result['intelligence_packs'] = self.list_intelligence_packs()
+ if self.show_management_groups:
+ result['management_groups'] = self.list_management_groups()
+ if self.show_shared_keys:
+ result['shared_keys'] = self.get_shared_keys()
+ if self.show_usages:
+ result['usages'] = self.list_usages()
+ return result
+
+
+def main():
+ AzureRMLogAnalyticsWorkspaceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_managed_disk.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_managed_disk.py
new file mode 100644
index 00000000..b7c6e5c3
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_managed_disk.py
@@ -0,0 +1,489 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Bruno Medina Bolanos Cacho <bruno.medina@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_manageddisk
+
+
+short_description: Manage Azure Manage Disks
+
+description:
+ - Create, update and delete an Azure Managed Disk.
+
+notes:
+ - This module was called M(community.azure.azure_rm_managed_disk) before Ansible 2.8. The usage did not change.
+
+options:
+ resource_group:
+ description:
+ - Name of a resource group where the managed disk exists or will be created.
+ required: true
+ name:
+ description:
+ - Name of the managed disk.
+ required: true
+ state:
+ description:
+ - Assert the state of the managed disk. Use C(present) to create or update a managed disk and C(absent) to delete a managed disk.
+ default: present
+ choices:
+ - absent
+ - present
+ location:
+ description:
+ - Valid Azure location. Defaults to location of the resource group.
+ storage_account_type:
+ description:
+ - Type of storage for the managed disk.
+ - If not specified, the disk is created as C(Standard_LRS).
+ - C(Standard_LRS) is for Standard HDD.
+ - C(StandardSSD_LRS) (added in 2.8) is for Standard SSD.
+ - C(Premium_LRS) is for Premium SSD.
+ - C(UltraSSD_LRS) (added in 2.8) is for Ultra SSD, which is in preview mode, and only available on select instance types.
+ - See U(https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types) for more information about disk types.
+ choices:
+ - Standard_LRS
+ - StandardSSD_LRS
+ - Premium_LRS
+ - UltraSSD_LRS
+ create_option:
+ description:
+ - C(import) from a VHD file in I(source_uri) and C(copy) from previous managed disk I(source_uri).
+ choices:
+ - empty
+ - import
+ - copy
+ source_uri:
+ description:
+ - URI to a valid VHD file to be used or the resource ID of the managed disk to copy.
+ aliases:
+ - source_resource_uri
+ os_type:
+ description:
+ - Type of Operating System.
+ - Used when I(create_option=copy) or I(create_option=import) and the source is an OS disk.
+ - If omitted during creation, no value is set.
+ - If omitted during an update, no change is made.
+ - Once set, this value cannot be cleared.
+ choices:
+ - linux
+ - windows
+ disk_size_gb:
+ description:
+ - Size in GB of the managed disk to be created.
+ - If I(create_option=copy) then the value must be greater than or equal to the source's size.
+ managed_by:
+ description:
+ - Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group.
+ - To detach a disk from a vm, explicitly set to ''.
+ - If this option is unset, the value will not be changed.
+ attach_caching:
+ description:
+ - Disk caching policy controlled by VM. Will be used when attached to the VM defined by C(managed_by).
+ - If this option is different from the current caching policy, the managed disk will be deattached and attached with current caching option again.
+ choices:
+ - ''
+ - read_only
+ - read_write
+ tags:
+ description:
+ - Tags to assign to the managed disk.
+ - Format tags as 'key' or 'key:value'.
+ zone:
+ description:
+ - The Azure managed disk's zone.
+ - Allowed values are C(1), C(2), C(3) and C(' ').
+ choices:
+ - 1
+ - 2
+ - 3
+ - ''
+ lun:
+ description:
+ - The logical unit number for data disk.
+ - This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.
+ type: int
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+author:
+ - Bruno Medina (@brusMX)
+'''
+
+EXAMPLES = '''
+ - name: Create managed disk
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus
+ resource_group: myResourceGroup
+ disk_size_gb: 4
+
+ - name: Create managed operating system disk from page blob
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus2
+ resource_group: myResourceGroup
+ create_option: import
+ source_uri: https://storageaccountname.blob.core.windows.net/containername/blob-name.vhd
+ os_type: windows
+ storage_account_type: Premium_LRS
+
+ - name: Mount the managed disk to VM
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus
+ resource_group: myResourceGroup
+ disk_size_gb: 4
+ managed_by: testvm001
+ attach_caching: read_only
+
+ - name: Unmount the managed disk to VM
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus
+ resource_group: myResourceGroup
+ disk_size_gb: 4
+
+ - name: Delete managed disk
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus
+ resource_group: myResourceGroup
+ state: absent
+'''
+
+RETURN = '''
+id:
+ description:
+ - The managed disk resource ID.
+ returned: always
+ type: dict
+state:
+ description:
+ - Current state of the managed disk.
+ returned: always
+ type: dict
+changed:
+ description:
+ - Whether or not the resource has changed.
+ returned: always
+ type: bool
+'''
+
+import re
+
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+try:
+ from msrestazure.tools import parse_resource_id
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+# duplicated in azure_rm_manageddisk_facts
+def managed_disk_to_dict(managed_disk):
+ create_data = managed_disk.creation_data
+ return dict(
+ id=managed_disk.id,
+ name=managed_disk.name,
+ location=managed_disk.location,
+ tags=managed_disk.tags,
+ create_option=create_data.create_option.lower(),
+ source_uri=create_data.source_uri or create_data.source_resource_id,
+ disk_size_gb=managed_disk.disk_size_gb,
+ os_type=managed_disk.os_type.lower() if managed_disk.os_type else None,
+ storage_account_type=managed_disk.sku.name if managed_disk.sku else None,
+ managed_by=managed_disk.managed_by,
+ zone=managed_disk.zones[0] if managed_disk.zones and len(managed_disk.zones) > 0 else ''
+ )
+
+
+class AzureRMManagedDisk(AzureRMModuleBase):
+ """Configuration class for an Azure RM Managed Disk resource"""
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str',
+ required=True
+ ),
+ state=dict(
+ type='str',
+ default='present',
+ choices=['present', 'absent']
+ ),
+ location=dict(
+ type='str'
+ ),
+ storage_account_type=dict(
+ type='str',
+ choices=['Standard_LRS', 'StandardSSD_LRS', 'Premium_LRS', 'UltraSSD_LRS']
+ ),
+ create_option=dict(
+ type='str',
+ choices=['empty', 'import', 'copy']
+ ),
+ source_uri=dict(
+ type='str',
+ aliases=['source_resource_uri']
+ ),
+ os_type=dict(
+ type='str',
+ choices=['linux', 'windows']
+ ),
+ disk_size_gb=dict(
+ type='int'
+ ),
+ managed_by=dict(
+ type='str'
+ ),
+ zone=dict(
+ type='str',
+ choices=['', '1', '2', '3']
+ ),
+ attach_caching=dict(
+ type='str',
+ choices=['', 'read_only', 'read_write']
+ ),
+ lun=dict(
+ type='int'
+ )
+ )
+ required_if = [
+ ('create_option', 'import', ['source_uri']),
+ ('create_option', 'copy', ['source_uri']),
+ ('create_option', 'empty', ['disk_size_gb'])
+ ]
+ self.results = dict(
+ changed=False,
+ state=dict())
+
+ self.resource_group = None
+ self.name = None
+ self.location = None
+ self.storage_account_type = None
+ self.create_option = None
+ self.source_uri = None
+ self.os_type = None
+ self.disk_size_gb = None
+ self.tags = None
+ self.zone = None
+ self.managed_by = None
+ self.attach_caching = None
+ self.lun = None
+ super(AzureRMManagedDisk, self).__init__(
+ derived_arg_spec=self.module_arg_spec,
+ required_if=required_if,
+ supports_check_mode=True,
+ supports_tags=True)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+ for key in list(self.module_arg_spec.keys()) + ['tags']:
+ setattr(self, key, kwargs[key])
+
+ result = None
+ changed = False
+
+ resource_group = self.get_resource_group(self.resource_group)
+ if not self.location:
+ self.location = resource_group.location
+
+ disk_instance = self.get_managed_disk()
+ result = disk_instance
+
+ # need create or update
+ if self.state == 'present':
+ parameter = self.generate_managed_disk_property()
+ if not disk_instance or self.is_different(disk_instance, parameter):
+ changed = True
+ if not self.check_mode:
+ result = self.create_or_update_managed_disk(parameter)
+ else:
+ result = True
+
+ # unmount from the old virtual machine and mount to the new virtual machine
+ if self.managed_by or self.managed_by == '':
+ vm_name = parse_resource_id(disk_instance.get('managed_by', '')).get('name') if disk_instance else None
+ vm_name = vm_name or ''
+ if self.managed_by != vm_name or self.is_attach_caching_option_different(vm_name, result):
+ changed = True
+ if not self.check_mode:
+ if vm_name:
+ self.detach(vm_name, result)
+ if self.managed_by:
+ self.attach(self.managed_by, result)
+ result = self.get_managed_disk()
+
+ if self.state == 'absent' and disk_instance:
+ changed = True
+ if not self.check_mode:
+ self.delete_managed_disk()
+ result = True
+
+ self.results['changed'] = changed
+ self.results['state'] = result
+ return self.results
+
+ def attach(self, vm_name, disk):
+ vm = self._get_vm(vm_name)
+ # find the lun
+ if self.lun:
+ lun = self.lun
+ else:
+ luns = ([d.lun for d in vm.storage_profile.data_disks]
+ if vm.storage_profile.data_disks else [])
+ lun = max(luns) + 1 if luns else 0
+
+ # prepare the data disk
+ params = self.compute_models.ManagedDiskParameters(id=disk.get('id'), storage_account_type=disk.get('storage_account_type'))
+ caching_options = self.compute_models.CachingTypes[self.attach_caching] if self.attach_caching and self.attach_caching != '' else None
+ data_disk = self.compute_models.DataDisk(lun=lun,
+ create_option=self.compute_models.DiskCreateOptionTypes.attach,
+ managed_disk=params,
+ caching=caching_options)
+ vm.storage_profile.data_disks.append(data_disk)
+ self._update_vm(vm_name, vm)
+
+ def detach(self, vm_name, disk):
+ vm = self._get_vm(vm_name)
+ leftovers = [d for d in vm.storage_profile.data_disks if d.name.lower() != disk.get('name').lower()]
+ if len(vm.storage_profile.data_disks) == len(leftovers):
+ self.fail("No disk with the name '{0}' was found".format(disk.get('name')))
+ vm.storage_profile.data_disks = leftovers
+ self._update_vm(vm_name, vm)
+
+ def _update_vm(self, name, params):
+ try:
+ poller = self.compute_client.virtual_machines.create_or_update(self.resource_group, name, params)
+ self.get_poller_result(poller)
+ except Exception as exc:
+ self.fail("Error updating virtual machine {0} - {1}".format(name, str(exc)))
+
+ def _get_vm(self, name):
+ try:
+ return self.compute_client.virtual_machines.get(self.resource_group, name, expand='instanceview')
+ except Exception as exc:
+ self.fail("Error getting virtual machine {0} - {1}".format(name, str(exc)))
+
+ def generate_managed_disk_property(self):
+ # TODO: Add support for EncryptionSettings, DiskIOPSReadWrite, DiskMBpsReadWrite
+ disk_params = {}
+ creation_data = {}
+ disk_params['location'] = self.location
+ disk_params['tags'] = self.tags
+ if self.zone:
+ disk_params['zones'] = [self.zone]
+ if self.storage_account_type:
+ storage_account_type = self.compute_models.DiskSku(name=self.storage_account_type)
+ disk_params['sku'] = storage_account_type
+ disk_params['disk_size_gb'] = self.disk_size_gb
+ creation_data['create_option'] = self.compute_models.DiskCreateOption.empty
+ if self.create_option == 'import':
+ creation_data['create_option'] = self.compute_models.DiskCreateOption.import_enum
+ creation_data['source_uri'] = self.source_uri
+ elif self.create_option == 'copy':
+ creation_data['create_option'] = self.compute_models.DiskCreateOption.copy
+ creation_data['source_resource_id'] = self.source_uri
+ if self.os_type:
+ typecon = {
+ 'linux': self.compute_models.OperatingSystemTypes.linux,
+ 'windows': self.compute_models.OperatingSystemTypes.windows
+ }
+ disk_params['os_type'] = typecon[self.os_type]
+ else:
+ disk_params['os_type'] = None
+ disk_params['creation_data'] = creation_data
+ return disk_params
+
+ def create_or_update_managed_disk(self, parameter):
+ try:
+ poller = self.compute_client.disks.create_or_update(
+ self.resource_group,
+ self.name,
+ parameter)
+ aux = self.get_poller_result(poller)
+ return managed_disk_to_dict(aux)
+ except CloudError as e:
+ self.fail("Error creating the managed disk: {0}".format(str(e)))
+
+ # This method accounts for the difference in structure between the
+ # Azure retrieved disk and the parameters for the new disk to be created.
+ def is_different(self, found_disk, new_disk):
+ resp = False
+ if new_disk.get('disk_size_gb'):
+ if not found_disk['disk_size_gb'] == new_disk['disk_size_gb']:
+ resp = True
+ if new_disk.get('os_type'):
+ if not found_disk['os_type'] == new_disk['os_type']:
+ resp = True
+ if new_disk.get('sku'):
+ if not found_disk['storage_account_type'] == new_disk['sku'].name:
+ resp = True
+ # Check how to implement tags
+ if new_disk.get('tags') is not None:
+ if not found_disk['tags'] == new_disk['tags']:
+ resp = True
+ if self.zone is not None:
+ if not found_disk['zone'] == self.zone:
+ resp = True
+ return resp
+
+ def delete_managed_disk(self):
+ try:
+ poller = self.compute_client.disks.delete(
+ self.resource_group,
+ self.name)
+ return self.get_poller_result(poller)
+ except CloudError as e:
+ self.fail("Error deleting the managed disk: {0}".format(str(e)))
+
+ def get_managed_disk(self):
+ try:
+ resp = self.compute_client.disks.get(
+ self.resource_group,
+ self.name)
+ return managed_disk_to_dict(resp)
+ except CloudError as e:
+ self.log('Did not find managed disk')
+
+ def is_attach_caching_option_different(self, vm_name, disk):
+ resp = False
+ if vm_name:
+ vm = self._get_vm(vm_name)
+ correspondence = next((d for d in vm.storage_profile.data_disks if d.name.lower() == disk.get('name').lower()), None)
+ if correspondence and correspondence.caching.name != self.attach_caching:
+ resp = True
+ if correspondence.caching.name == 'none' and self.attach_caching == '':
+ resp = False
+ return resp
+
+
+def main():
+ """Main execution"""
+ AzureRMManagedDisk()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_managed_disk_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_managed_disk_facts.py
new file mode 100644
index 00000000..757849f9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_managed_disk_facts.py
@@ -0,0 +1,243 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2016, Bruno Medina Bolanos Cacho <bruno.medina@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = r'''
+---
+module: azure_rm_manageddisk_info
+
+
+short_description: Get managed disk facts
+
+description:
+ - Get facts for a specific managed disk or all managed disks.
+
+notes:
+ - This module was called M(community.azure.azure_rm_managed_disk_facts) before Ansible 2.8. The usage did not change.
+
+options:
+ name:
+ description:
+ - Limit results to a specific managed disk.
+ type: str
+ resource_group:
+ description:
+ - Limit results to a specific resource group.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags.
+ - Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Bruno Medina (@brusMX)
+'''
+
+EXAMPLES = r'''
+- name: Get facts for one managed disk
+ community.azure.azure_rm_manageddisk_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+- name: Get facts for all managed disks
+ community.azure.azure_rm_manageddisk_info:
+
+- name: Get facts by tags
+ community.azure.azure_rm_manageddisk_info:
+ tags:
+ - testing
+'''
+
+RETURN = r'''
+azure_managed_disk:
+ description:
+ - List of managed disk dicts.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - Resource id.
+ type: str
+ name:
+ description:
+ - Name of the managed disk.
+ type: str
+ location:
+ description:
+ - Valid Azure location.
+ type: str
+ storage_account_type:
+ description:
+ - Type of storage for the managed disk.
+ - See U(https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types) for more information about this type.
+ type: str
+ sample: Standard_LRS
+ create_option:
+ description:
+ - Create option of the disk.
+ type: str
+ sample: copy
+ source_uri:
+ description:
+ - URI to a valid VHD file to be used or the resource ID of the managed disk to copy.
+ type: str
+ os_type:
+ description:
+ - Type of Operating System.
+ choices:
+ - linux
+ - windows
+ type: str
+ disk_size_gb:
+ description:
+ - Size in GB of the managed disk to be created.
+ type: str
+ managed_by:
+ description:
+ - Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group.
+ type: str
+ tags:
+ description:
+ - Tags to assign to the managed disk.
+ type: dict
+ sample: { "tag": "value" }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+
+# duplicated in azure_rm_manageddisk
+def managed_disk_to_dict(managed_disk):
+ create_data = managed_disk.creation_data
+ return dict(
+ id=managed_disk.id,
+ name=managed_disk.name,
+ location=managed_disk.location,
+ tags=managed_disk.tags,
+ create_option=create_data.create_option.lower(),
+ source_uri=create_data.source_uri or create_data.source_resource_id,
+ disk_size_gb=managed_disk.disk_size_gb,
+ os_type=managed_disk.os_type.lower() if managed_disk.os_type else None,
+ storage_account_type=managed_disk.sku.name if managed_disk.sku else None,
+ managed_by=managed_disk.managed_by,
+ zone=managed_disk.zones[0] if managed_disk.zones and len(managed_disk.zones) > 0 else ''
+ )
+
+
+class AzureRMManagedDiskInfo(AzureRMModuleBase):
+ """Utility class to get managed disk facts"""
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='str'
+ ),
+ )
+ self.results = dict(
+ ansible_info=dict(
+ azure_managed_disk=[]
+ )
+ )
+ self.resource_group = None
+ self.name = None
+ self.create_option = None
+ self.source_uri = None
+ self.source_resource_uri = None
+ self.tags = None
+ super(AzureRMManagedDiskInfo, self).__init__(
+ derived_arg_spec=self.module_arg_spec,
+ supports_check_mode=True,
+ supports_tags=True)
+
+ def exec_module(self, **kwargs):
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ self.results['ansible_info']['azure_managed_disk'] = (
+ self.get_item() if self.name
+ else (self.list_items_by_resource_group() if self.resource_group else self.list_items())
+ )
+
+ return self.results
+
+ def get_item(self):
+ """Get a single managed disk"""
+ item = None
+ result = []
+
+ try:
+ item = self.compute_client.disks.get(
+ self.resource_group,
+ self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [managed_disk_to_dict(item)]
+
+ return result
+
+ def list_items(self):
+ """Get all managed disks"""
+ try:
+ response = self.compute_client.disks.list()
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(managed_disk_to_dict(item))
+ return results
+
+ def list_items_by_resource_group(self):
+ """Get managed disks in a resource group"""
+ try:
+ response = self.compute_client.disks.list_by_resource_group(resource_group_name=self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list items by resource group - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(managed_disk_to_dict(item))
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMManagedDiskInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk.py
new file mode 100644
index 00000000..b7c6e5c3
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk.py
@@ -0,0 +1,489 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Bruno Medina Bolanos Cacho <bruno.medina@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_manageddisk
+
+
+short_description: Manage Azure Manage Disks
+
+description:
+ - Create, update and delete an Azure Managed Disk.
+
+notes:
+ - This module was called M(community.azure.azure_rm_managed_disk) before Ansible 2.8. The usage did not change.
+
+options:
+ resource_group:
+ description:
+ - Name of a resource group where the managed disk exists or will be created.
+ required: true
+ name:
+ description:
+ - Name of the managed disk.
+ required: true
+ state:
+ description:
+ - Assert the state of the managed disk. Use C(present) to create or update a managed disk and C(absent) to delete a managed disk.
+ default: present
+ choices:
+ - absent
+ - present
+ location:
+ description:
+ - Valid Azure location. Defaults to location of the resource group.
+ storage_account_type:
+ description:
+ - Type of storage for the managed disk.
+ - If not specified, the disk is created as C(Standard_LRS).
+ - C(Standard_LRS) is for Standard HDD.
+ - C(StandardSSD_LRS) (added in 2.8) is for Standard SSD.
+ - C(Premium_LRS) is for Premium SSD.
+ - C(UltraSSD_LRS) (added in 2.8) is for Ultra SSD, which is in preview mode, and only available on select instance types.
+ - See U(https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types) for more information about disk types.
+ choices:
+ - Standard_LRS
+ - StandardSSD_LRS
+ - Premium_LRS
+ - UltraSSD_LRS
+ create_option:
+ description:
+ - C(import) from a VHD file in I(source_uri) and C(copy) from previous managed disk I(source_uri).
+ choices:
+ - empty
+ - import
+ - copy
+ source_uri:
+ description:
+ - URI to a valid VHD file to be used or the resource ID of the managed disk to copy.
+ aliases:
+ - source_resource_uri
+ os_type:
+ description:
+ - Type of Operating System.
+ - Used when I(create_option=copy) or I(create_option=import) and the source is an OS disk.
+ - If omitted during creation, no value is set.
+ - If omitted during an update, no change is made.
+ - Once set, this value cannot be cleared.
+ choices:
+ - linux
+ - windows
+ disk_size_gb:
+ description:
+ - Size in GB of the managed disk to be created.
+ - If I(create_option=copy) then the value must be greater than or equal to the source's size.
+ managed_by:
+ description:
+ - Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group.
+ - To detach a disk from a vm, explicitly set to ''.
+ - If this option is unset, the value will not be changed.
+ attach_caching:
+ description:
+ - Disk caching policy controlled by VM. Will be used when attached to the VM defined by C(managed_by).
+ - If this option is different from the current caching policy, the managed disk will be deattached and attached with current caching option again.
+ choices:
+ - ''
+ - read_only
+ - read_write
+ tags:
+ description:
+ - Tags to assign to the managed disk.
+ - Format tags as 'key' or 'key:value'.
+ zone:
+ description:
+ - The Azure managed disk's zone.
+ - Allowed values are C(1), C(2), C(3) and C(' ').
+ choices:
+ - 1
+ - 2
+ - 3
+ - ''
+ lun:
+ description:
+ - The logical unit number for data disk.
+ - This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.
+ type: int
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+author:
+ - Bruno Medina (@brusMX)
+'''
+
+EXAMPLES = '''
+ - name: Create managed disk
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus
+ resource_group: myResourceGroup
+ disk_size_gb: 4
+
+ - name: Create managed operating system disk from page blob
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus2
+ resource_group: myResourceGroup
+ create_option: import
+ source_uri: https://storageaccountname.blob.core.windows.net/containername/blob-name.vhd
+ os_type: windows
+ storage_account_type: Premium_LRS
+
+ - name: Mount the managed disk to VM
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus
+ resource_group: myResourceGroup
+ disk_size_gb: 4
+ managed_by: testvm001
+ attach_caching: read_only
+
+ - name: Unmount the managed disk to VM
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus
+ resource_group: myResourceGroup
+ disk_size_gb: 4
+
+ - name: Delete managed disk
+ community.azure.azure_rm_manageddisk:
+ name: mymanageddisk
+ location: eastus
+ resource_group: myResourceGroup
+ state: absent
+'''
+
+RETURN = '''
+id:
+ description:
+ - The managed disk resource ID.
+ returned: always
+ type: dict
+state:
+ description:
+ - Current state of the managed disk.
+ returned: always
+ type: dict
+changed:
+ description:
+ - Whether or not the resource has changed.
+ returned: always
+ type: bool
+'''
+
+import re
+
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+try:
+ from msrestazure.tools import parse_resource_id
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+# duplicated in azure_rm_manageddisk_facts
+def managed_disk_to_dict(managed_disk):
+ create_data = managed_disk.creation_data
+ return dict(
+ id=managed_disk.id,
+ name=managed_disk.name,
+ location=managed_disk.location,
+ tags=managed_disk.tags,
+ create_option=create_data.create_option.lower(),
+ source_uri=create_data.source_uri or create_data.source_resource_id,
+ disk_size_gb=managed_disk.disk_size_gb,
+ os_type=managed_disk.os_type.lower() if managed_disk.os_type else None,
+ storage_account_type=managed_disk.sku.name if managed_disk.sku else None,
+ managed_by=managed_disk.managed_by,
+ zone=managed_disk.zones[0] if managed_disk.zones and len(managed_disk.zones) > 0 else ''
+ )
+
+
+class AzureRMManagedDisk(AzureRMModuleBase):
+ """Configuration class for an Azure RM Managed Disk resource"""
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str',
+ required=True
+ ),
+ state=dict(
+ type='str',
+ default='present',
+ choices=['present', 'absent']
+ ),
+ location=dict(
+ type='str'
+ ),
+ storage_account_type=dict(
+ type='str',
+ choices=['Standard_LRS', 'StandardSSD_LRS', 'Premium_LRS', 'UltraSSD_LRS']
+ ),
+ create_option=dict(
+ type='str',
+ choices=['empty', 'import', 'copy']
+ ),
+ source_uri=dict(
+ type='str',
+ aliases=['source_resource_uri']
+ ),
+ os_type=dict(
+ type='str',
+ choices=['linux', 'windows']
+ ),
+ disk_size_gb=dict(
+ type='int'
+ ),
+ managed_by=dict(
+ type='str'
+ ),
+ zone=dict(
+ type='str',
+ choices=['', '1', '2', '3']
+ ),
+ attach_caching=dict(
+ type='str',
+ choices=['', 'read_only', 'read_write']
+ ),
+ lun=dict(
+ type='int'
+ )
+ )
+ required_if = [
+ ('create_option', 'import', ['source_uri']),
+ ('create_option', 'copy', ['source_uri']),
+ ('create_option', 'empty', ['disk_size_gb'])
+ ]
+ self.results = dict(
+ changed=False,
+ state=dict())
+
+ self.resource_group = None
+ self.name = None
+ self.location = None
+ self.storage_account_type = None
+ self.create_option = None
+ self.source_uri = None
+ self.os_type = None
+ self.disk_size_gb = None
+ self.tags = None
+ self.zone = None
+ self.managed_by = None
+ self.attach_caching = None
+ self.lun = None
+ super(AzureRMManagedDisk, self).__init__(
+ derived_arg_spec=self.module_arg_spec,
+ required_if=required_if,
+ supports_check_mode=True,
+ supports_tags=True)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+ for key in list(self.module_arg_spec.keys()) + ['tags']:
+ setattr(self, key, kwargs[key])
+
+ result = None
+ changed = False
+
+ resource_group = self.get_resource_group(self.resource_group)
+ if not self.location:
+ self.location = resource_group.location
+
+ disk_instance = self.get_managed_disk()
+ result = disk_instance
+
+ # need create or update
+ if self.state == 'present':
+ parameter = self.generate_managed_disk_property()
+ if not disk_instance or self.is_different(disk_instance, parameter):
+ changed = True
+ if not self.check_mode:
+ result = self.create_or_update_managed_disk(parameter)
+ else:
+ result = True
+
+ # unmount from the old virtual machine and mount to the new virtual machine
+ if self.managed_by or self.managed_by == '':
+ vm_name = parse_resource_id(disk_instance.get('managed_by', '')).get('name') if disk_instance else None
+ vm_name = vm_name or ''
+ if self.managed_by != vm_name or self.is_attach_caching_option_different(vm_name, result):
+ changed = True
+ if not self.check_mode:
+ if vm_name:
+ self.detach(vm_name, result)
+ if self.managed_by:
+ self.attach(self.managed_by, result)
+ result = self.get_managed_disk()
+
+ if self.state == 'absent' and disk_instance:
+ changed = True
+ if not self.check_mode:
+ self.delete_managed_disk()
+ result = True
+
+ self.results['changed'] = changed
+ self.results['state'] = result
+ return self.results
+
+ def attach(self, vm_name, disk):
+ vm = self._get_vm(vm_name)
+ # find the lun
+ if self.lun:
+ lun = self.lun
+ else:
+ luns = ([d.lun for d in vm.storage_profile.data_disks]
+ if vm.storage_profile.data_disks else [])
+ lun = max(luns) + 1 if luns else 0
+
+ # prepare the data disk
+ params = self.compute_models.ManagedDiskParameters(id=disk.get('id'), storage_account_type=disk.get('storage_account_type'))
+ caching_options = self.compute_models.CachingTypes[self.attach_caching] if self.attach_caching and self.attach_caching != '' else None
+ data_disk = self.compute_models.DataDisk(lun=lun,
+ create_option=self.compute_models.DiskCreateOptionTypes.attach,
+ managed_disk=params,
+ caching=caching_options)
+ vm.storage_profile.data_disks.append(data_disk)
+ self._update_vm(vm_name, vm)
+
+ def detach(self, vm_name, disk):
+ vm = self._get_vm(vm_name)
+ leftovers = [d for d in vm.storage_profile.data_disks if d.name.lower() != disk.get('name').lower()]
+ if len(vm.storage_profile.data_disks) == len(leftovers):
+ self.fail("No disk with the name '{0}' was found".format(disk.get('name')))
+ vm.storage_profile.data_disks = leftovers
+ self._update_vm(vm_name, vm)
+
+ def _update_vm(self, name, params):
+ try:
+ poller = self.compute_client.virtual_machines.create_or_update(self.resource_group, name, params)
+ self.get_poller_result(poller)
+ except Exception as exc:
+ self.fail("Error updating virtual machine {0} - {1}".format(name, str(exc)))
+
+ def _get_vm(self, name):
+ try:
+ return self.compute_client.virtual_machines.get(self.resource_group, name, expand='instanceview')
+ except Exception as exc:
+ self.fail("Error getting virtual machine {0} - {1}".format(name, str(exc)))
+
+ def generate_managed_disk_property(self):
+ # TODO: Add support for EncryptionSettings, DiskIOPSReadWrite, DiskMBpsReadWrite
+ disk_params = {}
+ creation_data = {}
+ disk_params['location'] = self.location
+ disk_params['tags'] = self.tags
+ if self.zone:
+ disk_params['zones'] = [self.zone]
+ if self.storage_account_type:
+ storage_account_type = self.compute_models.DiskSku(name=self.storage_account_type)
+ disk_params['sku'] = storage_account_type
+ disk_params['disk_size_gb'] = self.disk_size_gb
+ creation_data['create_option'] = self.compute_models.DiskCreateOption.empty
+ if self.create_option == 'import':
+ creation_data['create_option'] = self.compute_models.DiskCreateOption.import_enum
+ creation_data['source_uri'] = self.source_uri
+ elif self.create_option == 'copy':
+ creation_data['create_option'] = self.compute_models.DiskCreateOption.copy
+ creation_data['source_resource_id'] = self.source_uri
+ if self.os_type:
+ typecon = {
+ 'linux': self.compute_models.OperatingSystemTypes.linux,
+ 'windows': self.compute_models.OperatingSystemTypes.windows
+ }
+ disk_params['os_type'] = typecon[self.os_type]
+ else:
+ disk_params['os_type'] = None
+ disk_params['creation_data'] = creation_data
+ return disk_params
+
+ def create_or_update_managed_disk(self, parameter):
+ try:
+ poller = self.compute_client.disks.create_or_update(
+ self.resource_group,
+ self.name,
+ parameter)
+ aux = self.get_poller_result(poller)
+ return managed_disk_to_dict(aux)
+ except CloudError as e:
+ self.fail("Error creating the managed disk: {0}".format(str(e)))
+
+ # This method accounts for the difference in structure between the
+ # Azure retrieved disk and the parameters for the new disk to be created.
+ def is_different(self, found_disk, new_disk):
+ resp = False
+ if new_disk.get('disk_size_gb'):
+ if not found_disk['disk_size_gb'] == new_disk['disk_size_gb']:
+ resp = True
+ if new_disk.get('os_type'):
+ if not found_disk['os_type'] == new_disk['os_type']:
+ resp = True
+ if new_disk.get('sku'):
+ if not found_disk['storage_account_type'] == new_disk['sku'].name:
+ resp = True
+ # Check how to implement tags
+ if new_disk.get('tags') is not None:
+ if not found_disk['tags'] == new_disk['tags']:
+ resp = True
+ if self.zone is not None:
+ if not found_disk['zone'] == self.zone:
+ resp = True
+ return resp
+
+ def delete_managed_disk(self):
+ try:
+ poller = self.compute_client.disks.delete(
+ self.resource_group,
+ self.name)
+ return self.get_poller_result(poller)
+ except CloudError as e:
+ self.fail("Error deleting the managed disk: {0}".format(str(e)))
+
+ def get_managed_disk(self):
+ try:
+ resp = self.compute_client.disks.get(
+ self.resource_group,
+ self.name)
+ return managed_disk_to_dict(resp)
+ except CloudError as e:
+ self.log('Did not find managed disk')
+
+ def is_attach_caching_option_different(self, vm_name, disk):
+ resp = False
+ if vm_name:
+ vm = self._get_vm(vm_name)
+ correspondence = next((d for d in vm.storage_profile.data_disks if d.name.lower() == disk.get('name').lower()), None)
+ if correspondence and correspondence.caching.name != self.attach_caching:
+ resp = True
+ if correspondence.caching.name == 'none' and self.attach_caching == '':
+ resp = False
+ return resp
+
+
+def main():
+ """Main execution"""
+ AzureRMManagedDisk()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk_facts.py
new file mode 100644
index 00000000..757849f9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk_facts.py
@@ -0,0 +1,243 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2016, Bruno Medina Bolanos Cacho <bruno.medina@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = r'''
+---
+module: azure_rm_manageddisk_info
+
+
+short_description: Get managed disk facts
+
+description:
+ - Get facts for a specific managed disk or all managed disks.
+
+notes:
+ - This module was called M(community.azure.azure_rm_managed_disk_facts) before Ansible 2.8. The usage did not change.
+
+options:
+ name:
+ description:
+ - Limit results to a specific managed disk.
+ type: str
+ resource_group:
+ description:
+ - Limit results to a specific resource group.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags.
+ - Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Bruno Medina (@brusMX)
+'''
+
+EXAMPLES = r'''
+- name: Get facts for one managed disk
+ community.azure.azure_rm_manageddisk_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+- name: Get facts for all managed disks
+ community.azure.azure_rm_manageddisk_info:
+
+- name: Get facts by tags
+ community.azure.azure_rm_manageddisk_info:
+ tags:
+ - testing
+'''
+
+RETURN = r'''
+azure_managed_disk:
+ description:
+ - List of managed disk dicts.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - Resource id.
+ type: str
+ name:
+ description:
+ - Name of the managed disk.
+ type: str
+ location:
+ description:
+ - Valid Azure location.
+ type: str
+ storage_account_type:
+ description:
+ - Type of storage for the managed disk.
+ - See U(https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types) for more information about this type.
+ type: str
+ sample: Standard_LRS
+ create_option:
+ description:
+ - Create option of the disk.
+ type: str
+ sample: copy
+ source_uri:
+ description:
+ - URI to a valid VHD file to be used or the resource ID of the managed disk to copy.
+ type: str
+ os_type:
+ description:
+ - Type of Operating System.
+ choices:
+ - linux
+ - windows
+ type: str
+ disk_size_gb:
+ description:
+ - Size in GB of the managed disk to be created.
+ type: str
+ managed_by:
+ description:
+ - Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group.
+ type: str
+ tags:
+ description:
+ - Tags to assign to the managed disk.
+ type: dict
+ sample: { "tag": "value" }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+
+# duplicated in azure_rm_manageddisk
+def managed_disk_to_dict(managed_disk):
+ create_data = managed_disk.creation_data
+ return dict(
+ id=managed_disk.id,
+ name=managed_disk.name,
+ location=managed_disk.location,
+ tags=managed_disk.tags,
+ create_option=create_data.create_option.lower(),
+ source_uri=create_data.source_uri or create_data.source_resource_id,
+ disk_size_gb=managed_disk.disk_size_gb,
+ os_type=managed_disk.os_type.lower() if managed_disk.os_type else None,
+ storage_account_type=managed_disk.sku.name if managed_disk.sku else None,
+ managed_by=managed_disk.managed_by,
+ zone=managed_disk.zones[0] if managed_disk.zones and len(managed_disk.zones) > 0 else ''
+ )
+
+
+class AzureRMManagedDiskInfo(AzureRMModuleBase):
+ """Utility class to get managed disk facts"""
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='str'
+ ),
+ )
+ self.results = dict(
+ ansible_info=dict(
+ azure_managed_disk=[]
+ )
+ )
+ self.resource_group = None
+ self.name = None
+ self.create_option = None
+ self.source_uri = None
+ self.source_resource_uri = None
+ self.tags = None
+ super(AzureRMManagedDiskInfo, self).__init__(
+ derived_arg_spec=self.module_arg_spec,
+ supports_check_mode=True,
+ supports_tags=True)
+
+ def exec_module(self, **kwargs):
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ self.results['ansible_info']['azure_managed_disk'] = (
+ self.get_item() if self.name
+ else (self.list_items_by_resource_group() if self.resource_group else self.list_items())
+ )
+
+ return self.results
+
+ def get_item(self):
+ """Get a single managed disk"""
+ item = None
+ result = []
+
+ try:
+ item = self.compute_client.disks.get(
+ self.resource_group,
+ self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [managed_disk_to_dict(item)]
+
+ return result
+
+ def list_items(self):
+ """Get all managed disks"""
+ try:
+ response = self.compute_client.disks.list()
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(managed_disk_to_dict(item))
+ return results
+
+ def list_items_by_resource_group(self):
+ """Get managed disks in a resource group"""
+ try:
+ response = self.compute_client.disks.list_by_resource_group(resource_group_name=self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list items by resource group - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(managed_disk_to_dict(item))
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMManagedDiskInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk_info.py
new file mode 100644
index 00000000..757849f9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_manageddisk_info.py
@@ -0,0 +1,243 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2016, Bruno Medina Bolanos Cacho <bruno.medina@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = r'''
+---
+module: azure_rm_manageddisk_info
+
+
+short_description: Get managed disk facts
+
+description:
+ - Get facts for a specific managed disk or all managed disks.
+
+notes:
+ - This module was called M(community.azure.azure_rm_managed_disk_facts) before Ansible 2.8. The usage did not change.
+
+options:
+ name:
+ description:
+ - Limit results to a specific managed disk.
+ type: str
+ resource_group:
+ description:
+ - Limit results to a specific resource group.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags.
+ - Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Bruno Medina (@brusMX)
+'''
+
+EXAMPLES = r'''
+- name: Get facts for one managed disk
+ community.azure.azure_rm_manageddisk_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+- name: Get facts for all managed disks
+ community.azure.azure_rm_manageddisk_info:
+
+- name: Get facts by tags
+ community.azure.azure_rm_manageddisk_info:
+ tags:
+ - testing
+'''
+
+RETURN = r'''
+azure_managed_disk:
+ description:
+ - List of managed disk dicts.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - Resource id.
+ type: str
+ name:
+ description:
+ - Name of the managed disk.
+ type: str
+ location:
+ description:
+ - Valid Azure location.
+ type: str
+ storage_account_type:
+ description:
+ - Type of storage for the managed disk.
+ - See U(https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types) for more information about this type.
+ type: str
+ sample: Standard_LRS
+ create_option:
+ description:
+ - Create option of the disk.
+ type: str
+ sample: copy
+ source_uri:
+ description:
+ - URI to a valid VHD file to be used or the resource ID of the managed disk to copy.
+ type: str
+ os_type:
+ description:
+ - Type of Operating System.
+ choices:
+ - linux
+ - windows
+ type: str
+ disk_size_gb:
+ description:
+ - Size in GB of the managed disk to be created.
+ type: str
+ managed_by:
+ description:
+ - Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group.
+ type: str
+ tags:
+ description:
+ - Tags to assign to the managed disk.
+ type: dict
+ sample: { "tag": "value" }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+
+# duplicated in azure_rm_manageddisk
+def managed_disk_to_dict(managed_disk):
+ create_data = managed_disk.creation_data
+ return dict(
+ id=managed_disk.id,
+ name=managed_disk.name,
+ location=managed_disk.location,
+ tags=managed_disk.tags,
+ create_option=create_data.create_option.lower(),
+ source_uri=create_data.source_uri or create_data.source_resource_id,
+ disk_size_gb=managed_disk.disk_size_gb,
+ os_type=managed_disk.os_type.lower() if managed_disk.os_type else None,
+ storage_account_type=managed_disk.sku.name if managed_disk.sku else None,
+ managed_by=managed_disk.managed_by,
+ zone=managed_disk.zones[0] if managed_disk.zones and len(managed_disk.zones) > 0 else ''
+ )
+
+
+class AzureRMManagedDiskInfo(AzureRMModuleBase):
+ """Utility class to get managed disk facts"""
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str'
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='str'
+ ),
+ )
+ self.results = dict(
+ ansible_info=dict(
+ azure_managed_disk=[]
+ )
+ )
+ self.resource_group = None
+ self.name = None
+ self.create_option = None
+ self.source_uri = None
+ self.source_resource_uri = None
+ self.tags = None
+ super(AzureRMManagedDiskInfo, self).__init__(
+ derived_arg_spec=self.module_arg_spec,
+ supports_check_mode=True,
+ supports_tags=True)
+
+ def exec_module(self, **kwargs):
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ self.results['ansible_info']['azure_managed_disk'] = (
+ self.get_item() if self.name
+ else (self.list_items_by_resource_group() if self.resource_group else self.list_items())
+ )
+
+ return self.results
+
+ def get_item(self):
+ """Get a single managed disk"""
+ item = None
+ result = []
+
+ try:
+ item = self.compute_client.disks.get(
+ self.resource_group,
+ self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [managed_disk_to_dict(item)]
+
+ return result
+
+ def list_items(self):
+ """Get all managed disks"""
+ try:
+ response = self.compute_client.disks.list()
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(managed_disk_to_dict(item))
+ return results
+
+ def list_items_by_resource_group(self):
+ """Get managed disks in a resource group"""
+ try:
+ response = self.compute_client.disks.list_by_resource_group(resource_group_name=self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list items by resource group - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(managed_disk_to_dict(item))
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMManagedDiskInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbconfiguration_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbconfiguration_facts.py
new file mode 100644
index 00000000..678b1214
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbconfiguration_facts.py
@@ -0,0 +1,216 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mariadbconfiguration_info
+short_description: Get Azure MariaDB Configuration facts
+description:
+ - Get facts of Azure MariaDB Configuration.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - Setting name.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+ - Matti Ranta (@techknowlogick)
+
+'''
+
+EXAMPLES = '''
+ - name: Get specific setting of MariaDB Server
+ community.azure.azure_rm_mariadbconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: testserver
+ name: deadlock_timeout
+
+ - name: Get all settings of MariaDB Server
+ community.azure.azure_rm_mariadbconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+settings:
+ description:
+ - A list of dictionaries containing MariaDB Server settings.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Setting resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMariaDB/servers/testserver
+ /configurations/deadlock_timeout"
+ name:
+ description:
+ - Setting name.
+ returned: always
+ type: str
+ sample: deadlock_timeout
+ value:
+ description:
+ - Setting value.
+ returned: always
+ type: raw
+ sample: 1000
+ description:
+ description:
+ - Description of the configuration.
+ returned: always
+ type: str
+ sample: Deadlock timeout.
+ source:
+ description:
+ - Source of the configuration.
+ returned: always
+ type: str
+ sample: system-default
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMariaDbConfigurationInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(changed=False)
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMariaDbConfigurationInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mariadbconfiguration_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mariadbconfiguration_facts' module has been renamed to 'azure_rm_mariadbconfiguration_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(MariaDBManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['settings'] = self.get()
+ else:
+ self.results['settings'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified MariaDB Configuration.
+
+ :return: deserialized MariaDB Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ configuration_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Configurations.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ '''
+ Gets facts of the specified MariaDB Configuration.
+
+ :return: deserialized MariaDB Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Configurations.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'id': d['id'],
+ 'name': d['name'],
+ 'value': d['value'],
+ 'description': d['description'],
+ 'source': d['source']
+ }
+ return d
+
+
+def main():
+ AzureRMMariaDbConfigurationInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbconfiguration_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbconfiguration_info.py
new file mode 100644
index 00000000..678b1214
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbconfiguration_info.py
@@ -0,0 +1,216 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mariadbconfiguration_info
+short_description: Get Azure MariaDB Configuration facts
+description:
+ - Get facts of Azure MariaDB Configuration.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - Setting name.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+ - Matti Ranta (@techknowlogick)
+
+'''
+
+EXAMPLES = '''
+ - name: Get specific setting of MariaDB Server
+ community.azure.azure_rm_mariadbconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: testserver
+ name: deadlock_timeout
+
+ - name: Get all settings of MariaDB Server
+ community.azure.azure_rm_mariadbconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+settings:
+ description:
+ - A list of dictionaries containing MariaDB Server settings.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Setting resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMariaDB/servers/testserver
+ /configurations/deadlock_timeout"
+ name:
+ description:
+ - Setting name.
+ returned: always
+ type: str
+ sample: deadlock_timeout
+ value:
+ description:
+ - Setting value.
+ returned: always
+ type: raw
+ sample: 1000
+ description:
+ description:
+ - Description of the configuration.
+ returned: always
+ type: str
+ sample: Deadlock timeout.
+ source:
+ description:
+ - Source of the configuration.
+ returned: always
+ type: str
+ sample: system-default
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMariaDbConfigurationInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(changed=False)
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMariaDbConfigurationInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mariadbconfiguration_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mariadbconfiguration_facts' module has been renamed to 'azure_rm_mariadbconfiguration_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(MariaDBManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['settings'] = self.get()
+ else:
+ self.results['settings'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified MariaDB Configuration.
+
+ :return: deserialized MariaDB Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ configuration_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Configurations.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ '''
+ Gets facts of the specified MariaDB Configuration.
+
+ :return: deserialized MariaDB Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Configurations.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'id': d['id'],
+ 'name': d['name'],
+ 'value': d['value'],
+ 'description': d['description'],
+ 'source': d['source']
+ }
+ return d
+
+
+def main():
+ AzureRMMariaDbConfigurationInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbdatabase_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbdatabase_facts.py
new file mode 100644
index 00000000..bad4508b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbdatabase_facts.py
@@ -0,0 +1,211 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mariadbdatabase_info
+short_description: Get Azure MariaDB Database facts
+description:
+ - Get facts of MariaDB Database.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the database.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+ - Matti Ranta (@techknowlogick)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MariaDB Database
+ community.azure.azure_rm_mariadbdatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: database_name
+
+ - name: List instances of MariaDB Database
+ community.azure.azure_rm_mariadbdatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+databases:
+ description:
+ - A list of dictionaries containing facts for MariaDB Databases.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMariaDB/servers/testser
+ ver/databases/db1"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: testrg
+ server_name:
+ description:
+ - Server name.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: db1
+ charset:
+ description:
+ - The charset of the database.
+ returned: always
+ type: str
+ sample: UTF8
+ collation:
+ description:
+ - The collation of the database.
+ returned: always
+ type: str
+ sample: English_United States.1252
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMariaDbDatabaseInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMariaDbDatabaseInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mariadbdatabase_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mariadbdatabase_facts' module has been renamed to 'azure_rm_mariadbdatabase_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.server_name is not None and
+ self.name is not None):
+ self.results['databases'] = self.get()
+ elif (self.resource_group is not None and
+ self.server_name is not None):
+ self.results['databases'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mariadb_client.databases.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ database_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Databases.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mariadb_client.databases.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail("Error listing for server {0} - {1}".format(self.server_name, str(e)))
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'charset': d['charset'],
+ 'collation': d['collation']
+ }
+ return d
+
+
+def main():
+ AzureRMMariaDbDatabaseInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbdatabase_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbdatabase_info.py
new file mode 100644
index 00000000..bad4508b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbdatabase_info.py
@@ -0,0 +1,211 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mariadbdatabase_info
+short_description: Get Azure MariaDB Database facts
+description:
+ - Get facts of MariaDB Database.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the database.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+ - Matti Ranta (@techknowlogick)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MariaDB Database
+ community.azure.azure_rm_mariadbdatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: database_name
+
+ - name: List instances of MariaDB Database
+ community.azure.azure_rm_mariadbdatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+databases:
+ description:
+ - A list of dictionaries containing facts for MariaDB Databases.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMariaDB/servers/testser
+ ver/databases/db1"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: testrg
+ server_name:
+ description:
+ - Server name.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: db1
+ charset:
+ description:
+ - The charset of the database.
+ returned: always
+ type: str
+ sample: UTF8
+ collation:
+ description:
+ - The collation of the database.
+ returned: always
+ type: str
+ sample: English_United States.1252
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMariaDbDatabaseInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMariaDbDatabaseInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mariadbdatabase_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mariadbdatabase_facts' module has been renamed to 'azure_rm_mariadbdatabase_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.server_name is not None and
+ self.name is not None):
+ self.results['databases'] = self.get()
+ elif (self.resource_group is not None and
+ self.server_name is not None):
+ self.results['databases'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mariadb_client.databases.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ database_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Databases.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mariadb_client.databases.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail("Error listing for server {0} - {1}".format(self.server_name, str(e)))
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'charset': d['charset'],
+ 'collation': d['collation']
+ }
+ return d
+
+
+def main():
+ AzureRMMariaDbDatabaseInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbfirewallrule_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbfirewallrule_facts.py
new file mode 100644
index 00000000..793a7f30
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbfirewallrule_facts.py
@@ -0,0 +1,207 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mariadbfirewallrule_info
+short_description: Get Azure MariaDB Firewall Rule facts
+description:
+ - Get facts of Azure MariaDB Firewall Rule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server firewall rule.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+ - Matti Ranta (@techknowlogick)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MariaDB Firewall Rule
+ community.azure.azure_rm_mariadbfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: firewall_rule_name
+
+ - name: List instances of MariaDB Firewall Rule
+ community.azure.azure_rm_mariadbfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+rules:
+ description:
+ - A list of dictionaries containing facts for MariaDB Firewall Rule.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/TestGroup/providers/Microsoft.DBforMariaDB/servers/testserver/fire
+ wallRules/rule1"
+ server_name:
+ description:
+ - The name of the server.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: rule1
+ start_ip_address:
+ description:
+ - The start IP address of the MariaDB firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.16
+ end_ip_address:
+ description:
+ - The end IP address of the MariaDB firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.18
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMariaDbFirewallRuleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMariaDbFirewallRuleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mariadbfirewallrule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mariadbfirewallrule_facts' module has been renamed to 'azure_rm_mariadbfirewallrule_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(MariaDBManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if (self.name is not None):
+ self.results['rules'] = self.get()
+ else:
+ self.results['rules'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ firewall_rule_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d['id'],
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'start_ip_address': d['start_ip_address'],
+ 'end_ip_address': d['end_ip_address']
+ }
+ return d
+
+
+def main():
+ AzureRMMariaDbFirewallRuleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbfirewallrule_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbfirewallrule_info.py
new file mode 100644
index 00000000..793a7f30
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbfirewallrule_info.py
@@ -0,0 +1,207 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mariadbfirewallrule_info
+short_description: Get Azure MariaDB Firewall Rule facts
+description:
+ - Get facts of Azure MariaDB Firewall Rule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server firewall rule.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+ - Matti Ranta (@techknowlogick)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MariaDB Firewall Rule
+ community.azure.azure_rm_mariadbfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: firewall_rule_name
+
+ - name: List instances of MariaDB Firewall Rule
+ community.azure.azure_rm_mariadbfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+rules:
+ description:
+ - A list of dictionaries containing facts for MariaDB Firewall Rule.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/TestGroup/providers/Microsoft.DBforMariaDB/servers/testserver/fire
+ wallRules/rule1"
+ server_name:
+ description:
+ - The name of the server.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: rule1
+ start_ip_address:
+ description:
+ - The start IP address of the MariaDB firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.16
+ end_ip_address:
+ description:
+ - The end IP address of the MariaDB firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.18
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMariaDbFirewallRuleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMariaDbFirewallRuleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mariadbfirewallrule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mariadbfirewallrule_facts' module has been renamed to 'azure_rm_mariadbfirewallrule_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(MariaDBManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if (self.name is not None):
+ self.results['rules'] = self.get()
+ else:
+ self.results['rules'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ firewall_rule_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d['id'],
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'start_ip_address': d['start_ip_address'],
+ 'end_ip_address': d['end_ip_address']
+ }
+ return d
+
+
+def main():
+ AzureRMMariaDbFirewallRuleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbserver_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbserver_facts.py
new file mode 100644
index 00000000..200fc6be
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbserver_facts.py
@@ -0,0 +1,264 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mariadbserver_info
+short_description: Get Azure MariaDB Server facts
+description:
+ - Get facts of MariaDB Server.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+ - Matti Ranta (@techknowlogick)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MariaDB Server
+ community.azure.azure_rm_mariadbserver_info:
+ resource_group: myResourceGroup
+ name: server_name
+
+ - name: List instances of MariaDB Server
+ community.azure.azure_rm_mariadbserver_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+servers:
+ description:
+ - A list of dictionaries containing facts for MariaDB servers.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMariaDB/servers/myabdud1223
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myabdud1223
+ location:
+ description:
+ - The location the resource resides in.
+ returned: always
+ type: str
+ sample: eastus
+ sku:
+ description:
+ - The SKU of the server.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - The name of the SKU.
+ returned: always
+ type: str
+ sample: GP_Gen4_2
+ tier:
+ description:
+ - The tier of the particular SKU.
+ returned: always
+ type: str
+ sample: GeneralPurpose
+ capacity:
+ description:
+ - The scale capacity.
+ returned: always
+ type: int
+ sample: 2
+ storage_mb:
+ description:
+ - The maximum storage allowed for a server.
+ returned: always
+ type: int
+ sample: 128000
+ enforce_ssl:
+ description:
+ - Enable SSL enforcement.
+ returned: always
+ type: bool
+ sample: False
+ admin_username:
+ description:
+ - The administrator's login name of a server.
+ returned: always
+ type: str
+ sample: serveradmin
+ version:
+ description:
+ - Server version.
+ returned: always
+ type: str
+ sample: "9.6"
+ user_visible_state:
+ description:
+ - A state of a server that is visible to user.
+ returned: always
+ type: str
+ sample: Ready
+ fully_qualified_domain_name:
+ description:
+ - The fully qualified domain name of a server.
+ returned: always
+ type: str
+ sample: myabdud1223.mys.database.azure.com
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { tag1: abc }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMariaDbServerInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ super(AzureRMMariaDbServerInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mariadbserver_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mariadbserver_facts' module has been renamed to 'azure_rm_mariadbserver_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.name is not None):
+ self.results['servers'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['servers'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mariadb_client.servers.get(resource_group_name=self.resource_group,
+ server_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for MariaDB Server.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mariadb_client.servers.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for MariaDB Servers.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d['id'],
+ 'resource_group': self.resource_group,
+ 'name': d['name'],
+ 'sku': d['sku'],
+ 'location': d['location'],
+ 'storage_mb': d['storage_profile']['storage_mb'],
+ 'version': d['version'],
+ 'enforce_ssl': (d['ssl_enforcement'] == 'Enabled'),
+ 'admin_username': d['administrator_login'],
+ 'user_visible_state': d['user_visible_state'],
+ 'fully_qualified_domain_name': d['fully_qualified_domain_name'],
+ 'tags': d.get('tags')
+ }
+
+ return d
+
+
+def main():
+ AzureRMMariaDbServerInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbserver_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbserver_info.py
new file mode 100644
index 00000000..200fc6be
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mariadbserver_info.py
@@ -0,0 +1,264 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+# Copyright (c) 2019 Matti Ranta, (@techknowlogick)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mariadbserver_info
+short_description: Get Azure MariaDB Server facts
+description:
+ - Get facts of MariaDB Server.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+ - Matti Ranta (@techknowlogick)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MariaDB Server
+ community.azure.azure_rm_mariadbserver_info:
+ resource_group: myResourceGroup
+ name: server_name
+
+ - name: List instances of MariaDB Server
+ community.azure.azure_rm_mariadbserver_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+servers:
+ description:
+ - A list of dictionaries containing facts for MariaDB servers.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMariaDB/servers/myabdud1223
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myabdud1223
+ location:
+ description:
+ - The location the resource resides in.
+ returned: always
+ type: str
+ sample: eastus
+ sku:
+ description:
+ - The SKU of the server.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - The name of the SKU.
+ returned: always
+ type: str
+ sample: GP_Gen4_2
+ tier:
+ description:
+ - The tier of the particular SKU.
+ returned: always
+ type: str
+ sample: GeneralPurpose
+ capacity:
+ description:
+ - The scale capacity.
+ returned: always
+ type: int
+ sample: 2
+ storage_mb:
+ description:
+ - The maximum storage allowed for a server.
+ returned: always
+ type: int
+ sample: 128000
+ enforce_ssl:
+ description:
+ - Enable SSL enforcement.
+ returned: always
+ type: bool
+ sample: False
+ admin_username:
+ description:
+ - The administrator's login name of a server.
+ returned: always
+ type: str
+ sample: serveradmin
+ version:
+ description:
+ - Server version.
+ returned: always
+ type: str
+ sample: "9.6"
+ user_visible_state:
+ description:
+ - A state of a server that is visible to user.
+ returned: always
+ type: str
+ sample: Ready
+ fully_qualified_domain_name:
+ description:
+ - The fully qualified domain name of a server.
+ returned: always
+ type: str
+ sample: myabdud1223.mys.database.azure.com
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { tag1: abc }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMariaDbServerInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ super(AzureRMMariaDbServerInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mariadbserver_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mariadbserver_facts' module has been renamed to 'azure_rm_mariadbserver_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.name is not None):
+ self.results['servers'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['servers'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mariadb_client.servers.get(resource_group_name=self.resource_group,
+ server_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for MariaDB Server.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mariadb_client.servers.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for MariaDB Servers.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d['id'],
+ 'resource_group': self.resource_group,
+ 'name': d['name'],
+ 'sku': d['sku'],
+ 'location': d['location'],
+ 'storage_mb': d['storage_profile']['storage_mb'],
+ 'version': d['version'],
+ 'enforce_ssl': (d['ssl_enforcement'] == 'Enabled'),
+ 'admin_username': d['administrator_login'],
+ 'user_visible_state': d['user_visible_state'],
+ 'fully_qualified_domain_name': d['fully_qualified_domain_name'],
+ 'tags': d.get('tags')
+ }
+
+ return d
+
+
+def main():
+ AzureRMMariaDbServerInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlconfiguration_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlconfiguration_facts.py
new file mode 100644
index 00000000..de4d5b8c
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlconfiguration_facts.py
@@ -0,0 +1,214 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mysqlconfiguration_info
+short_description: Get Azure MySQL Configuration facts
+description:
+ - Get facts of Azure MySQL Configuration.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - Setting name.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get specific setting of MySQL Server
+ community.azure.azure_rm_mysqlconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: testmysqlserver
+ name: deadlock_timeout
+
+ - name: Get all settings of MySQL Server
+ community.azure.azure_rm_mysqlconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+settings:
+ description:
+ - A list of dictionaries containing MySQL Server settings.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Setting resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/testmysqlser
+ ver/configurations/deadlock_timeout"
+ name:
+ description:
+ - Setting name.
+ returned: always
+ type: str
+ sample: deadlock_timeout
+ value:
+ description:
+ - Setting value.
+ returned: always
+ type: raw
+ sample: 1000
+ description:
+ description:
+ - Description of the configuration.
+ returned: always
+ type: str
+ sample: Deadlock timeout.
+ source:
+ description:
+ - Source of the configuration.
+ returned: always
+ type: str
+ sample: system-default
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.mysql import MySQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMySqlConfigurationInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(changed=False)
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMySqlConfigurationInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mysqlconfiguration_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mysqlconfiguration_facts' module has been renamed to 'azure_rm_mysqlconfiguration_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(MySQLManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['settings'] = self.get()
+ else:
+ self.results['settings'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified MySQL Configuration.
+
+ :return: deserialized MySQL Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ configuration_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Configurations.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ '''
+ Gets facts of the specified MySQL Configuration.
+
+ :return: deserialized MySQL Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Configurations.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'id': d['id'],
+ 'name': d['name'],
+ 'value': d['value'],
+ 'description': d['description'],
+ 'source': d['source']
+ }
+ return d
+
+
+def main():
+ AzureRMMySqlConfigurationInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlconfiguration_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlconfiguration_info.py
new file mode 100644
index 00000000..de4d5b8c
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlconfiguration_info.py
@@ -0,0 +1,214 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mysqlconfiguration_info
+short_description: Get Azure MySQL Configuration facts
+description:
+ - Get facts of Azure MySQL Configuration.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - Setting name.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get specific setting of MySQL Server
+ community.azure.azure_rm_mysqlconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: testmysqlserver
+ name: deadlock_timeout
+
+ - name: Get all settings of MySQL Server
+ community.azure.azure_rm_mysqlconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+settings:
+ description:
+ - A list of dictionaries containing MySQL Server settings.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Setting resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/testmysqlser
+ ver/configurations/deadlock_timeout"
+ name:
+ description:
+ - Setting name.
+ returned: always
+ type: str
+ sample: deadlock_timeout
+ value:
+ description:
+ - Setting value.
+ returned: always
+ type: raw
+ sample: 1000
+ description:
+ description:
+ - Description of the configuration.
+ returned: always
+ type: str
+ sample: Deadlock timeout.
+ source:
+ description:
+ - Source of the configuration.
+ returned: always
+ type: str
+ sample: system-default
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.mysql import MySQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMySqlConfigurationInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(changed=False)
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMySqlConfigurationInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mysqlconfiguration_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mysqlconfiguration_facts' module has been renamed to 'azure_rm_mysqlconfiguration_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(MySQLManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['settings'] = self.get()
+ else:
+ self.results['settings'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified MySQL Configuration.
+
+ :return: deserialized MySQL Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ configuration_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Configurations.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ '''
+ Gets facts of the specified MySQL Configuration.
+
+ :return: deserialized MySQL Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Configurations.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'id': d['id'],
+ 'name': d['name'],
+ 'value': d['value'],
+ 'description': d['description'],
+ 'source': d['source']
+ }
+ return d
+
+
+def main():
+ AzureRMMySqlConfigurationInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqldatabase_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqldatabase_facts.py
new file mode 100644
index 00000000..be8da640
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqldatabase_facts.py
@@ -0,0 +1,209 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mysqldatabase_info
+short_description: Get Azure MySQL Database facts
+description:
+ - Get facts of MySQL Database.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the database.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MySQL Database
+ community.azure.azure_rm_mysqldatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: database_name
+
+ - name: List instances of MySQL Database
+ community.azure.azure_rm_mysqldatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+databases:
+ description:
+ - A list of dictionaries containing facts for MySQL Databases.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/testser
+ ver/databases/db1"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: testrg
+ server_name:
+ description:
+ - Server name.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: db1
+ charset:
+ description:
+ - The charset of the database.
+ returned: always
+ type: str
+ sample: utf8
+ collation:
+ description:
+ - The collation of the database.
+ returned: always
+ type: str
+ sample: English_United States.1252
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.mysql import MySQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMySqlDatabaseInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMySqlDatabaseInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mysqldatabase_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mysqldatabase_facts' module has been renamed to 'azure_rm_mysqldatabase_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.server_name is not None and
+ self.name is not None):
+ self.results['databases'] = self.get()
+ elif (self.resource_group is not None and
+ self.server_name is not None):
+ self.results['databases'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mysql_client.databases.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ database_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Databases.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mysql_client.databases.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail("Error listing for server {0} - {1}".format(self.server_name, str(e)))
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'charset': d['charset'],
+ 'collation': d['collation']
+ }
+ return d
+
+
+def main():
+ AzureRMMySqlDatabaseInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqldatabase_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqldatabase_info.py
new file mode 100644
index 00000000..be8da640
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqldatabase_info.py
@@ -0,0 +1,209 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mysqldatabase_info
+short_description: Get Azure MySQL Database facts
+description:
+ - Get facts of MySQL Database.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the database.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MySQL Database
+ community.azure.azure_rm_mysqldatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: database_name
+
+ - name: List instances of MySQL Database
+ community.azure.azure_rm_mysqldatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+databases:
+ description:
+ - A list of dictionaries containing facts for MySQL Databases.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/testser
+ ver/databases/db1"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: testrg
+ server_name:
+ description:
+ - Server name.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: db1
+ charset:
+ description:
+ - The charset of the database.
+ returned: always
+ type: str
+ sample: utf8
+ collation:
+ description:
+ - The collation of the database.
+ returned: always
+ type: str
+ sample: English_United States.1252
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.mysql import MySQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMySqlDatabaseInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMySqlDatabaseInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mysqldatabase_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mysqldatabase_facts' module has been renamed to 'azure_rm_mysqldatabase_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.server_name is not None and
+ self.name is not None):
+ self.results['databases'] = self.get()
+ elif (self.resource_group is not None and
+ self.server_name is not None):
+ self.results['databases'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mysql_client.databases.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ database_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Databases.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mysql_client.databases.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail("Error listing for server {0} - {1}".format(self.server_name, str(e)))
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'charset': d['charset'],
+ 'collation': d['collation']
+ }
+ return d
+
+
+def main():
+ AzureRMMySqlDatabaseInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlfirewallrule_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlfirewallrule_facts.py
new file mode 100644
index 00000000..5e21a89d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlfirewallrule_facts.py
@@ -0,0 +1,205 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mysqlfirewallrule_info
+short_description: Get Azure MySQL Firewall Rule facts
+description:
+ - Get facts of Azure MySQL Firewall Rule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server firewall rule.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MySQL Firewall Rule
+ community.azure.azure_rm_mysqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: firewall_rule_name
+
+ - name: List instances of MySQL Firewall Rule
+ community.azure.azure_rm_mysqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+rules:
+ description:
+ - A list of dictionaries containing facts for MySQL Firewall Rule.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/fire
+ wallRules/rule1"
+ server_name:
+ description:
+ - The name of the server.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: rule1
+ start_ip_address:
+ description:
+ - The start IP address of the MySQL firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.16
+ end_ip_address:
+ description:
+ - The end IP address of the MySQL firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.18
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.mysql import MySQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMySqlFirewallRuleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMySqlFirewallRuleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mysqlfirewallrule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mysqlfirewallrule_facts' module has been renamed to 'azure_rm_mysqlfirewallrule_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(MySQLManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if (self.name is not None):
+ self.results['rules'] = self.get()
+ else:
+ self.results['rules'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ firewall_rule_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d['id'],
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'start_ip_address': d['start_ip_address'],
+ 'end_ip_address': d['end_ip_address']
+ }
+ return d
+
+
+def main():
+ AzureRMMySqlFirewallRuleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlfirewallrule_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlfirewallrule_info.py
new file mode 100644
index 00000000..5e21a89d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlfirewallrule_info.py
@@ -0,0 +1,205 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mysqlfirewallrule_info
+short_description: Get Azure MySQL Firewall Rule facts
+description:
+ - Get facts of Azure MySQL Firewall Rule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server firewall rule.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MySQL Firewall Rule
+ community.azure.azure_rm_mysqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: firewall_rule_name
+
+ - name: List instances of MySQL Firewall Rule
+ community.azure.azure_rm_mysqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+rules:
+ description:
+ - A list of dictionaries containing facts for MySQL Firewall Rule.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/fire
+ wallRules/rule1"
+ server_name:
+ description:
+ - The name of the server.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: rule1
+ start_ip_address:
+ description:
+ - The start IP address of the MySQL firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.16
+ end_ip_address:
+ description:
+ - The end IP address of the MySQL firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.18
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.mysql import MySQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMySqlFirewallRuleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMMySqlFirewallRuleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mysqlfirewallrule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mysqlfirewallrule_facts' module has been renamed to 'azure_rm_mysqlfirewallrule_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(MySQLManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if (self.name is not None):
+ self.results['rules'] = self.get()
+ else:
+ self.results['rules'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ firewall_rule_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d['id'],
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'start_ip_address': d['start_ip_address'],
+ 'end_ip_address': d['end_ip_address']
+ }
+ return d
+
+
+def main():
+ AzureRMMySqlFirewallRuleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlserver_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlserver_facts.py
new file mode 100644
index 00000000..4bb4185b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlserver_facts.py
@@ -0,0 +1,262 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mysqlserver_info
+short_description: Get Azure MySQL Server facts
+description:
+ - Get facts of MySQL Server.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MySQL Server
+ community.azure.azure_rm_mysqlserver_info:
+ resource_group: myResourceGroup
+ name: server_name
+
+ - name: List instances of MySQL Server
+ community.azure.azure_rm_mysqlserver_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+servers:
+ description:
+ - A list of dictionaries containing facts for MySQL servers.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/myabdud1223
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myabdud1223
+ location:
+ description:
+ - The location the resource resides in.
+ returned: always
+ type: str
+ sample: eastus
+ sku:
+ description:
+ - The SKU of the server.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - The name of the SKU.
+ returned: always
+ type: str
+ sample: GP_Gen4_2
+ tier:
+ description:
+ - The tier of the particular SKU.
+ returned: always
+ type: str
+ sample: GeneralPurpose
+ capacity:
+ description:
+ - The scale capacity.
+ returned: always
+ type: int
+ sample: 2
+ storage_mb:
+ description:
+ - The maximum storage allowed for a server.
+ returned: always
+ type: int
+ sample: 128000
+ enforce_ssl:
+ description:
+ - Enable SSL enforcement.
+ returned: always
+ type: bool
+ sample: False
+ admin_username:
+ description:
+ - The administrator's login name of a server.
+ returned: always
+ type: str
+ sample: serveradmin
+ version:
+ description:
+ - Server version.
+ returned: always
+ type: str
+ sample: "9.6"
+ user_visible_state:
+ description:
+ - A state of a server that is visible to user.
+ returned: always
+ type: str
+ sample: Ready
+ fully_qualified_domain_name:
+ description:
+ - The fully qualified domain name of a server.
+ returned: always
+ type: str
+ sample: myabdud1223.mys.database.azure.com
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { tag1: abc }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.mysql import MySQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMySqlServerInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ super(AzureRMMySqlServerInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mysqlserver_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mysqlserver_facts' module has been renamed to 'azure_rm_mysqlserver_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.name is not None):
+ self.results['servers'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['servers'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mysql_client.servers.get(resource_group_name=self.resource_group,
+ server_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for MySQL Server.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mysql_client.servers.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for MySQL Servers.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d['id'],
+ 'resource_group': self.resource_group,
+ 'name': d['name'],
+ 'sku': d['sku'],
+ 'location': d['location'],
+ 'storage_mb': d['storage_profile']['storage_mb'],
+ 'version': d['version'],
+ 'enforce_ssl': (d['ssl_enforcement'] == 'Enabled'),
+ 'admin_username': d['administrator_login'],
+ 'user_visible_state': d['user_visible_state'],
+ 'fully_qualified_domain_name': d['fully_qualified_domain_name'],
+ 'tags': d.get('tags')
+ }
+
+ return d
+
+
+def main():
+ AzureRMMySqlServerInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlserver_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlserver_info.py
new file mode 100644
index 00000000..4bb4185b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_mysqlserver_info.py
@@ -0,0 +1,262 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_mysqlserver_info
+short_description: Get Azure MySQL Server facts
+description:
+ - Get facts of MySQL Server.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of MySQL Server
+ community.azure.azure_rm_mysqlserver_info:
+ resource_group: myResourceGroup
+ name: server_name
+
+ - name: List instances of MySQL Server
+ community.azure.azure_rm_mysqlserver_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+servers:
+ description:
+ - A list of dictionaries containing facts for MySQL servers.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforMySQL/servers/myabdud1223
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myabdud1223
+ location:
+ description:
+ - The location the resource resides in.
+ returned: always
+ type: str
+ sample: eastus
+ sku:
+ description:
+ - The SKU of the server.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - The name of the SKU.
+ returned: always
+ type: str
+ sample: GP_Gen4_2
+ tier:
+ description:
+ - The tier of the particular SKU.
+ returned: always
+ type: str
+ sample: GeneralPurpose
+ capacity:
+ description:
+ - The scale capacity.
+ returned: always
+ type: int
+ sample: 2
+ storage_mb:
+ description:
+ - The maximum storage allowed for a server.
+ returned: always
+ type: int
+ sample: 128000
+ enforce_ssl:
+ description:
+ - Enable SSL enforcement.
+ returned: always
+ type: bool
+ sample: False
+ admin_username:
+ description:
+ - The administrator's login name of a server.
+ returned: always
+ type: str
+ sample: serveradmin
+ version:
+ description:
+ - Server version.
+ returned: always
+ type: str
+ sample: "9.6"
+ user_visible_state:
+ description:
+ - A state of a server that is visible to user.
+ returned: always
+ type: str
+ sample: Ready
+ fully_qualified_domain_name:
+ description:
+ - The fully qualified domain name of a server.
+ returned: always
+ type: str
+ sample: myabdud1223.mys.database.azure.com
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { tag1: abc }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.mysql import MySQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMMySqlServerInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ super(AzureRMMySqlServerInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_mysqlserver_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_mysqlserver_facts' module has been renamed to 'azure_rm_mysqlserver_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.name is not None):
+ self.results['servers'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['servers'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mysql_client.servers.get(resource_group_name=self.resource_group,
+ server_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for MySQL Server.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.mysql_client.servers.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for MySQL Servers.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d['id'],
+ 'resource_group': self.resource_group,
+ 'name': d['name'],
+ 'sku': d['sku'],
+ 'location': d['location'],
+ 'storage_mb': d['storage_profile']['storage_mb'],
+ 'version': d['version'],
+ 'enforce_ssl': (d['ssl_enforcement'] == 'Enabled'),
+ 'admin_username': d['administrator_login'],
+ 'user_visible_state': d['user_visible_state'],
+ 'fully_qualified_domain_name': d['fully_qualified_domain_name'],
+ 'tags': d.get('tags')
+ }
+
+ return d
+
+
+def main():
+ AzureRMMySqlServerInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_networkinterface_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_networkinterface_facts.py
new file mode 100644
index 00000000..4b8dfaba
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_networkinterface_facts.py
@@ -0,0 +1,354 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_networkinterface_info
+
+
+short_description: Get network interface facts
+
+description:
+ - Get facts for a specific network interface or all network interfaces within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific network interface.
+ resource_group:
+ description:
+ - Name of the resource group containing the network interface(s). Required when searching by name.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one network interface
+ community.azure.azure_rm_networkinterface_info:
+ resource_group: myResourceGroup
+ name: nic001
+
+ - name: Get network interfaces within a resource group
+ community.azure.azure_rm_networkinterface_info:
+ resource_group: myResourceGroup
+
+ - name: Get network interfaces by tag
+ community.azure.azure_rm_networkinterface_info:
+ resource_group: myResourceGroup
+ tags:
+ - testing
+ - foo:bar
+'''
+
+RETURN = '''
+azure_networkinterfaces:
+ description:
+ - List of network interface dicts.
+ returned: always
+ type: list
+ example: [{
+ "dns_settings": {
+ "applied_dns_servers": [],
+ "dns_servers": [],
+ "internal_dns_name_label": null,
+ "internal_fqdn": null
+ },
+ "enable_ip_forwarding": false,
+ "etag": 'W/"59726bfc-08c4-44ed-b900-f6a559876a9d"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nic003",
+ "ip_configuration": {
+ "name": "default",
+ "private_ip_address": "10.10.0.4",
+ "private_ip_allocation_method": "Dynamic",
+ "public_ip_address": {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/publicip001",
+ "name": "publicip001"
+ },
+ "subnet": {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet001/subnets/subnet001",
+ "name": "subnet001",
+ "virtual_network_name": "vnet001"
+ }
+ },
+ "location": "westus",
+ "mac_address": null,
+ "name": "nic003",
+ "network_security_group": {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001",
+ "name": "secgroup001"
+ },
+ "primary": null,
+ "provisioning_state": "Succeeded",
+ "tags": {},
+ "type": "Microsoft.Network/networkInterfaces"
+ }]
+networkinterfaces:
+ description:
+ - List of network interface dicts. Each dict contains parameters can be passed to M(community.azure.azure_rm_networkinterface) module.
+ type: list
+ returned: always
+ contains:
+ id:
+ description:
+ - Id of the network interface.
+ resource_group:
+ description:
+ - Name of a resource group where the network interface exists.
+ name:
+ description:
+ - Name of the network interface.
+ location:
+ description:
+ - Azure location.
+ virtual_network:
+ description:
+ - An existing virtual network with which the network interface will be associated.
+ - It is a dict which contains I(name) and I(resource_group) of the virtual network.
+ subnet:
+ description:
+ - Name of an existing subnet within the specified virtual network.
+ tags:
+ description:
+ - Tags of the network interface.
+ ip_configurations:
+ description:
+ - List of IP configurations, if contains multiple configurations.
+ contains:
+ name:
+ description:
+ - Name of the IP configuration.
+ private_ip_address:
+ description:
+ - Private IP address for the IP configuration.
+ private_ip_allocation_method:
+ description:
+ - Private IP allocation method.
+ public_ip_address:
+ description:
+ - Name of the public IP address. None for disable IP address.
+ public_ip_allocation_method:
+ description:
+ - Public IP allocation method.
+ load_balancer_backend_address_pools:
+ description:
+ - List of existing load-balancer backend address pools to associate with the network interface.
+ primary:
+ description:
+ - Whether the IP configuration is the primary one in the list.
+ application_security_groups:
+ description:
+ - List of Application security groups.
+ sample: /subscriptions/<subsid>/resourceGroups/<rg>/providers/Microsoft.Network/applicationSecurityGroups/myASG
+ enable_accelerated_networking:
+ description:
+ - Specifies whether the network interface should be created with the accelerated networking feature or not.
+ create_with_security_group:
+ description:
+ - Specifies whether a default security group should be be created with the NIC. Only applies when creating a new NIC.
+ type: bool
+ security_group:
+ description:
+ - A security group resource ID with which to associate the network interface.
+ enable_ip_forwarding:
+ description:
+ - Whether to enable IP forwarding
+ dns_servers:
+ description:
+ - Which DNS servers should the NIC lookup.
+ - List of IP addresses.
+ mac_address:
+ description:
+ - The MAC address of the network interface.
+ provisioning_state:
+ description:
+ - The provisioning state of the network interface.
+ dns_settings:
+ description:
+ - The DNS settings in network interface.
+ contains:
+ dns_servers:
+ description:
+ - List of DNS servers IP addresses.
+ applied_dns_servers:
+ description:
+ - If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers
+ from all NICs that are part of the Availability Set. This property is what is configured on each of those VMs.
+ internal_dns_name_label:
+ description:
+ - Relative DNS name for this NIC used for internal communications between VMs in the same virtual network.
+ internal_fqdn:
+ description:
+ - Fully qualified DNS name supporting internal communications between VMs in the same virtual network.
+''' # NOQA
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict
+
+
+AZURE_OBJECT_CLASS = 'NetworkInterface'
+
+
+def nic_to_dict(nic):
+ ip_configurations = [
+ dict(
+ name=config.name,
+ private_ip_address=config.private_ip_address,
+ private_ip_allocation_method=config.private_ip_allocation_method,
+ primary=config.primary,
+ load_balancer_backend_address_pools=([item.id for item in config.load_balancer_backend_address_pools]
+ if config.load_balancer_backend_address_pools else None),
+ public_ip_address=config.public_ip_address.id if config.public_ip_address else None,
+ public_ip_allocation_method=config.public_ip_address.public_ip_allocation_method if config.public_ip_address else None,
+ application_security_groups=([asg.id for asg in config.application_security_groups]
+ if config.application_security_groups else None)
+ ) for config in nic.ip_configurations
+ ]
+ config = nic.ip_configurations[0] if len(nic.ip_configurations) > 0 else None
+ subnet_dict = azure_id_to_dict(config.subnet.id) if config and config.subnet else None
+ subnet = subnet_dict.get('subnets') if subnet_dict else None
+ virtual_network = dict(
+ resource_group=subnet_dict.get('resourceGroups'),
+ name=subnet_dict.get('virtualNetworks')) if subnet_dict else None
+ return dict(
+ id=nic.id,
+ resource_group=azure_id_to_dict(nic.id).get('resourceGroups'),
+ name=nic.name,
+ subnet=subnet,
+ virtual_network=virtual_network,
+ location=nic.location,
+ tags=nic.tags,
+ security_group=nic.network_security_group.id if nic.network_security_group else None,
+ dns_settings=dict(
+ dns_servers=nic.dns_settings.dns_servers,
+ applied_dns_servers=nic.dns_settings.applied_dns_servers,
+ internal_dns_name_label=nic.dns_settings.internal_dns_name_label,
+ internal_fqdn=nic.dns_settings.internal_fqdn
+ ),
+ ip_configurations=ip_configurations,
+ mac_address=nic.mac_address,
+ enable_ip_forwarding=nic.enable_ip_forwarding,
+ provisioning_state=nic.provisioning_state,
+ enable_accelerated_networking=nic.enable_accelerated_networking,
+ dns_servers=nic.dns_settings.dns_servers,
+ )
+
+
+class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMNetworkInterfaceInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_networkinterface_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_networkinterface_facts' module has been renamed to 'azure_rm_networkinterface_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ results = []
+
+ if self.name:
+ results = self.get_item()
+ elif self.resource_group:
+ results = self.list_resource_group()
+ else:
+ results = self.list_all()
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_networkinterfaces': self.serialize_nics(results)
+ }
+ self.results['networkinterfaces'] = self.to_dict_list(results)
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ try:
+ item = self.network_client.network_interfaces.get(self.resource_group, self.name)
+ except Exception:
+ pass
+
+ return [item] if item and self.has_tags(item.tags, self.tags) else []
+
+ def list_resource_group(self):
+ self.log('List for resource group')
+ try:
+ response = self.network_client.network_interfaces.list(self.resource_group)
+ return [item for item in response if self.has_tags(item.tags, self.tags)]
+ except Exception as exc:
+ self.fail("Error listing by resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ def list_all(self):
+ self.log('List all')
+ try:
+ response = self.network_client.network_interfaces.list_all()
+ return [item for item in response if self.has_tags(item.tags, self.tags)]
+ except Exception as exc:
+ self.fail("Error listing all - {0}".format(str(exc)))
+
+ def serialize_nics(self, raws):
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raws] if raws else []
+
+ def to_dict_list(self, raws):
+ return [nic_to_dict(item) for item in raws] if raws else []
+
+
+def main():
+ AzureRMNetworkInterfaceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_networkinterface_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_networkinterface_info.py
new file mode 100644
index 00000000..4b8dfaba
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_networkinterface_info.py
@@ -0,0 +1,354 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_networkinterface_info
+
+
+short_description: Get network interface facts
+
+description:
+ - Get facts for a specific network interface or all network interfaces within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific network interface.
+ resource_group:
+ description:
+ - Name of the resource group containing the network interface(s). Required when searching by name.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one network interface
+ community.azure.azure_rm_networkinterface_info:
+ resource_group: myResourceGroup
+ name: nic001
+
+ - name: Get network interfaces within a resource group
+ community.azure.azure_rm_networkinterface_info:
+ resource_group: myResourceGroup
+
+ - name: Get network interfaces by tag
+ community.azure.azure_rm_networkinterface_info:
+ resource_group: myResourceGroup
+ tags:
+ - testing
+ - foo:bar
+'''
+
+RETURN = '''
+azure_networkinterfaces:
+ description:
+ - List of network interface dicts.
+ returned: always
+ type: list
+ example: [{
+ "dns_settings": {
+ "applied_dns_servers": [],
+ "dns_servers": [],
+ "internal_dns_name_label": null,
+ "internal_fqdn": null
+ },
+ "enable_ip_forwarding": false,
+ "etag": 'W/"59726bfc-08c4-44ed-b900-f6a559876a9d"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nic003",
+ "ip_configuration": {
+ "name": "default",
+ "private_ip_address": "10.10.0.4",
+ "private_ip_allocation_method": "Dynamic",
+ "public_ip_address": {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/publicip001",
+ "name": "publicip001"
+ },
+ "subnet": {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet001/subnets/subnet001",
+ "name": "subnet001",
+ "virtual_network_name": "vnet001"
+ }
+ },
+ "location": "westus",
+ "mac_address": null,
+ "name": "nic003",
+ "network_security_group": {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001",
+ "name": "secgroup001"
+ },
+ "primary": null,
+ "provisioning_state": "Succeeded",
+ "tags": {},
+ "type": "Microsoft.Network/networkInterfaces"
+ }]
+networkinterfaces:
+ description:
+ - List of network interface dicts. Each dict contains parameters can be passed to M(community.azure.azure_rm_networkinterface) module.
+ type: list
+ returned: always
+ contains:
+ id:
+ description:
+ - Id of the network interface.
+ resource_group:
+ description:
+ - Name of a resource group where the network interface exists.
+ name:
+ description:
+ - Name of the network interface.
+ location:
+ description:
+ - Azure location.
+ virtual_network:
+ description:
+ - An existing virtual network with which the network interface will be associated.
+ - It is a dict which contains I(name) and I(resource_group) of the virtual network.
+ subnet:
+ description:
+ - Name of an existing subnet within the specified virtual network.
+ tags:
+ description:
+ - Tags of the network interface.
+ ip_configurations:
+ description:
+ - List of IP configurations, if contains multiple configurations.
+ contains:
+ name:
+ description:
+ - Name of the IP configuration.
+ private_ip_address:
+ description:
+ - Private IP address for the IP configuration.
+ private_ip_allocation_method:
+ description:
+ - Private IP allocation method.
+ public_ip_address:
+ description:
+ - Name of the public IP address. None for disable IP address.
+ public_ip_allocation_method:
+ description:
+ - Public IP allocation method.
+ load_balancer_backend_address_pools:
+ description:
+ - List of existing load-balancer backend address pools to associate with the network interface.
+ primary:
+ description:
+ - Whether the IP configuration is the primary one in the list.
+ application_security_groups:
+ description:
+ - List of Application security groups.
+ sample: /subscriptions/<subsid>/resourceGroups/<rg>/providers/Microsoft.Network/applicationSecurityGroups/myASG
+ enable_accelerated_networking:
+ description:
+ - Specifies whether the network interface should be created with the accelerated networking feature or not.
+ create_with_security_group:
+ description:
+ - Specifies whether a default security group should be be created with the NIC. Only applies when creating a new NIC.
+ type: bool
+ security_group:
+ description:
+ - A security group resource ID with which to associate the network interface.
+ enable_ip_forwarding:
+ description:
+ - Whether to enable IP forwarding
+ dns_servers:
+ description:
+ - Which DNS servers should the NIC lookup.
+ - List of IP addresses.
+ mac_address:
+ description:
+ - The MAC address of the network interface.
+ provisioning_state:
+ description:
+ - The provisioning state of the network interface.
+ dns_settings:
+ description:
+ - The DNS settings in network interface.
+ contains:
+ dns_servers:
+ description:
+ - List of DNS servers IP addresses.
+ applied_dns_servers:
+ description:
+ - If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers
+ from all NICs that are part of the Availability Set. This property is what is configured on each of those VMs.
+ internal_dns_name_label:
+ description:
+ - Relative DNS name for this NIC used for internal communications between VMs in the same virtual network.
+ internal_fqdn:
+ description:
+ - Fully qualified DNS name supporting internal communications between VMs in the same virtual network.
+''' # NOQA
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict
+
+
+AZURE_OBJECT_CLASS = 'NetworkInterface'
+
+
+def nic_to_dict(nic):
+ ip_configurations = [
+ dict(
+ name=config.name,
+ private_ip_address=config.private_ip_address,
+ private_ip_allocation_method=config.private_ip_allocation_method,
+ primary=config.primary,
+ load_balancer_backend_address_pools=([item.id for item in config.load_balancer_backend_address_pools]
+ if config.load_balancer_backend_address_pools else None),
+ public_ip_address=config.public_ip_address.id if config.public_ip_address else None,
+ public_ip_allocation_method=config.public_ip_address.public_ip_allocation_method if config.public_ip_address else None,
+ application_security_groups=([asg.id for asg in config.application_security_groups]
+ if config.application_security_groups else None)
+ ) for config in nic.ip_configurations
+ ]
+ config = nic.ip_configurations[0] if len(nic.ip_configurations) > 0 else None
+ subnet_dict = azure_id_to_dict(config.subnet.id) if config and config.subnet else None
+ subnet = subnet_dict.get('subnets') if subnet_dict else None
+ virtual_network = dict(
+ resource_group=subnet_dict.get('resourceGroups'),
+ name=subnet_dict.get('virtualNetworks')) if subnet_dict else None
+ return dict(
+ id=nic.id,
+ resource_group=azure_id_to_dict(nic.id).get('resourceGroups'),
+ name=nic.name,
+ subnet=subnet,
+ virtual_network=virtual_network,
+ location=nic.location,
+ tags=nic.tags,
+ security_group=nic.network_security_group.id if nic.network_security_group else None,
+ dns_settings=dict(
+ dns_servers=nic.dns_settings.dns_servers,
+ applied_dns_servers=nic.dns_settings.applied_dns_servers,
+ internal_dns_name_label=nic.dns_settings.internal_dns_name_label,
+ internal_fqdn=nic.dns_settings.internal_fqdn
+ ),
+ ip_configurations=ip_configurations,
+ mac_address=nic.mac_address,
+ enable_ip_forwarding=nic.enable_ip_forwarding,
+ provisioning_state=nic.provisioning_state,
+ enable_accelerated_networking=nic.enable_accelerated_networking,
+ dns_servers=nic.dns_settings.dns_servers,
+ )
+
+
+class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMNetworkInterfaceInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_networkinterface_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_networkinterface_facts' module has been renamed to 'azure_rm_networkinterface_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ results = []
+
+ if self.name:
+ results = self.get_item()
+ elif self.resource_group:
+ results = self.list_resource_group()
+ else:
+ results = self.list_all()
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_networkinterfaces': self.serialize_nics(results)
+ }
+ self.results['networkinterfaces'] = self.to_dict_list(results)
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ try:
+ item = self.network_client.network_interfaces.get(self.resource_group, self.name)
+ except Exception:
+ pass
+
+ return [item] if item and self.has_tags(item.tags, self.tags) else []
+
+ def list_resource_group(self):
+ self.log('List for resource group')
+ try:
+ response = self.network_client.network_interfaces.list(self.resource_group)
+ return [item for item in response if self.has_tags(item.tags, self.tags)]
+ except Exception as exc:
+ self.fail("Error listing by resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ def list_all(self):
+ self.log('List all')
+ try:
+ response = self.network_client.network_interfaces.list_all()
+ return [item for item in response if self.has_tags(item.tags, self.tags)]
+ except Exception as exc:
+ self.fail("Error listing all - {0}".format(str(exc)))
+
+ def serialize_nics(self, raws):
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raws] if raws else []
+
+ def to_dict_list(self, raws):
+ return [nic_to_dict(item) for item in raws] if raws else []
+
+
+def main():
+ AzureRMNetworkInterfaceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlconfiguration_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlconfiguration_facts.py
new file mode 100644
index 00000000..12321999
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlconfiguration_facts.py
@@ -0,0 +1,217 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_postgresqlconfiguration_info
+short_description: Get Azure PostgreSQL Configuration facts
+description:
+ - Get facts of Azure PostgreSQL Configuration.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - Setting name.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get specific setting of PostgreSQL configuration
+ community.azure.azure_rm_postgresqlconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: testpostgresqlserver
+ name: deadlock_timeout
+
+ - name: Get all settings of PostgreSQL Configuration
+ community.azure.azure_rm_postgresqlconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: testpostgresqlserver
+'''
+
+RETURN = '''
+settings:
+ description:
+ - A list of dictionaries containing MySQL Server settings.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Setting resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/testpostgresqlser
+ ver/configurations/deadlock_timeout"
+ name:
+ description:
+ - Setting name.
+ returned: always
+ type: str
+ sample: deadlock_timeout
+ value:
+ description:
+ - Setting value.
+ returned: always
+ type: raw
+ sample: 1000
+ description:
+ description:
+ - Description of the configuration.
+ returned: always
+ type: str
+ sample: Deadlock timeout.
+ source:
+ description:
+ - Source of the configuration.
+ returned: always
+ type: str
+ sample: system-default
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMPostgreSQLConfigurationInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMPostgreSQLConfigurationInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_postgresqlconfiguration_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_postgresqlconfiguration_facts' module has been renamed to 'azure_rm_postgresqlconfiguration_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(PostgreSQLManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['settings'] = self.get()
+ else:
+ self.results['settings'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified PostgreSQL Configuration.
+
+ :return: deserialized PostgreSQL Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ configuration_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get requested setting.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ '''
+ Gets facts of the specified PostgreSQL Configuration.
+
+ :return: deserialized PostgreSQL Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get settings for server.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'id': d['id'],
+ 'name': d['name'],
+ 'value': d['value'],
+ 'description': d['description'],
+ 'source': d['source']
+ }
+ return d
+
+
+def main():
+ AzureRMPostgreSQLConfigurationInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlconfiguration_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlconfiguration_info.py
new file mode 100644
index 00000000..12321999
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlconfiguration_info.py
@@ -0,0 +1,217 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_postgresqlconfiguration_info
+short_description: Get Azure PostgreSQL Configuration facts
+description:
+ - Get facts of Azure PostgreSQL Configuration.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - Setting name.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get specific setting of PostgreSQL configuration
+ community.azure.azure_rm_postgresqlconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: testpostgresqlserver
+ name: deadlock_timeout
+
+ - name: Get all settings of PostgreSQL Configuration
+ community.azure.azure_rm_postgresqlconfiguration_info:
+ resource_group: myResourceGroup
+ server_name: testpostgresqlserver
+'''
+
+RETURN = '''
+settings:
+ description:
+ - A list of dictionaries containing MySQL Server settings.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Setting resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/testpostgresqlser
+ ver/configurations/deadlock_timeout"
+ name:
+ description:
+ - Setting name.
+ returned: always
+ type: str
+ sample: deadlock_timeout
+ value:
+ description:
+ - Setting value.
+ returned: always
+ type: raw
+ sample: 1000
+ description:
+ description:
+ - Description of the configuration.
+ returned: always
+ type: str
+ sample: Deadlock timeout.
+ source:
+ description:
+ - Source of the configuration.
+ returned: always
+ type: str
+ sample: system-default
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.azure_operation import AzureOperationPoller
+ from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMPostgreSQLConfigurationInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMPostgreSQLConfigurationInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_postgresqlconfiguration_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_postgresqlconfiguration_facts' module has been renamed to 'azure_rm_postgresqlconfiguration_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(PostgreSQLManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.name is not None:
+ self.results['settings'] = self.get()
+ else:
+ self.results['settings'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified PostgreSQL Configuration.
+
+ :return: deserialized PostgreSQL Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ configuration_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get requested setting.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ '''
+ Gets facts of the specified PostgreSQL Configuration.
+
+ :return: deserialized PostgreSQL Configurationinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.configurations.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get settings for server.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'id': d['id'],
+ 'name': d['name'],
+ 'value': d['value'],
+ 'description': d['description'],
+ 'source': d['source']
+ }
+ return d
+
+
+def main():
+ AzureRMPostgreSQLConfigurationInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqldatabase_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqldatabase_facts.py
new file mode 100644
index 00000000..acba642f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqldatabase_facts.py
@@ -0,0 +1,209 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_postgresqldatabase_info
+short_description: Get Azure PostgreSQL Database facts
+description:
+ - Get facts of PostgreSQL Database.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the database.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of PostgreSQL Database
+ community.azure.azure_rm_postgresqldatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: database_name
+
+ - name: List instances of PostgreSQL Database
+ community.azure.azure_rm_postgresqldatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+databases:
+ description:
+ - A list of dict results where the key is the name of the PostgreSQL Database and the values are the facts for that PostgreSQL Database.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/testser
+ ver/databases/db1"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: testrg
+ server_name:
+ description:
+ - Server name.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: db1
+ charset:
+ description:
+ - The charset of the database.
+ returned: always
+ type: str
+ sample: UTF8
+ collation:
+ description:
+ - The collation of the database.
+ returned: always
+ type: str
+ sample: English_United States.1252
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMPostgreSqlDatabasesInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMPostgreSqlDatabasesInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_postgresqldatabase_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_postgresqldatabase_facts' module has been renamed to 'azure_rm_postgresqldatabase_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.server_name is not None and
+ self.name is not None):
+ self.results['databases'] = self.get()
+ elif (self.resource_group is not None and
+ self.server_name is not None):
+ self.results['databases'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.postgresql_client.databases.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ database_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Databases.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.postgresql_client.databases.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail("Error listing for server {0} - {1}".format(self.server_name, str(e)))
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'charset': d['charset'],
+ 'collation': d['collation']
+ }
+ return d
+
+
+def main():
+ AzureRMPostgreSqlDatabasesInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqldatabase_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqldatabase_info.py
new file mode 100644
index 00000000..acba642f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqldatabase_info.py
@@ -0,0 +1,209 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_postgresqldatabase_info
+short_description: Get Azure PostgreSQL Database facts
+description:
+ - Get facts of PostgreSQL Database.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the database.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of PostgreSQL Database
+ community.azure.azure_rm_postgresqldatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: database_name
+
+ - name: List instances of PostgreSQL Database
+ community.azure.azure_rm_postgresqldatabase_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+databases:
+ description:
+ - A list of dict results where the key is the name of the PostgreSQL Database and the values are the facts for that PostgreSQL Database.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/testser
+ ver/databases/db1"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: testrg
+ server_name:
+ description:
+ - Server name.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: db1
+ charset:
+ description:
+ - The charset of the database.
+ returned: always
+ type: str
+ sample: UTF8
+ collation:
+ description:
+ - The collation of the database.
+ returned: always
+ type: str
+ sample: English_United States.1252
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMPostgreSqlDatabasesInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMPostgreSqlDatabasesInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_postgresqldatabase_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_postgresqldatabase_facts' module has been renamed to 'azure_rm_postgresqldatabase_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.server_name is not None and
+ self.name is not None):
+ self.results['databases'] = self.get()
+ elif (self.resource_group is not None and
+ self.server_name is not None):
+ self.results['databases'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.postgresql_client.databases.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ database_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Databases.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.postgresql_client.databases.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail("Error listing for server {0} - {1}".format(self.server_name, str(e)))
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'charset': d['charset'],
+ 'collation': d['collation']
+ }
+ return d
+
+
+def main():
+ AzureRMPostgreSqlDatabasesInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlfirewallrule_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlfirewallrule_facts.py
new file mode 100644
index 00000000..670a34ea
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlfirewallrule_facts.py
@@ -0,0 +1,205 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_postgresqlfirewallrule_info
+short_description: Get Azure PostgreSQL Firewall Rule facts
+description:
+ - Get facts of Azure PostgreSQL Firewall Rule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server firewall rule.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of PostgreSQL Firewall Rule
+ community.azure.azure_rm_postgresqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: firewall_rule_name
+
+ - name: List instances of PostgreSQL Firewall Rule
+ community.azure.azure_rm_postgresqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+rules:
+ description:
+ - A list of dictionaries containing facts for PostgreSQL Firewall Rule.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/fire
+ wallRules/rule1"
+ server_name:
+ description:
+ - The name of the server.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: rule1
+ start_ip_address:
+ description:
+ - The start IP address of the PostgreSQL firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.16
+ end_ip_address:
+ description:
+ - The end IP address of the PostgreSQL firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.18
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMPostgreSQLFirewallRulesInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMPostgreSQLFirewallRulesInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_postgresqlfirewallrule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_postgresqlfirewallrule_facts' module has been renamed to 'azure_rm_postgresqlfirewallrule_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(PostgreSQLManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if (self.name is not None):
+ self.results['rules'] = self.get()
+ else:
+ self.results['rules'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ firewall_rule_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d['id'],
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'start_ip_address': d['start_ip_address'],
+ 'end_ip_address': d['end_ip_address']
+ }
+ return d
+
+
+def main():
+ AzureRMPostgreSQLFirewallRulesInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlfirewallrule_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlfirewallrule_info.py
new file mode 100644
index 00000000..670a34ea
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlfirewallrule_info.py
@@ -0,0 +1,205 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_postgresqlfirewallrule_info
+short_description: Get Azure PostgreSQL Firewall Rule facts
+description:
+ - Get facts of Azure PostgreSQL Firewall Rule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ type: str
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server firewall rule.
+ type: str
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of PostgreSQL Firewall Rule
+ community.azure.azure_rm_postgresqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+ name: firewall_rule_name
+
+ - name: List instances of PostgreSQL Firewall Rule
+ community.azure.azure_rm_postgresqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+'''
+
+RETURN = '''
+rules:
+ description:
+ - A list of dictionaries containing facts for PostgreSQL Firewall Rule.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/fire
+ wallRules/rule1"
+ server_name:
+ description:
+ - The name of the server.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: rule1
+ start_ip_address:
+ description:
+ - The start IP address of the PostgreSQL firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.16
+ end_ip_address:
+ description:
+ - The end IP address of the PostgreSQL firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.18
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMPostgreSQLFirewallRulesInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMPostgreSQLFirewallRulesInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_postgresqlfirewallrule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_postgresqlfirewallrule_facts' module has been renamed to 'azure_rm_postgresqlfirewallrule_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(PostgreSQLManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if (self.name is not None):
+ self.results['rules'] = self.get()
+ else:
+ self.results['rules'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ firewall_rule_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.firewall_rules.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d['id'],
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'start_ip_address': d['start_ip_address'],
+ 'end_ip_address': d['end_ip_address']
+ }
+ return d
+
+
+def main():
+ AzureRMPostgreSQLFirewallRulesInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlserver_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlserver_facts.py
new file mode 100644
index 00000000..390e6887
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlserver_facts.py
@@ -0,0 +1,263 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_postgresqlserver_info
+short_description: Get Azure PostgreSQL Server facts
+description:
+ - Get facts of PostgreSQL Server.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of PostgreSQL Server
+ community.azure.azure_rm_postgresqlserver_info:
+ resource_group: myResourceGroup
+ name: server_name
+
+ - name: List instances of PostgreSQL Server
+ community.azure.azure_rm_postgresqlserver_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+servers:
+ description:
+ - A list of dictionaries containing facts for PostgreSQL servers.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/po
+ stgreabdud1223"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: postgreabdud1223
+ location:
+ description:
+ - The location the resource resides in.
+ returned: always
+ type: str
+ sample: eastus
+ sku:
+ description:
+ - The SKU of the server.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - The name of the SKU.
+ returned: always
+ type: str
+ sample: GP_Gen4_2
+ tier:
+ description:
+ - The tier of the particular SKU.
+ returned: always
+ type: str
+ sample: GeneralPurpose
+ capacity:
+ description:
+ - The scale capacity.
+ returned: always
+ type: int
+ sample: 2
+ storage_mb:
+ description:
+ - The maximum storage allowed for a server.
+ returned: always
+ type: int
+ sample: 128000
+ enforce_ssl:
+ description:
+ - Enable SSL enforcement.
+ returned: always
+ type: bool
+ sample: False
+ admin_username:
+ description:
+ - The administrator's login name of a server.
+ returned: always
+ type: str
+ sample: serveradmin
+ version:
+ description:
+ - Server version.
+ returned: always
+ type: str
+ sample: "9.6"
+ user_visible_state:
+ description:
+ - A state of a server that is visible to user.
+ returned: always
+ type: str
+ sample: Ready
+ fully_qualified_domain_name:
+ description:
+ - The fully qualified domain name of a server.
+ returned: always
+ type: str
+ sample: postgreabdud1223.postgres.database.azure.com
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { tag1: abc }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMPostgreSqlServersInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ super(AzureRMPostgreSqlServersInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_postgresqlserver_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_postgresqlserver_facts' module has been renamed to 'azure_rm_postgresqlserver_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.name is not None):
+ self.results['servers'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['servers'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.postgresql_client.servers.get(resource_group_name=self.resource_group,
+ server_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for PostgreSQL Server.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.postgresql_client.servers.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for PostgreSQL Servers.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d['id'],
+ 'resource_group': self.resource_group,
+ 'name': d['name'],
+ 'sku': d['sku'],
+ 'location': d['location'],
+ 'storage_mb': d['storage_profile']['storage_mb'],
+ 'version': d['version'],
+ 'enforce_ssl': (d['ssl_enforcement'] == 'Enabled'),
+ 'admin_username': d['administrator_login'],
+ 'user_visible_state': d['user_visible_state'],
+ 'fully_qualified_domain_name': d['fully_qualified_domain_name'],
+ 'tags': d.get('tags')
+ }
+
+ return d
+
+
+def main():
+ AzureRMPostgreSqlServersInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlserver_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlserver_info.py
new file mode 100644
index 00000000..390e6887
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_postgresqlserver_info.py
@@ -0,0 +1,263 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_postgresqlserver_info
+short_description: Get Azure PostgreSQL Server facts
+description:
+ - Get facts of PostgreSQL Server.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ type: str
+ name:
+ description:
+ - The name of the server.
+ type: str
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ type: list
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of PostgreSQL Server
+ community.azure.azure_rm_postgresqlserver_info:
+ resource_group: myResourceGroup
+ name: server_name
+
+ - name: List instances of PostgreSQL Server
+ community.azure.azure_rm_postgresqlserver_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+servers:
+ description:
+ - A list of dictionaries containing facts for PostgreSQL servers.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/po
+ stgreabdud1223"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: postgreabdud1223
+ location:
+ description:
+ - The location the resource resides in.
+ returned: always
+ type: str
+ sample: eastus
+ sku:
+ description:
+ - The SKU of the server.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - The name of the SKU.
+ returned: always
+ type: str
+ sample: GP_Gen4_2
+ tier:
+ description:
+ - The tier of the particular SKU.
+ returned: always
+ type: str
+ sample: GeneralPurpose
+ capacity:
+ description:
+ - The scale capacity.
+ returned: always
+ type: int
+ sample: 2
+ storage_mb:
+ description:
+ - The maximum storage allowed for a server.
+ returned: always
+ type: int
+ sample: 128000
+ enforce_ssl:
+ description:
+ - Enable SSL enforcement.
+ returned: always
+ type: bool
+ sample: False
+ admin_username:
+ description:
+ - The administrator's login name of a server.
+ returned: always
+ type: str
+ sample: serveradmin
+ version:
+ description:
+ - Server version.
+ returned: always
+ type: str
+ sample: "9.6"
+ user_visible_state:
+ description:
+ - A state of a server that is visible to user.
+ returned: always
+ type: str
+ sample: Ready
+ fully_qualified_domain_name:
+ description:
+ - The fully qualified domain name of a server.
+ returned: always
+ type: str
+ sample: postgreabdud1223.postgres.database.azure.com
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ type: dict
+ sample: { tag1: abc }
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMPostgreSqlServersInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+ super(AzureRMPostgreSqlServersInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_postgresqlserver_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_postgresqlserver_facts' module has been renamed to 'azure_rm_postgresqlserver_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.name is not None):
+ self.results['servers'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['servers'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.postgresql_client.servers.get(resource_group_name=self.resource_group,
+ server_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for PostgreSQL Server.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_resource_group(self):
+ response = None
+ results = []
+ try:
+ response = self.postgresql_client.servers.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for PostgreSQL Servers.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d['id'],
+ 'resource_group': self.resource_group,
+ 'name': d['name'],
+ 'sku': d['sku'],
+ 'location': d['location'],
+ 'storage_mb': d['storage_profile']['storage_mb'],
+ 'version': d['version'],
+ 'enforce_ssl': (d['ssl_enforcement'] == 'Enabled'),
+ 'admin_username': d['administrator_login'],
+ 'user_visible_state': d['user_visible_state'],
+ 'fully_qualified_domain_name': d['fully_qualified_domain_name'],
+ 'tags': d.get('tags')
+ }
+
+ return d
+
+
+def main():
+ AzureRMPostgreSqlServersInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_publicipaddress_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_publicipaddress_facts.py
new file mode 100644
index 00000000..f9aacd9c
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_publicipaddress_facts.py
@@ -0,0 +1,321 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_publicipaddress_info
+
+
+short_description: Get public IP facts
+
+description:
+ - Get facts for a specific public IP or all public IPs within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific Public IP.
+ resource_group:
+ description:
+ - Limit results by resource group. Required when using name parameter.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one Public IP
+ community.azure.azure_rm_publicipaddress_info:
+ resource_group: myResourceGroup
+ name: publicip001
+
+ - name: Get facts for all Public IPs within a resource groups
+ community.azure.azure_rm_publicipaddress_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+azure_publicipaddresses:
+ description:
+ - List of public IP address dicts.
+ - Please note that this option will be deprecated in 2.10 when curated format will become the only supported format.
+ returned: always
+ type: list
+ example: [{
+ "etag": 'W/"a31a6d7d-cb18-40a5-b16d-9f4a36c1b18a"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/pip2001",
+ "location": "eastus2",
+ "name": "pip2001",
+ "properties": {
+ "idleTimeoutInMinutes": 4,
+ "provisioningState": "Succeeded",
+ "publicIPAllocationMethod": "Dynamic",
+ "resourceGuid": "29de82f4-a7da-440e-bd3d-9cabb79af95a"
+ },
+ "type": "Microsoft.Network/publicIPAddresses"
+ }]
+publicipaddresses:
+ description:
+ - List of publicipaddress.
+ - Contains the detail which matches azure_rm_publicipaddress parameters.
+ - Returned when the format parameter set to curated.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxx---xxxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/publicIPAddresses/pipb57dc95224
+ name:
+ description:
+ - Name of the public IP address.
+ returned: always
+ type: str
+ sample: pipb57dc95224
+ type:
+ description:
+ - Resource type.
+ returned: always
+ type: str
+ sample: "Microsoft.Network/publicIPAddresses"
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: eastus
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: {
+ "delete": "on-exit",
+ "testing": "testing"
+ }
+ allocation_method:
+ description:
+ - The public IP allocation method.
+ - Possible values are C(static) and C(dynamic).
+ returned: always
+ type: str
+ sample: static
+ version:
+ description:
+ - The public IP address version.
+ - Possible values are C(ipv4) and C(ipv6).
+ returned: always
+ type: str
+ sample: ipv4
+ dns_settings:
+ description:
+ - The FQDN of the DNS record associated with the public IP address.
+ returned: always
+ type: dict
+ sample: {
+ "domain_name_label": "ansible-b57dc95985712e45eb8b9c2e",
+ "fqdn": "ansible-b57dc95985712e45eb8b9c2e.eastus.cloudapp.azure.com",
+ "reverse_fqdn": null
+ }
+ ip_tags:
+ description:
+ - The list of tags associated with the public IP address.
+ returned: always
+ type: list
+ sample: [
+ {
+ "type": "FirstPartyUsage",
+ "value": "Storage"
+ }
+ ]
+ ip_address:
+ description:
+ - The Public IP Prefix this Public IP Address should be allocated from.
+ returned: always
+ type: str
+ sample: 40.121.144.14
+ idle_timeout:
+ description:
+ - The idle timeout of the public IP address.
+ returned: always
+ type: int
+ sample: 4
+ provisioning_state:
+ description:
+ - The provisioning state of the PublicIP resource.
+ - Possible values is C(Succeeded).
+ returned: always
+ type: str
+ sample: Succeeded
+ etag:
+ description:
+ - A unique read-only string that changes whenever the resource is updated.
+ returned: always
+ type: str
+ sample: "W/'1905ee13-7623-45b1-bc6b-4a12b2fb9d15'"
+ sku:
+ description:
+ - The public IP address SKU.
+ returned: always
+ type: str
+ sample: Basic
+'''
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+AZURE_OBJECT_CLASS = 'PublicIp'
+
+
+class AzureRMPublicIPInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMPublicIPInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_publicipaddress_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_publicipaddress_facts' module has been renamed to 'azure_rm_publicipaddress_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ result = []
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ result = self.get_item()
+ elif self.resource_group:
+ result = self.list_resource_group()
+ else:
+ result = self.list_all()
+
+ raw = self.filter(result)
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_publicipaddresses': self.serialize(raw),
+ }
+ self.results['publicipaddresses'] = self.format(raw)
+
+ return self.results
+
+ def format(self, raw):
+ return [self.pip_to_dict(item) for item in raw]
+
+ def serialize(self, raw):
+ results = []
+ for item in raw:
+ pip = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ pip['name'] = item.name
+ pip['type'] = item.type
+ results.append(pip)
+ return results
+
+ def filter(self, response):
+ return [item for item in response if self.has_tags(item.tags, self.tags)]
+
+ # duplicate with azure_rm_publicipaddress
+ def pip_to_dict(self, pip):
+ result = dict(
+ id=pip.id,
+ name=pip.name,
+ type=pip.type,
+ location=pip.location,
+ tags=pip.tags,
+ allocation_method=pip.public_ip_allocation_method.lower(),
+ version=pip.public_ip_address_version.lower(),
+ dns_settings=dict(),
+ ip_tags=dict(),
+ ip_address=pip.ip_address,
+ idle_timeout=pip.idle_timeout_in_minutes,
+ provisioning_state=pip.provisioning_state,
+ etag=pip.etag,
+ sku=pip.sku.name
+ )
+ if pip.dns_settings:
+ result['dns_settings']['domain_name_label'] = pip.dns_settings.domain_name_label
+ result['dns_settings']['fqdn'] = pip.dns_settings.fqdn
+ result['dns_settings']['reverse_fqdn'] = pip.dns_settings.reverse_fqdn
+ if pip.ip_tags:
+ result['ip_tags'] = [dict(type=x.ip_tag_type, value=x.tag) for x in pip.ip_tags]
+ return result
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ try:
+ item = self.network_client.public_ip_addresses.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+ return [item] if item else []
+
+ def list_resource_group(self):
+ self.log('List items in resource groups')
+ try:
+ response = self.network_client.public_ip_addresses.list(self.resource_group)
+ except AzureHttpError as exc:
+ self.fail("Error listing items in resource groups {0} - {1}".format(self.resource_group, str(exc)))
+ return response
+
+ def list_all(self):
+ self.log('List all items')
+ try:
+ response = self.network_client.public_ip_addresses.list_all()
+ except AzureHttpError as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+ return response
+
+
+def main():
+ AzureRMPublicIPInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_publicipaddress_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_publicipaddress_info.py
new file mode 100644
index 00000000..f9aacd9c
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_publicipaddress_info.py
@@ -0,0 +1,321 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_publicipaddress_info
+
+
+short_description: Get public IP facts
+
+description:
+ - Get facts for a specific public IP or all public IPs within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific Public IP.
+ resource_group:
+ description:
+ - Limit results by resource group. Required when using name parameter.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one Public IP
+ community.azure.azure_rm_publicipaddress_info:
+ resource_group: myResourceGroup
+ name: publicip001
+
+ - name: Get facts for all Public IPs within a resource groups
+ community.azure.azure_rm_publicipaddress_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+azure_publicipaddresses:
+ description:
+ - List of public IP address dicts.
+ - Please note that this option will be deprecated in 2.10 when curated format will become the only supported format.
+ returned: always
+ type: list
+ example: [{
+ "etag": 'W/"a31a6d7d-cb18-40a5-b16d-9f4a36c1b18a"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/publicIPAddresses/pip2001",
+ "location": "eastus2",
+ "name": "pip2001",
+ "properties": {
+ "idleTimeoutInMinutes": 4,
+ "provisioningState": "Succeeded",
+ "publicIPAllocationMethod": "Dynamic",
+ "resourceGuid": "29de82f4-a7da-440e-bd3d-9cabb79af95a"
+ },
+ "type": "Microsoft.Network/publicIPAddresses"
+ }]
+publicipaddresses:
+ description:
+ - List of publicipaddress.
+ - Contains the detail which matches azure_rm_publicipaddress parameters.
+ - Returned when the format parameter set to curated.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxx---xxxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/publicIPAddresses/pipb57dc95224
+ name:
+ description:
+ - Name of the public IP address.
+ returned: always
+ type: str
+ sample: pipb57dc95224
+ type:
+ description:
+ - Resource type.
+ returned: always
+ type: str
+ sample: "Microsoft.Network/publicIPAddresses"
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: eastus
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: {
+ "delete": "on-exit",
+ "testing": "testing"
+ }
+ allocation_method:
+ description:
+ - The public IP allocation method.
+ - Possible values are C(static) and C(dynamic).
+ returned: always
+ type: str
+ sample: static
+ version:
+ description:
+ - The public IP address version.
+ - Possible values are C(ipv4) and C(ipv6).
+ returned: always
+ type: str
+ sample: ipv4
+ dns_settings:
+ description:
+ - The FQDN of the DNS record associated with the public IP address.
+ returned: always
+ type: dict
+ sample: {
+ "domain_name_label": "ansible-b57dc95985712e45eb8b9c2e",
+ "fqdn": "ansible-b57dc95985712e45eb8b9c2e.eastus.cloudapp.azure.com",
+ "reverse_fqdn": null
+ }
+ ip_tags:
+ description:
+ - The list of tags associated with the public IP address.
+ returned: always
+ type: list
+ sample: [
+ {
+ "type": "FirstPartyUsage",
+ "value": "Storage"
+ }
+ ]
+ ip_address:
+ description:
+ - The Public IP Prefix this Public IP Address should be allocated from.
+ returned: always
+ type: str
+ sample: 40.121.144.14
+ idle_timeout:
+ description:
+ - The idle timeout of the public IP address.
+ returned: always
+ type: int
+ sample: 4
+ provisioning_state:
+ description:
+ - The provisioning state of the PublicIP resource.
+ - Possible values is C(Succeeded).
+ returned: always
+ type: str
+ sample: Succeeded
+ etag:
+ description:
+ - A unique read-only string that changes whenever the resource is updated.
+ returned: always
+ type: str
+ sample: "W/'1905ee13-7623-45b1-bc6b-4a12b2fb9d15'"
+ sku:
+ description:
+ - The public IP address SKU.
+ returned: always
+ type: str
+ sample: Basic
+'''
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+AZURE_OBJECT_CLASS = 'PublicIp'
+
+
+class AzureRMPublicIPInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMPublicIPInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_publicipaddress_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_publicipaddress_facts' module has been renamed to 'azure_rm_publicipaddress_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ result = []
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ result = self.get_item()
+ elif self.resource_group:
+ result = self.list_resource_group()
+ else:
+ result = self.list_all()
+
+ raw = self.filter(result)
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_publicipaddresses': self.serialize(raw),
+ }
+ self.results['publicipaddresses'] = self.format(raw)
+
+ return self.results
+
+ def format(self, raw):
+ return [self.pip_to_dict(item) for item in raw]
+
+ def serialize(self, raw):
+ results = []
+ for item in raw:
+ pip = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ pip['name'] = item.name
+ pip['type'] = item.type
+ results.append(pip)
+ return results
+
+ def filter(self, response):
+ return [item for item in response if self.has_tags(item.tags, self.tags)]
+
+ # duplicate with azure_rm_publicipaddress
+ def pip_to_dict(self, pip):
+ result = dict(
+ id=pip.id,
+ name=pip.name,
+ type=pip.type,
+ location=pip.location,
+ tags=pip.tags,
+ allocation_method=pip.public_ip_allocation_method.lower(),
+ version=pip.public_ip_address_version.lower(),
+ dns_settings=dict(),
+ ip_tags=dict(),
+ ip_address=pip.ip_address,
+ idle_timeout=pip.idle_timeout_in_minutes,
+ provisioning_state=pip.provisioning_state,
+ etag=pip.etag,
+ sku=pip.sku.name
+ )
+ if pip.dns_settings:
+ result['dns_settings']['domain_name_label'] = pip.dns_settings.domain_name_label
+ result['dns_settings']['fqdn'] = pip.dns_settings.fqdn
+ result['dns_settings']['reverse_fqdn'] = pip.dns_settings.reverse_fqdn
+ if pip.ip_tags:
+ result['ip_tags'] = [dict(type=x.ip_tag_type, value=x.tag) for x in pip.ip_tags]
+ return result
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ try:
+ item = self.network_client.public_ip_addresses.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+ return [item] if item else []
+
+ def list_resource_group(self):
+ self.log('List items in resource groups')
+ try:
+ response = self.network_client.public_ip_addresses.list(self.resource_group)
+ except AzureHttpError as exc:
+ self.fail("Error listing items in resource groups {0} - {1}".format(self.resource_group, str(exc)))
+ return response
+
+ def list_all(self):
+ self.log('List all items')
+ try:
+ response = self.network_client.public_ip_addresses.list_all()
+ except AzureHttpError as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+ return response
+
+
+def main():
+ AzureRMPublicIPInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_rediscache_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_rediscache_facts.py
new file mode 100644
index 00000000..d95f1eec
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_rediscache_facts.py
@@ -0,0 +1,354 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yunge Zhu <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_rediscache_info
+
+
+short_description: Get Azure Cache for Redis instance facts
+
+description:
+ - Get facts for Azure Cache for Redis instance.
+
+options:
+ resource_group:
+ description:
+ - The resource group to search for the desired Azure Cache for Redis.
+ required: True
+ name:
+ description:
+ - Limit results to a specific Azure Cache for Redis.
+ return_access_keys:
+ description:
+ - Indicate weather to return access keys of the Azure Cache for Redis.
+ default: False
+ type: bool
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get Azure Cache for Redis by name
+ community.azure.azure_rm_rediscache_info:
+ resource_group: myResourceGroup
+ name: myRedis
+
+ - name: Get Azure Cache for Redis with access keys by name
+ community.azure.azure_rm_rediscache_info:
+ resource_group: myResourceGroup
+ name: myRedis
+ return_access_keys: true
+
+ - name: Get Azure Cache for Redis in specific resource group
+ community.azure.azure_rm_rediscache_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+rediscaches:
+ description:
+ - List of Azure Cache for Redis instances.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group where the Azure Cache for Redis belongs to.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Name of the Azure Cache for Redis.
+ returned: always
+ type: str
+ sample: myRedis
+ id:
+ description:
+ - Id of the Azure Cache for Redis.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Cache/Redis/myRedis
+ provisioning_state:
+ description:
+ - Provisioning state of the Redis cache.
+ returned: always
+ type: str
+ sample: Creating
+ location:
+ description:
+ - Location of the Azure Cache for Redis.
+ returned: always
+ type: str
+ sample: WestUS
+ enable_non_ssl_port:
+ description:
+ - Specifies whether the non-ssl Redis server port (6379) is enabled.
+ returned: always
+ type: bool
+ sample: false
+ sku:
+ description:
+ - Dict of SKU information.
+ returned: always
+ type: dict
+ contains:
+ name:
+ description:
+ - Name of the SKU.
+ returned: always
+ type: str
+ sample: standard
+ size:
+ description:
+ - Size of the Azure Cache for Redis.
+ returned: always
+ type: str
+ sample: C1
+ static_ip:
+ description:
+ - Static IP address.
+ returned: always
+ type: str
+ sample: 10.75.0.11
+ subnet:
+ description:
+ - The full resource ID of a subnet in a virtual network to deploy the Azure Cache for Redis in.
+ returned: always
+ type: str
+ sample:
+ - "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/Microsoft.Network/VirtualNetworks/myVirtualNetwo
+ rk/subnets/mySubnet"
+ configuration:
+ description:
+ - Dict of Redis configuration.
+ returned: always
+ type: dict
+ sample: maxmeory_reserved
+ host_name:
+ description:
+ - Redis host name.
+ returned: always
+ type: str
+ sample: testRedis.redis.cache.windows.net
+ shard_count:
+ description:
+ - The number of shards on a Premium Cluster Cache.
+ returned: always
+ type: int
+ sample: 1
+ tenant_settings:
+ description:
+ - Dict of tenant settings.
+ returned: always
+ type: dict
+ sample: { "key1": "value1" }
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { "key1": "value1" }
+ access_keys:
+ description:
+ - Azure Cache for Redis access keys.
+ type: dict
+ returned: when I(return_access_keys=true)
+ contains:
+ primary:
+ description:
+ - The current primary key that clients can use to authenticate the Redis cahce.
+ returned: always
+ type: str
+ sample: X2xXXxx7xxxxxx5xxxx0xxxxx75xxxxxxxxXXXxxxxx=
+ secondary:
+ description:
+ - The current secondary key that clients can use to authenticate the Redis cahce.
+ returned: always
+ type: str
+ sample: X2xXXxx7xxxxxx5xxxx0xxxxx75xxxxxxxxXXXxxxxx=
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from azure.common import AzureHttpError
+ from azure.mgmt.redis import RedisManagementClient
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+
+class AzureRMRedisCacheInfo(AzureRMModuleBase):
+ """Utility class to get Azure Cache for Redis facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ return_access_keys=dict(
+ type='bool',
+ default=False
+ ),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ rediscaches=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.profile_name = None
+ self.tags = None
+
+ self._client = None
+
+ super(AzureRMRedisCacheInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_rediscache_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_rediscache_facts' module has been renamed to 'azure_rm_rediscache_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ # get management client
+ self._client = self.get_mgmt_svc_client(RedisManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version='2018-03-01')
+
+ if self.name:
+ self.results['rediscaches'] = self.get_item()
+ else:
+ self.results['rediscaches'] = self.list_by_resourcegroup()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Cache for Redis"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self._client.redis.get(resource_group_name=self.resource_group, name=self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_rediscache(item)]
+
+ return result
+
+ def list_by_resourcegroup(self):
+ """Get all Azure Cache for Redis within a resource group"""
+
+ self.log('List all Azure Cache for Redis within a resource group')
+
+ try:
+ response = self._client.redis.list_by_resource_group(self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_rediscache(item))
+
+ return results
+
+ def list_keys(self):
+ """List Azure Cache for Redis keys"""
+
+ self.log('List keys for {0}'.format(self.name))
+
+ item = None
+
+ try:
+ item = self._client.redis.list_keys(resource_group_name=self.resource_group, name=self.name)
+ except CloudError as exc:
+ self.fail("Failed to list redis keys of {0} - {1}".format(self.name, str(exc)))
+
+ return item
+
+ def serialize_rediscache(self, rediscache):
+ '''
+ Convert an Azure Cache for Redis object to dict.
+ :param rediscache: Azure Cache for Redis object
+ :return: dict
+ '''
+ new_result = dict(
+ id=rediscache.id,
+ resource_group=re.sub('\\/.*', '', re.sub('.*resourceGroups\\/', '', rediscache.id)),
+ name=rediscache.name,
+ location=rediscache.location,
+ provisioning_state=rediscache.provisioning_state,
+ configuration=rediscache.redis_configuration,
+ tenant_settings=rediscache.tenant_settings,
+ shard_count=rediscache.shard_count,
+ enable_non_ssl_port=rediscache.enable_non_ssl_port,
+ static_ip=rediscache.static_ip,
+ subnet=rediscache.subnet_id,
+ host_name=rediscache.host_name,
+ tags=rediscache.tags
+ )
+
+ if rediscache.sku:
+ new_result['sku'] = dict(
+ name=rediscache.sku.name.lower(),
+ size=rediscache.sku.family + str(rediscache.sku.capacity)
+ )
+ if self.return_access_keys:
+ access_keys = self.list_keys()
+ if access_keys:
+ new_result['access_keys'] = dict(
+ primary=access_keys.primary_key,
+ secondary=access_keys.secondary_key
+ )
+ return new_result
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMRedisCacheInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_rediscache_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_rediscache_info.py
new file mode 100644
index 00000000..d95f1eec
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_rediscache_info.py
@@ -0,0 +1,354 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yunge Zhu <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_rediscache_info
+
+
+short_description: Get Azure Cache for Redis instance facts
+
+description:
+ - Get facts for Azure Cache for Redis instance.
+
+options:
+ resource_group:
+ description:
+ - The resource group to search for the desired Azure Cache for Redis.
+ required: True
+ name:
+ description:
+ - Limit results to a specific Azure Cache for Redis.
+ return_access_keys:
+ description:
+ - Indicate weather to return access keys of the Azure Cache for Redis.
+ default: False
+ type: bool
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get Azure Cache for Redis by name
+ community.azure.azure_rm_rediscache_info:
+ resource_group: myResourceGroup
+ name: myRedis
+
+ - name: Get Azure Cache for Redis with access keys by name
+ community.azure.azure_rm_rediscache_info:
+ resource_group: myResourceGroup
+ name: myRedis
+ return_access_keys: true
+
+ - name: Get Azure Cache for Redis in specific resource group
+ community.azure.azure_rm_rediscache_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+rediscaches:
+ description:
+ - List of Azure Cache for Redis instances.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group where the Azure Cache for Redis belongs to.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Name of the Azure Cache for Redis.
+ returned: always
+ type: str
+ sample: myRedis
+ id:
+ description:
+ - Id of the Azure Cache for Redis.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Cache/Redis/myRedis
+ provisioning_state:
+ description:
+ - Provisioning state of the Redis cache.
+ returned: always
+ type: str
+ sample: Creating
+ location:
+ description:
+ - Location of the Azure Cache for Redis.
+ returned: always
+ type: str
+ sample: WestUS
+ enable_non_ssl_port:
+ description:
+ - Specifies whether the non-ssl Redis server port (6379) is enabled.
+ returned: always
+ type: bool
+ sample: false
+ sku:
+ description:
+ - Dict of SKU information.
+ returned: always
+ type: dict
+ contains:
+ name:
+ description:
+ - Name of the SKU.
+ returned: always
+ type: str
+ sample: standard
+ size:
+ description:
+ - Size of the Azure Cache for Redis.
+ returned: always
+ type: str
+ sample: C1
+ static_ip:
+ description:
+ - Static IP address.
+ returned: always
+ type: str
+ sample: 10.75.0.11
+ subnet:
+ description:
+ - The full resource ID of a subnet in a virtual network to deploy the Azure Cache for Redis in.
+ returned: always
+ type: str
+ sample:
+ - "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/Microsoft.Network/VirtualNetworks/myVirtualNetwo
+ rk/subnets/mySubnet"
+ configuration:
+ description:
+ - Dict of Redis configuration.
+ returned: always
+ type: dict
+ sample: maxmeory_reserved
+ host_name:
+ description:
+ - Redis host name.
+ returned: always
+ type: str
+ sample: testRedis.redis.cache.windows.net
+ shard_count:
+ description:
+ - The number of shards on a Premium Cluster Cache.
+ returned: always
+ type: int
+ sample: 1
+ tenant_settings:
+ description:
+ - Dict of tenant settings.
+ returned: always
+ type: dict
+ sample: { "key1": "value1" }
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { "key1": "value1" }
+ access_keys:
+ description:
+ - Azure Cache for Redis access keys.
+ type: dict
+ returned: when I(return_access_keys=true)
+ contains:
+ primary:
+ description:
+ - The current primary key that clients can use to authenticate the Redis cahce.
+ returned: always
+ type: str
+ sample: X2xXXxx7xxxxxx5xxxx0xxxxx75xxxxxxxxXXXxxxxx=
+ secondary:
+ description:
+ - The current secondary key that clients can use to authenticate the Redis cahce.
+ returned: always
+ type: str
+ sample: X2xXXxx7xxxxxx5xxxx0xxxxx75xxxxxxxxXXXxxxxx=
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from azure.common import AzureHttpError
+ from azure.mgmt.redis import RedisManagementClient
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+
+class AzureRMRedisCacheInfo(AzureRMModuleBase):
+ """Utility class to get Azure Cache for Redis facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ return_access_keys=dict(
+ type='bool',
+ default=False
+ ),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ rediscaches=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.profile_name = None
+ self.tags = None
+
+ self._client = None
+
+ super(AzureRMRedisCacheInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_rediscache_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_rediscache_facts' module has been renamed to 'azure_rm_rediscache_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ # get management client
+ self._client = self.get_mgmt_svc_client(RedisManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version='2018-03-01')
+
+ if self.name:
+ self.results['rediscaches'] = self.get_item()
+ else:
+ self.results['rediscaches'] = self.list_by_resourcegroup()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Cache for Redis"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self._client.redis.get(resource_group_name=self.resource_group, name=self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_rediscache(item)]
+
+ return result
+
+ def list_by_resourcegroup(self):
+ """Get all Azure Cache for Redis within a resource group"""
+
+ self.log('List all Azure Cache for Redis within a resource group')
+
+ try:
+ response = self._client.redis.list_by_resource_group(self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_rediscache(item))
+
+ return results
+
+ def list_keys(self):
+ """List Azure Cache for Redis keys"""
+
+ self.log('List keys for {0}'.format(self.name))
+
+ item = None
+
+ try:
+ item = self._client.redis.list_keys(resource_group_name=self.resource_group, name=self.name)
+ except CloudError as exc:
+ self.fail("Failed to list redis keys of {0} - {1}".format(self.name, str(exc)))
+
+ return item
+
+ def serialize_rediscache(self, rediscache):
+ '''
+ Convert an Azure Cache for Redis object to dict.
+ :param rediscache: Azure Cache for Redis object
+ :return: dict
+ '''
+ new_result = dict(
+ id=rediscache.id,
+ resource_group=re.sub('\\/.*', '', re.sub('.*resourceGroups\\/', '', rediscache.id)),
+ name=rediscache.name,
+ location=rediscache.location,
+ provisioning_state=rediscache.provisioning_state,
+ configuration=rediscache.redis_configuration,
+ tenant_settings=rediscache.tenant_settings,
+ shard_count=rediscache.shard_count,
+ enable_non_ssl_port=rediscache.enable_non_ssl_port,
+ static_ip=rediscache.static_ip,
+ subnet=rediscache.subnet_id,
+ host_name=rediscache.host_name,
+ tags=rediscache.tags
+ )
+
+ if rediscache.sku:
+ new_result['sku'] = dict(
+ name=rediscache.sku.name.lower(),
+ size=rediscache.sku.family + str(rediscache.sku.capacity)
+ )
+ if self.return_access_keys:
+ access_keys = self.list_keys()
+ if access_keys:
+ new_result['access_keys'] = dict(
+ primary=access_keys.primary_key,
+ secondary=access_keys.secondary_key
+ )
+ return new_result
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMRedisCacheInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resource_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resource_facts.py
new file mode 100644
index 00000000..a3fe7088
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resource_facts.py
@@ -0,0 +1,431 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_resource_info
+short_description: Generic facts of Azure resources
+description:
+ - Obtain facts of any resource using Azure REST API.
+ - This module gives access to resources that are not supported via Ansible modules.
+ - Refer to U(https://docs.microsoft.com/en-us/rest/api/) regarding details related to specific resource REST API.
+
+options:
+ url:
+ description:
+ - Azure RM Resource URL.
+ api_version:
+ description:
+ - Specific API version to be used.
+ provider:
+ description:
+ - Provider type, should be specified in no URL is given.
+ resource_group:
+ description:
+ - Resource group to be used.
+ - Required if URL is not specified.
+ resource_type:
+ description:
+ - Resource type.
+ resource_name:
+ description:
+ - Resource name.
+ subresource:
+ description:
+ - List of subresources.
+ suboptions:
+ namespace:
+ description:
+ - Subresource namespace.
+ type:
+ description:
+ - Subresource type.
+ name:
+ description:
+ - Subresource name.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get scaleset info
+ community.azure.azure_rm_resource_info:
+ resource_group: myResourceGroup
+ provider: compute
+ resource_type: virtualmachinescalesets
+ resource_name: myVmss
+ api_version: "2017-12-01"
+
+ - name: Query all the resources in the resource group
+ community.azure.azure_rm_resource_info:
+ resource_group: "{{ resource_group }}"
+ resource_type: resources
+'''
+
+RETURN = '''
+response:
+ description:
+ - Response specific to resource type.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Id of the Azure resource.
+ type: str
+ returned: always
+ sample: "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/virtualMachines/myVM"
+ location:
+ description:
+ - Resource location.
+ type: str
+ returned: always
+ sample: eastus
+ name:
+ description:
+ - Resource name.
+ type: str
+ returned: always
+ sample: myVM
+ properties:
+ description:
+ - Specifies the virtual machine's property.
+ type: complex
+ returned: always
+ contains:
+ diagnosticsProfile:
+ description:
+ - Specifies the boot diagnostic settings state.
+ type: complex
+ returned: always
+ contains:
+ bootDiagnostics:
+ description:
+ - A debugging feature, which to view Console Output and Screenshot to diagnose VM status.
+ type: dict
+ returned: always
+ sample: {
+ "enabled": true,
+ "storageUri": "https://vxisurgdiag.blob.core.windows.net/"
+ }
+ hardwareProfile:
+ description:
+ - Specifies the hardware settings for the virtual machine.
+ type: dict
+ returned: always
+ sample: {
+ "vmSize": "Standard_D2s_v3"
+ }
+ networkProfile:
+ description:
+ - Specifies the network interfaces of the virtual machine.
+ type: complex
+ returned: always
+ contains:
+ networkInterfaces:
+ description:
+ - Describes a network interface reference.
+ type: list
+ returned: always
+ sample:
+ - {
+ "id": "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/networkInterfaces/myvm441"
+ }
+ osProfile:
+ description:
+ - Specifies the operating system settings for the virtual machine.
+ type: complex
+ returned: always
+ contains:
+ adminUsername:
+ description:
+ - Specifies the name of the administrator account.
+ type: str
+ returned: always
+ sample: azureuser
+ allowExtensionOperations:
+ description:
+ - Specifies whether extension operations should be allowed on the virtual machine.
+ - This may only be set to False when no extensions are present on the virtual machine.
+ type: bool
+ returned: always
+ sample: true
+ computerName:
+ description:
+ - Specifies the host OS name of the virtual machine.
+ type: str
+ returned: always
+ sample: myVM
+ requireGuestProvisionSignale:
+ description:
+ - Specifies the host require guest provision signal or not.
+ type: bool
+ returned: always
+ sample: true
+ secrets:
+ description:
+ - Specifies set of certificates that should be installed onto the virtual machine.
+ type: list
+ returned: always
+ sample: []
+ linuxConfiguration:
+ description:
+ - Specifies the Linux operating system settings on the virtual machine.
+ type: dict
+ returned: when OS type is Linux
+ sample: {
+ "disablePasswordAuthentication": false,
+ "provisionVMAgent": true
+ }
+ provisioningState:
+ description:
+ - The provisioning state.
+ type: str
+ returned: always
+ sample: Succeeded
+ vmID:
+ description:
+ - Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure laaS VMs SMBIOS.
+ - It can be read using platform BIOS commands.
+ type: str
+ returned: always
+ sample: "eb86d9bb-6725-4787-a487-2e497d5b340c"
+ storageProfile:
+ description:
+ - Specifies the storage account type for the managed disk.
+ type: complex
+ returned: always
+ contains:
+ dataDisks:
+ description:
+ - Specifies the parameters that are used to add a data disk to virtual machine.
+ type: list
+ returned: always
+ sample:
+ - {
+ "caching": "None",
+ "createOption": "Attach",
+ "diskSizeGB": 1023,
+ "lun": 2,
+ "managedDisk": {
+ "id": "/subscriptions/xxxx....xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk2",
+ "storageAccountType": "StandardSSD_LRS"
+ },
+ "name": "testdisk2"
+ }
+ - {
+ "caching": "None",
+ "createOption": "Attach",
+ "diskSizeGB": 1023,
+ "lun": 1,
+ "managedDisk": {
+ "id": "/subscriptions/xxxx...xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk3",
+ "storageAccountType": "StandardSSD_LRS"
+ },
+ "name": "testdisk3"
+ }
+
+ imageReference:
+ description:
+ - Specifies information about the image to use.
+ type: dict
+ returned: always
+ sample: {
+ "offer": "UbuntuServer",
+ "publisher": "Canonical",
+ "sku": "18.04-LTS",
+ "version": "latest"
+ }
+ osDisk:
+ description:
+ - Specifies information about the operating system disk used by the virtual machine.
+ type: dict
+ returned: always
+ sample: {
+ "caching": "ReadWrite",
+ "createOption": "FromImage",
+ "diskSizeGB": 30,
+ "managedDisk": {
+ "id": "/subscriptions/xxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/disks/myVM_disk1_xxx",
+ "storageAccountType": "Premium_LRS"
+ },
+ "name": "myVM_disk1_xxx",
+ "osType": "Linux"
+ }
+ type:
+ description:
+ - The type of identity used for the virtual machine.
+ type: str
+ returned: always
+ sample: "Microsoft.Compute/virtualMachines"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common_rest import GenericRestClient
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.service_client import ServiceClient
+ from msrestazure.tools import resource_id, is_valid_resource_id
+ import json
+
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMResourceInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ url=dict(
+ type='str'
+ ),
+ provider=dict(
+ type='str'
+ ),
+ resource_group=dict(
+ type='str'
+ ),
+ resource_type=dict(
+ type='str'
+ ),
+ resource_name=dict(
+ type='str'
+ ),
+ subresource=dict(
+ type='list',
+ default=[]
+ ),
+ api_version=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ response=[]
+ )
+ self.mgmt_client = None
+ self.url = None
+ self.api_version = None
+ self.provider = None
+ self.resource_group = None
+ self.resource_type = None
+ self.resource_name = None
+ self.subresource = []
+ super(AzureRMResourceInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_resource_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_resource_facts' module has been renamed to 'azure_rm_resource_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(GenericRestClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.url is None:
+ orphan = None
+ rargs = dict()
+ rargs['subscription'] = self.subscription_id
+ rargs['resource_group'] = self.resource_group
+ if not (self.provider is None or self.provider.lower().startswith('.microsoft')):
+ rargs['namespace'] = "Microsoft." + self.provider
+ else:
+ rargs['namespace'] = self.provider
+
+ if self.resource_type is not None and self.resource_name is not None:
+ rargs['type'] = self.resource_type
+ rargs['name'] = self.resource_name
+ for i in range(len(self.subresource)):
+ resource_ns = self.subresource[i].get('namespace', None)
+ resource_type = self.subresource[i].get('type', None)
+ resource_name = self.subresource[i].get('name', None)
+ if resource_type is not None and resource_name is not None:
+ rargs['child_namespace_' + str(i + 1)] = resource_ns
+ rargs['child_type_' + str(i + 1)] = resource_type
+ rargs['child_name_' + str(i + 1)] = resource_name
+ else:
+ orphan = resource_type
+ else:
+ orphan = self.resource_type
+
+ self.url = resource_id(**rargs)
+
+ if orphan is not None:
+ self.url += '/' + orphan
+
+ # if api_version was not specified, get latest one
+ if not self.api_version:
+ try:
+ # extract provider and resource type
+ if "/providers/" in self.url:
+ provider = self.url.split("/providers/")[1].split("/")[0]
+ resourceType = self.url.split(provider + "/")[1].split("/")[0]
+ url = "/subscriptions/" + self.subscription_id + "/providers/" + provider
+ api_versions = json.loads(self.mgmt_client.query(url, "GET", {'api-version': '2015-01-01'}, None, None, [200], 0, 0).text)
+ for rt in api_versions['resourceTypes']:
+ if rt['resourceType'].lower() == resourceType.lower():
+ self.api_version = rt['apiVersions'][0]
+ break
+ else:
+ # if there's no provider in API version, assume Microsoft.Resources
+ self.api_version = '2018-05-01'
+ if not self.api_version:
+ self.fail("Couldn't find api version for {0}/{1}".format(provider, resourceType))
+ except Exception as exc:
+ self.fail("Failed to obtain API version: {0}".format(str(exc)))
+
+ self.results['url'] = self.url
+
+ query_parameters = {}
+ query_parameters['api-version'] = self.api_version
+
+ header_parameters = {}
+ header_parameters['Content-Type'] = 'application/json; charset=utf-8'
+ skiptoken = None
+
+ while True:
+ if skiptoken:
+ query_parameters['skiptoken'] = skiptoken
+ response = self.mgmt_client.query(self.url, "GET", query_parameters, header_parameters, None, [200, 404], 0, 0)
+ try:
+ response = json.loads(response.text)
+ if isinstance(response, dict):
+ if response.get('value'):
+ self.results['response'] = self.results['response'] + response['value']
+ skiptoken = response.get('nextLink')
+ else:
+ self.results['response'] = self.results['response'] + [response]
+ except Exception as e:
+ self.fail('Failed to parse response: ' + str(e))
+ if not skiptoken:
+ break
+ return self.results
+
+
+def main():
+ AzureRMResourceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resource_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resource_info.py
new file mode 100644
index 00000000..a3fe7088
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resource_info.py
@@ -0,0 +1,431 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_resource_info
+short_description: Generic facts of Azure resources
+description:
+ - Obtain facts of any resource using Azure REST API.
+ - This module gives access to resources that are not supported via Ansible modules.
+ - Refer to U(https://docs.microsoft.com/en-us/rest/api/) regarding details related to specific resource REST API.
+
+options:
+ url:
+ description:
+ - Azure RM Resource URL.
+ api_version:
+ description:
+ - Specific API version to be used.
+ provider:
+ description:
+ - Provider type, should be specified in no URL is given.
+ resource_group:
+ description:
+ - Resource group to be used.
+ - Required if URL is not specified.
+ resource_type:
+ description:
+ - Resource type.
+ resource_name:
+ description:
+ - Resource name.
+ subresource:
+ description:
+ - List of subresources.
+ suboptions:
+ namespace:
+ description:
+ - Subresource namespace.
+ type:
+ description:
+ - Subresource type.
+ name:
+ description:
+ - Subresource name.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get scaleset info
+ community.azure.azure_rm_resource_info:
+ resource_group: myResourceGroup
+ provider: compute
+ resource_type: virtualmachinescalesets
+ resource_name: myVmss
+ api_version: "2017-12-01"
+
+ - name: Query all the resources in the resource group
+ community.azure.azure_rm_resource_info:
+ resource_group: "{{ resource_group }}"
+ resource_type: resources
+'''
+
+RETURN = '''
+response:
+ description:
+ - Response specific to resource type.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Id of the Azure resource.
+ type: str
+ returned: always
+ sample: "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/virtualMachines/myVM"
+ location:
+ description:
+ - Resource location.
+ type: str
+ returned: always
+ sample: eastus
+ name:
+ description:
+ - Resource name.
+ type: str
+ returned: always
+ sample: myVM
+ properties:
+ description:
+ - Specifies the virtual machine's property.
+ type: complex
+ returned: always
+ contains:
+ diagnosticsProfile:
+ description:
+ - Specifies the boot diagnostic settings state.
+ type: complex
+ returned: always
+ contains:
+ bootDiagnostics:
+ description:
+ - A debugging feature, which to view Console Output and Screenshot to diagnose VM status.
+ type: dict
+ returned: always
+ sample: {
+ "enabled": true,
+ "storageUri": "https://vxisurgdiag.blob.core.windows.net/"
+ }
+ hardwareProfile:
+ description:
+ - Specifies the hardware settings for the virtual machine.
+ type: dict
+ returned: always
+ sample: {
+ "vmSize": "Standard_D2s_v3"
+ }
+ networkProfile:
+ description:
+ - Specifies the network interfaces of the virtual machine.
+ type: complex
+ returned: always
+ contains:
+ networkInterfaces:
+ description:
+ - Describes a network interface reference.
+ type: list
+ returned: always
+ sample:
+ - {
+ "id": "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/networkInterfaces/myvm441"
+ }
+ osProfile:
+ description:
+ - Specifies the operating system settings for the virtual machine.
+ type: complex
+ returned: always
+ contains:
+ adminUsername:
+ description:
+ - Specifies the name of the administrator account.
+ type: str
+ returned: always
+ sample: azureuser
+ allowExtensionOperations:
+ description:
+ - Specifies whether extension operations should be allowed on the virtual machine.
+ - This may only be set to False when no extensions are present on the virtual machine.
+ type: bool
+ returned: always
+ sample: true
+ computerName:
+ description:
+ - Specifies the host OS name of the virtual machine.
+ type: str
+ returned: always
+ sample: myVM
+ requireGuestProvisionSignale:
+ description:
+ - Specifies the host require guest provision signal or not.
+ type: bool
+ returned: always
+ sample: true
+ secrets:
+ description:
+ - Specifies set of certificates that should be installed onto the virtual machine.
+ type: list
+ returned: always
+ sample: []
+ linuxConfiguration:
+ description:
+ - Specifies the Linux operating system settings on the virtual machine.
+ type: dict
+ returned: when OS type is Linux
+ sample: {
+ "disablePasswordAuthentication": false,
+ "provisionVMAgent": true
+ }
+ provisioningState:
+ description:
+ - The provisioning state.
+ type: str
+ returned: always
+ sample: Succeeded
+ vmID:
+ description:
+ - Specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure laaS VMs SMBIOS.
+ - It can be read using platform BIOS commands.
+ type: str
+ returned: always
+ sample: "eb86d9bb-6725-4787-a487-2e497d5b340c"
+ storageProfile:
+ description:
+ - Specifies the storage account type for the managed disk.
+ type: complex
+ returned: always
+ contains:
+ dataDisks:
+ description:
+ - Specifies the parameters that are used to add a data disk to virtual machine.
+ type: list
+ returned: always
+ sample:
+ - {
+ "caching": "None",
+ "createOption": "Attach",
+ "diskSizeGB": 1023,
+ "lun": 2,
+ "managedDisk": {
+ "id": "/subscriptions/xxxx....xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk2",
+ "storageAccountType": "StandardSSD_LRS"
+ },
+ "name": "testdisk2"
+ }
+ - {
+ "caching": "None",
+ "createOption": "Attach",
+ "diskSizeGB": 1023,
+ "lun": 1,
+ "managedDisk": {
+ "id": "/subscriptions/xxxx...xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk3",
+ "storageAccountType": "StandardSSD_LRS"
+ },
+ "name": "testdisk3"
+ }
+
+ imageReference:
+ description:
+ - Specifies information about the image to use.
+ type: dict
+ returned: always
+ sample: {
+ "offer": "UbuntuServer",
+ "publisher": "Canonical",
+ "sku": "18.04-LTS",
+ "version": "latest"
+ }
+ osDisk:
+ description:
+ - Specifies information about the operating system disk used by the virtual machine.
+ type: dict
+ returned: always
+ sample: {
+ "caching": "ReadWrite",
+ "createOption": "FromImage",
+ "diskSizeGB": 30,
+ "managedDisk": {
+ "id": "/subscriptions/xxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/disks/myVM_disk1_xxx",
+ "storageAccountType": "Premium_LRS"
+ },
+ "name": "myVM_disk1_xxx",
+ "osType": "Linux"
+ }
+ type:
+ description:
+ - The type of identity used for the virtual machine.
+ type: str
+ returned: always
+ sample: "Microsoft.Compute/virtualMachines"
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common_rest import GenericRestClient
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.service_client import ServiceClient
+ from msrestazure.tools import resource_id, is_valid_resource_id
+ import json
+
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMResourceInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ url=dict(
+ type='str'
+ ),
+ provider=dict(
+ type='str'
+ ),
+ resource_group=dict(
+ type='str'
+ ),
+ resource_type=dict(
+ type='str'
+ ),
+ resource_name=dict(
+ type='str'
+ ),
+ subresource=dict(
+ type='list',
+ default=[]
+ ),
+ api_version=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ response=[]
+ )
+ self.mgmt_client = None
+ self.url = None
+ self.api_version = None
+ self.provider = None
+ self.resource_group = None
+ self.resource_type = None
+ self.resource_name = None
+ self.subresource = []
+ super(AzureRMResourceInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_resource_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_resource_facts' module has been renamed to 'azure_rm_resource_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(GenericRestClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if self.url is None:
+ orphan = None
+ rargs = dict()
+ rargs['subscription'] = self.subscription_id
+ rargs['resource_group'] = self.resource_group
+ if not (self.provider is None or self.provider.lower().startswith('.microsoft')):
+ rargs['namespace'] = "Microsoft." + self.provider
+ else:
+ rargs['namespace'] = self.provider
+
+ if self.resource_type is not None and self.resource_name is not None:
+ rargs['type'] = self.resource_type
+ rargs['name'] = self.resource_name
+ for i in range(len(self.subresource)):
+ resource_ns = self.subresource[i].get('namespace', None)
+ resource_type = self.subresource[i].get('type', None)
+ resource_name = self.subresource[i].get('name', None)
+ if resource_type is not None and resource_name is not None:
+ rargs['child_namespace_' + str(i + 1)] = resource_ns
+ rargs['child_type_' + str(i + 1)] = resource_type
+ rargs['child_name_' + str(i + 1)] = resource_name
+ else:
+ orphan = resource_type
+ else:
+ orphan = self.resource_type
+
+ self.url = resource_id(**rargs)
+
+ if orphan is not None:
+ self.url += '/' + orphan
+
+ # if api_version was not specified, get latest one
+ if not self.api_version:
+ try:
+ # extract provider and resource type
+ if "/providers/" in self.url:
+ provider = self.url.split("/providers/")[1].split("/")[0]
+ resourceType = self.url.split(provider + "/")[1].split("/")[0]
+ url = "/subscriptions/" + self.subscription_id + "/providers/" + provider
+ api_versions = json.loads(self.mgmt_client.query(url, "GET", {'api-version': '2015-01-01'}, None, None, [200], 0, 0).text)
+ for rt in api_versions['resourceTypes']:
+ if rt['resourceType'].lower() == resourceType.lower():
+ self.api_version = rt['apiVersions'][0]
+ break
+ else:
+ # if there's no provider in API version, assume Microsoft.Resources
+ self.api_version = '2018-05-01'
+ if not self.api_version:
+ self.fail("Couldn't find api version for {0}/{1}".format(provider, resourceType))
+ except Exception as exc:
+ self.fail("Failed to obtain API version: {0}".format(str(exc)))
+
+ self.results['url'] = self.url
+
+ query_parameters = {}
+ query_parameters['api-version'] = self.api_version
+
+ header_parameters = {}
+ header_parameters['Content-Type'] = 'application/json; charset=utf-8'
+ skiptoken = None
+
+ while True:
+ if skiptoken:
+ query_parameters['skiptoken'] = skiptoken
+ response = self.mgmt_client.query(self.url, "GET", query_parameters, header_parameters, None, [200, 404], 0, 0)
+ try:
+ response = json.loads(response.text)
+ if isinstance(response, dict):
+ if response.get('value'):
+ self.results['response'] = self.results['response'] + response['value']
+ skiptoken = response.get('nextLink')
+ else:
+ self.results['response'] = self.results['response'] + [response]
+ except Exception as e:
+ self.fail('Failed to parse response: ' + str(e))
+ if not skiptoken:
+ break
+ return self.results
+
+
+def main():
+ AzureRMResourceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resourcegroup_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resourcegroup_facts.py
new file mode 100644
index 00000000..25e5b3ed
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resourcegroup_facts.py
@@ -0,0 +1,239 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_resourcegroup_info
+
+
+short_description: Get resource group facts
+
+description:
+ - Get facts for a specific resource group or all resource groups.
+
+options:
+ name:
+ description:
+ - Limit results to a specific resource group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ list_resources:
+ description:
+ - List all resources under the resource group.
+ - Note this will cost network overhead for each resource group. Suggest use this when I(name) set.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one resource group
+ community.azure.azure_rm_resourcegroup_info:
+ name: myResourceGroup
+
+ - name: Get facts for all resource groups
+ community.azure.azure_rm_resourcegroup_info:
+
+ - name: Get facts by tags
+ community.azure.azure_rm_resourcegroup_info:
+ tags:
+ - testing
+ - foo:bar
+
+ - name: Get facts for one resource group including resources it contains
+ community.azure.azure_rm_resourcegroup_info:
+ name: myResourceGroup
+ list_resources: yes
+'''
+RETURN = '''
+azure_resourcegroups:
+ description:
+ - List of resource group dicts.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - Resource id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup"
+ name:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: foo
+ tags:
+ description:
+ - Tags assigned to resource group.
+ returned: always
+ type: dict
+ sample: { "tag": "value" }
+ resources:
+ description:
+ - List of resources under the resource group.
+ returned: when I(list_resources=yes).
+ type: list
+ contains:
+ id:
+ description:
+ - Resource id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMa
+ chines/myVirtualMachine"
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myVirtualMachine
+ location:
+ description:
+ - Resource region.
+ returned: always
+ type: str
+ sample: eastus
+ type:
+ description:
+ - Resource type.
+ returned: always
+ type: str
+ sample: "Microsoft.Compute/virtualMachines"
+ tags:
+ description:
+ - Tags to assign to the managed disk.
+ returned: always
+ type: dict
+ sample: { "tag": "value" }
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_OBJECT_CLASS = 'ResourceGroup'
+
+
+class AzureRMResourceGroupInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ tags=dict(type='list'),
+ list_resources=dict(type='bool')
+ )
+
+ self.results = dict(
+ changed=False,
+ resourcegroups=[]
+ )
+
+ self.name = None
+ self.tags = None
+ self.list_resources = None
+
+ super(AzureRMResourceGroupInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_resourcegroup_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_resourcegroup_facts' module has been renamed to 'azure_rm_resourcegroup_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ result = self.get_item()
+ else:
+ result = self.list_items()
+
+ if self.list_resources:
+ for item in result:
+ item['resources'] = self.list_by_rg(item['name'])
+
+ if is_old_facts:
+ self.results['ansible_facts'] = dict(
+ azure_resourcegroups=result
+ )
+ self.results['resourcegroups'] = result
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ result = []
+
+ try:
+ item = self.rm_client.resource_groups.get(self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_obj(item, AZURE_OBJECT_CLASS)]
+
+ return result
+
+ def list_items(self):
+ self.log('List all items')
+ try:
+ response = self.rm_client.resource_groups.list()
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_obj(item, AZURE_OBJECT_CLASS))
+ return results
+
+ def list_by_rg(self, name):
+ self.log('List resources under resource group')
+ results = []
+ try:
+ response = self.rm_client.resources.list_by_resource_group(name)
+ while True:
+ results.append(response.next().as_dict())
+ except StopIteration:
+ pass
+ except CloudError as exc:
+ self.fail('Error when listing resources under resource group {0}: {1}'.format(name, exc.message or str(exc)))
+ return results
+
+
+def main():
+ AzureRMResourceGroupInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resourcegroup_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resourcegroup_info.py
new file mode 100644
index 00000000..25e5b3ed
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_resourcegroup_info.py
@@ -0,0 +1,239 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_resourcegroup_info
+
+
+short_description: Get resource group facts
+
+description:
+ - Get facts for a specific resource group or all resource groups.
+
+options:
+ name:
+ description:
+ - Limit results to a specific resource group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ list_resources:
+ description:
+ - List all resources under the resource group.
+ - Note this will cost network overhead for each resource group. Suggest use this when I(name) set.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one resource group
+ community.azure.azure_rm_resourcegroup_info:
+ name: myResourceGroup
+
+ - name: Get facts for all resource groups
+ community.azure.azure_rm_resourcegroup_info:
+
+ - name: Get facts by tags
+ community.azure.azure_rm_resourcegroup_info:
+ tags:
+ - testing
+ - foo:bar
+
+ - name: Get facts for one resource group including resources it contains
+ community.azure.azure_rm_resourcegroup_info:
+ name: myResourceGroup
+ list_resources: yes
+'''
+RETURN = '''
+azure_resourcegroups:
+ description:
+ - List of resource group dicts.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - Resource id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup"
+ name:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: foo
+ tags:
+ description:
+ - Tags assigned to resource group.
+ returned: always
+ type: dict
+ sample: { "tag": "value" }
+ resources:
+ description:
+ - List of resources under the resource group.
+ returned: when I(list_resources=yes).
+ type: list
+ contains:
+ id:
+ description:
+ - Resource id.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMa
+ chines/myVirtualMachine"
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myVirtualMachine
+ location:
+ description:
+ - Resource region.
+ returned: always
+ type: str
+ sample: eastus
+ type:
+ description:
+ - Resource type.
+ returned: always
+ type: str
+ sample: "Microsoft.Compute/virtualMachines"
+ tags:
+ description:
+ - Tags to assign to the managed disk.
+ returned: always
+ type: dict
+ sample: { "tag": "value" }
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_OBJECT_CLASS = 'ResourceGroup'
+
+
+class AzureRMResourceGroupInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ tags=dict(type='list'),
+ list_resources=dict(type='bool')
+ )
+
+ self.results = dict(
+ changed=False,
+ resourcegroups=[]
+ )
+
+ self.name = None
+ self.tags = None
+ self.list_resources = None
+
+ super(AzureRMResourceGroupInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_resourcegroup_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_resourcegroup_facts' module has been renamed to 'azure_rm_resourcegroup_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ result = self.get_item()
+ else:
+ result = self.list_items()
+
+ if self.list_resources:
+ for item in result:
+ item['resources'] = self.list_by_rg(item['name'])
+
+ if is_old_facts:
+ self.results['ansible_facts'] = dict(
+ azure_resourcegroups=result
+ )
+ self.results['resourcegroups'] = result
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ result = []
+
+ try:
+ item = self.rm_client.resource_groups.get(self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_obj(item, AZURE_OBJECT_CLASS)]
+
+ return result
+
+ def list_items(self):
+ self.log('List all items')
+ try:
+ response = self.rm_client.resource_groups.list()
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_obj(item, AZURE_OBJECT_CLASS))
+ return results
+
+ def list_by_rg(self, name):
+ self.log('List resources under resource group')
+ results = []
+ try:
+ response = self.rm_client.resources.list_by_resource_group(name)
+ while True:
+ results.append(response.next().as_dict())
+ except StopIteration:
+ pass
+ except CloudError as exc:
+ self.fail('Error when listing resources under resource group {0}: {1}'.format(name, exc.message or str(exc)))
+ return results
+
+
+def main():
+ AzureRMResourceGroupInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roleassignment_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roleassignment_facts.py
new file mode 100644
index 00000000..4913350a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roleassignment_facts.py
@@ -0,0 +1,280 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yunge Zhu, (@yungezz)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_roleassignment_info
+short_description: Gets Azure Role Assignment facts
+description:
+ - Gets facts of Azure Role Assignment.
+
+options:
+ scope:
+ description:
+ - The scope that the role assignment applies to.
+ - For example, use /subscriptions/{subscription-id}/ for a subscription.
+ - /subscriptions/{subscription-id}/resourceGroups/{resourcegroup-name} for a resource group.
+ - /subscriptions/{subscription-id}/resourceGroups/{resourcegroup-name}/providers/{resource-provider}/{resource-type}/{resource-name} for a resource.
+ name:
+ description:
+ - Name of role assignment.
+ - Mutual exclusive with I(assignee).
+ assignee:
+ description:
+ - Object id of a user, group or service principal.
+ - Mutually exclusive with I(name).
+ role_definition_id:
+ description:
+ - Resource id of role definition.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu(@yungezz)
+
+'''
+
+EXAMPLES = '''
+ - name: Get role assignments for specific service principal
+ community.azure.azure_rm_roleassignment_info:
+ assignee: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+
+ - name: Get role assignments for specific scope
+ community.azure.azure_rm_roleassignment_info:
+ scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+'''
+
+RETURN = '''
+roleassignments:
+ description:
+ - List of role assignments.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Id of role assignment.
+ type: str
+ returned: always
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Authorization/roleAssignments/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+ name:
+ description:
+ - Name of role assignment.
+ type: str
+ returned: always
+ sample: myRoleAssignment
+ type:
+ description:
+ - Type of role assignment.
+ type: str
+ returned: always
+ sample: custom
+ principal_id:
+ description:
+ - Principal Id of the role assigned to.
+ type: str
+ returned: always
+ sample: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ role_definition_id:
+ description:
+ - Role definition id that was assigned to principal_id.
+ type: str
+ returned: always
+ sample: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ scope:
+ description:
+ - The role assignment scope.
+ type: str
+ returned: always
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+'''
+
+import time
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+ from azure.mgmt.authorization import AuthorizationManagementClient
+
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+def roleassignment_to_dict(assignment):
+ return dict(
+ id=assignment.id,
+ name=assignment.name,
+ type=assignment.type,
+ principal_id=assignment.principal_id,
+ role_definition_id=assignment.role_definition_id,
+ scope=assignment.scope
+ )
+
+
+class AzureRMRoleAssignmentInfo(AzureRMModuleBase):
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ name=dict(
+ type='str'
+ ),
+ scope=dict(
+ type='str'
+ ),
+ assignee=dict(
+ type='str'
+ ),
+ role_definition_id=dict(
+ type='str'
+ )
+ )
+
+ self.name = None
+ self.scope = None
+ self.assignee = None
+ self.role_definition_id = None
+
+ self.results = dict(
+ changed=False
+ )
+
+ self._client = None
+
+ mutually_exclusive = [['name', 'assignee']]
+
+ super(AzureRMRoleAssignmentInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_tags=False,
+ mutually_exclusive=mutually_exclusive)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+ is_old_facts = self.module._name == 'azure_rm_roleassignment_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_roleassignment_facts' module has been renamed to 'azure_rm_roleassignment_info'", version='2.13')
+
+ for key in list(self.module_arg_spec.keys()):
+ if hasattr(self, key):
+ setattr(self, key, kwargs[key])
+
+ # get management client
+ self._client = self.get_mgmt_svc_client(AuthorizationManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version="2018-01-01-preview")
+
+ if self.name:
+ self.results['roleassignments'] = self.get_by_name()
+ elif self.assignee:
+ self.results['roleassignments'] = self.get_by_assignee()
+ elif self.scope:
+ self.results['roleassignments'] = self.list_by_scope()
+ else:
+ self.fail("Please specify name or assignee")
+
+ return self.results
+
+ def get_by_name(self):
+ '''
+ Gets the properties of the specified role assignment by name.
+
+ :return: deserialized role assignment dictionary
+ '''
+ self.log("Gets role assignment {0} by name".format(self.name))
+
+ results = []
+
+ try:
+ response = self._client.role_assignments.get(scope=self.scope, role_assignment_name=self.name)
+
+ if response:
+ response = roleassignment_to_dict(response)
+
+ if self.role_definition_id:
+ if self.role_definition_id == response['role_definition_id']:
+ results = [response]
+ else:
+ results = [response]
+
+ except CloudError as ex:
+ self.log("Didn't find role assignment {0} in scope {1}".format(self.name, self.scope))
+
+ return results
+
+ def get_by_assignee(self):
+ '''
+ Gets the role assignments by assignee.
+
+ :return: deserialized role assignment dictionary
+ '''
+ self.log("Gets role assignment {0} by name".format(self.name))
+
+ results = []
+ filter = "principalId eq '{0}'".format(self.assignee)
+ try:
+ response = list(self._client.role_assignments.list(filter=filter))
+
+ if response and len(response) > 0:
+ response = [roleassignment_to_dict(a) for a in response]
+
+ if self.role_definition_id:
+ for r in response:
+ if r['role_definition_id'] == self.role_definition_id:
+ results.append(r)
+ else:
+ results = response
+
+ except CloudError as ex:
+ self.log("Didn't find role assignments to assignee {0}".format(self.assignee))
+
+ return results
+
+ def list_by_scope(self):
+ '''
+ Lists the role assignments by specific scope.
+
+ :return: deserialized role assignment dictionary
+ '''
+ self.log("Lists role assignment by scope {0}".format(self.scope))
+
+ results = []
+ try:
+ response = list(self._client.role_assignments.list_for_scope(scope=self.scope, filter='atScope()'))
+
+ if response and len(response) > 0:
+ response = [roleassignment_to_dict(a) for a in response]
+
+ if self.role_definition_id:
+ for r in response:
+ if r['role_definition_id'] == self.role_definition_id:
+ results.append(r)
+ else:
+ results = response
+
+ except CloudError as ex:
+ self.log("Didn't find role assignments to scope {0}".format(self.scope))
+
+ return results
+
+
+def main():
+ """Main execution"""
+ AzureRMRoleAssignmentInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roleassignment_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roleassignment_info.py
new file mode 100644
index 00000000..4913350a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roleassignment_info.py
@@ -0,0 +1,280 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yunge Zhu, (@yungezz)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_roleassignment_info
+short_description: Gets Azure Role Assignment facts
+description:
+ - Gets facts of Azure Role Assignment.
+
+options:
+ scope:
+ description:
+ - The scope that the role assignment applies to.
+ - For example, use /subscriptions/{subscription-id}/ for a subscription.
+ - /subscriptions/{subscription-id}/resourceGroups/{resourcegroup-name} for a resource group.
+ - /subscriptions/{subscription-id}/resourceGroups/{resourcegroup-name}/providers/{resource-provider}/{resource-type}/{resource-name} for a resource.
+ name:
+ description:
+ - Name of role assignment.
+ - Mutual exclusive with I(assignee).
+ assignee:
+ description:
+ - Object id of a user, group or service principal.
+ - Mutually exclusive with I(name).
+ role_definition_id:
+ description:
+ - Resource id of role definition.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu(@yungezz)
+
+'''
+
+EXAMPLES = '''
+ - name: Get role assignments for specific service principal
+ community.azure.azure_rm_roleassignment_info:
+ assignee: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+
+ - name: Get role assignments for specific scope
+ community.azure.azure_rm_roleassignment_info:
+ scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+'''
+
+RETURN = '''
+roleassignments:
+ description:
+ - List of role assignments.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Id of role assignment.
+ type: str
+ returned: always
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Authorization/roleAssignments/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+ name:
+ description:
+ - Name of role assignment.
+ type: str
+ returned: always
+ sample: myRoleAssignment
+ type:
+ description:
+ - Type of role assignment.
+ type: str
+ returned: always
+ sample: custom
+ principal_id:
+ description:
+ - Principal Id of the role assigned to.
+ type: str
+ returned: always
+ sample: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ role_definition_id:
+ description:
+ - Role definition id that was assigned to principal_id.
+ type: str
+ returned: always
+ sample: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ scope:
+ description:
+ - The role assignment scope.
+ type: str
+ returned: always
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+'''
+
+import time
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+ from azure.mgmt.authorization import AuthorizationManagementClient
+
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+def roleassignment_to_dict(assignment):
+ return dict(
+ id=assignment.id,
+ name=assignment.name,
+ type=assignment.type,
+ principal_id=assignment.principal_id,
+ role_definition_id=assignment.role_definition_id,
+ scope=assignment.scope
+ )
+
+
+class AzureRMRoleAssignmentInfo(AzureRMModuleBase):
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ name=dict(
+ type='str'
+ ),
+ scope=dict(
+ type='str'
+ ),
+ assignee=dict(
+ type='str'
+ ),
+ role_definition_id=dict(
+ type='str'
+ )
+ )
+
+ self.name = None
+ self.scope = None
+ self.assignee = None
+ self.role_definition_id = None
+
+ self.results = dict(
+ changed=False
+ )
+
+ self._client = None
+
+ mutually_exclusive = [['name', 'assignee']]
+
+ super(AzureRMRoleAssignmentInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_tags=False,
+ mutually_exclusive=mutually_exclusive)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+ is_old_facts = self.module._name == 'azure_rm_roleassignment_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_roleassignment_facts' module has been renamed to 'azure_rm_roleassignment_info'", version='2.13')
+
+ for key in list(self.module_arg_spec.keys()):
+ if hasattr(self, key):
+ setattr(self, key, kwargs[key])
+
+ # get management client
+ self._client = self.get_mgmt_svc_client(AuthorizationManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version="2018-01-01-preview")
+
+ if self.name:
+ self.results['roleassignments'] = self.get_by_name()
+ elif self.assignee:
+ self.results['roleassignments'] = self.get_by_assignee()
+ elif self.scope:
+ self.results['roleassignments'] = self.list_by_scope()
+ else:
+ self.fail("Please specify name or assignee")
+
+ return self.results
+
+ def get_by_name(self):
+ '''
+ Gets the properties of the specified role assignment by name.
+
+ :return: deserialized role assignment dictionary
+ '''
+ self.log("Gets role assignment {0} by name".format(self.name))
+
+ results = []
+
+ try:
+ response = self._client.role_assignments.get(scope=self.scope, role_assignment_name=self.name)
+
+ if response:
+ response = roleassignment_to_dict(response)
+
+ if self.role_definition_id:
+ if self.role_definition_id == response['role_definition_id']:
+ results = [response]
+ else:
+ results = [response]
+
+ except CloudError as ex:
+ self.log("Didn't find role assignment {0} in scope {1}".format(self.name, self.scope))
+
+ return results
+
+ def get_by_assignee(self):
+ '''
+ Gets the role assignments by assignee.
+
+ :return: deserialized role assignment dictionary
+ '''
+ self.log("Gets role assignment {0} by name".format(self.name))
+
+ results = []
+ filter = "principalId eq '{0}'".format(self.assignee)
+ try:
+ response = list(self._client.role_assignments.list(filter=filter))
+
+ if response and len(response) > 0:
+ response = [roleassignment_to_dict(a) for a in response]
+
+ if self.role_definition_id:
+ for r in response:
+ if r['role_definition_id'] == self.role_definition_id:
+ results.append(r)
+ else:
+ results = response
+
+ except CloudError as ex:
+ self.log("Didn't find role assignments to assignee {0}".format(self.assignee))
+
+ return results
+
+ def list_by_scope(self):
+ '''
+ Lists the role assignments by specific scope.
+
+ :return: deserialized role assignment dictionary
+ '''
+ self.log("Lists role assignment by scope {0}".format(self.scope))
+
+ results = []
+ try:
+ response = list(self._client.role_assignments.list_for_scope(scope=self.scope, filter='atScope()'))
+
+ if response and len(response) > 0:
+ response = [roleassignment_to_dict(a) for a in response]
+
+ if self.role_definition_id:
+ for r in response:
+ if r['role_definition_id'] == self.role_definition_id:
+ results.append(r)
+ else:
+ results = response
+
+ except CloudError as ex:
+ self.log("Didn't find role assignments to scope {0}".format(self.scope))
+
+ return results
+
+
+def main():
+ """Main execution"""
+ AzureRMRoleAssignmentInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roledefinition_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roledefinition_facts.py
new file mode 100644
index 00000000..2ace94e4
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roledefinition_facts.py
@@ -0,0 +1,310 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yunge Zhu, (@yungezz)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_roledefinition_info
+short_description: Get Azure Role Definition facts
+description:
+ - Get facts of Azure Role Definition.
+
+options:
+ scope:
+ description:
+ - The scope of role definition.
+ required: True
+ id:
+ description:
+ - Role definition id.
+ role_name:
+ description:
+ - Role name.
+ type:
+ description:
+ - Type of role.
+ choices:
+ - system
+ - custom
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu(@yungezz)
+
+'''
+
+EXAMPLES = '''
+ - name: List Role Definitions in scope
+ community.azure.azure_rm_roledefinition_info:
+ scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup
+
+ - name: Get Role Definition by name
+ community.azure.azure_rm_roledefinition_info:
+ scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup
+ name: myRoleDefinition
+'''
+
+RETURN = '''
+roledefinitions:
+ description:
+ - A list of Role Definition facts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Role Definition ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Authorization/roleDefinitions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+ role_name:
+ description:
+ - Role name.
+ returned: always
+ type: str
+ sample: myCustomRoleDefinition
+ name:
+ description:
+ - System assigned role name.
+ returned: always
+ type: str
+ sample: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ assignable_scopes:
+ description:
+ - List of assignable scopes of this definition.
+ returned: always
+ type: list
+ sample: [ "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup" ]
+ permissions:
+ description:
+ - List of Role Definition permissions.
+ returned: always
+ contains:
+ actions:
+ description:
+ - List of allowed actions.
+ returned: always
+ type: list
+ sample: [ 'Microsoft.Compute/virtualMachines/read' ]
+ not_actions:
+ description:
+ - List of denied actions.
+ returned: always
+ type: list
+ sample: [ 'Microsoft.Compute/virtualMachines/write' ]
+ data_actions:
+ description:
+ - List of allowed data actions.
+ returned: always
+ type: list
+ sample: [ 'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read' ]
+ not_data_actions:
+ description:
+ - List of denied data actions.
+ returned: always
+ type: list
+ sample: [ 'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write' ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils._text import to_native
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+ from azure.mgmt.authorization import AuthorizationManagementClient
+
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+def roledefinition_to_dict(role):
+ result = dict(
+ id=role.id,
+ name=role.name,
+ type=role.role_type,
+ assignable_scopes=role.assignable_scopes,
+ description=role.description,
+ role_name=role.role_name
+ )
+ if role.permissions:
+ result['permissions'] = [dict(
+ actions=p.actions,
+ not_actions=p.not_actions,
+ data_actions=p.data_actions,
+ not_data_actions=p.not_data_actions
+ ) for p in role.permissions]
+ return result
+
+
+class AzureRMRoleDefinitionInfo(AzureRMModuleBase):
+ def __init__(self):
+ self.module_arg_spec = dict(
+ scope=dict(
+ type='str',
+ required='true'
+ ),
+ role_name=dict(type='str'),
+ id=dict(type='str'),
+ type=dict(
+ type='str',
+ choices=['custom', 'system'])
+ )
+
+ self.role_name = None
+ self.scope = None
+ self.id = None
+ self.type = None
+
+ self.results = dict(
+ changed=False
+ )
+
+ self._client = None
+
+ super(AzureRMRoleDefinitionInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+ is_old_facts = self.module._name == 'azure_rm_roledefinition_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_roledefinition_facts' module has been renamed to 'azure_rm_roledefinition_info'", version='2.13')
+
+ for key in list(self.module_arg_spec.keys()):
+ if hasattr(self, key):
+ setattr(self, key, kwargs[key])
+
+ if self.type:
+ self.type = self.get_role_type(self.type)
+
+ # get management client
+ self._client = self.get_mgmt_svc_client(AuthorizationManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version="2018-01-01-preview")
+
+ if self.id:
+ self.results['roledefinitions'] = self.get_by_id()
+ elif self.role_name:
+ self.results['roledefinitions'] = self.get_by_role_name()
+ else:
+ self.results['roledefinitions'] = self.list()
+
+ return self.results
+
+ def get_role_type(self, role_type):
+ if role_type:
+ if role_type == 'custom':
+ return 'CustomRole'
+ else:
+ return 'SystemRole'
+ return role_type
+
+ def list(self):
+ '''
+ List Role Definition in scope.
+
+ :return: deserialized Role Definition state dictionary
+ '''
+ self.log("List Role Definition in scope {0}".format(self.scope))
+
+ response = []
+
+ try:
+ response = list(self._client.role_definitions.list(scope=self.scope))
+
+ if len(response) > 0:
+ self.log("Response : {0}".format(response))
+ roles = []
+
+ if self.type:
+ roles = [r for r in response if r.role_type == self.type]
+ else:
+ roles = response
+
+ if len(roles) > 0:
+ return [roledefinition_to_dict(r) for r in roles]
+
+ except CloudError as ex:
+ self.log("Didn't find role definition in scope {0}".format(self.scope))
+
+ return response
+
+ def get_by_id(self):
+ '''
+ Get Role Definition in scope by id.
+
+ :return: deserialized Role Definition state dictionary
+ '''
+ self.log("Get Role Definition by id {0}".format(self.id))
+
+ response = None
+
+ try:
+ response = self._client.role_definitions.get(scope=self.scope, role_definition_id=self.id)
+ if response:
+ response = roledefinition_to_dict(response)
+ if self.type:
+ if response.role_type == self.type:
+ return [response]
+ else:
+ return [response]
+
+ except CloudError as ex:
+ self.log("Didn't find role definition by id {0}".format(self.id))
+
+ return []
+
+ def get_by_role_name(self):
+ '''
+ Get Role Definition in scope by role name.
+
+ :return: deserialized role definition state dictionary
+ '''
+ self.log("Get Role Definition by name {0}".format(self.role_name))
+
+ response = []
+
+ try:
+ response = self.list()
+
+ if len(response) > 0:
+ roles = []
+ for r in response:
+ if r['role_name'] == self.role_name:
+ roles.append(r)
+
+ if len(roles) == 1:
+ self.log("Role Definition : {0} found".format(self.role_name))
+ return roles
+ if len(roles) > 1:
+ self.fail("Found multiple Role Definitions with name: {0}".format(self.role_name))
+
+ except CloudError as ex:
+ self.log("Didn't find Role Definition by name {0}".format(self.role_name))
+
+ return []
+
+
+def main():
+ """Main execution"""
+ AzureRMRoleDefinitionInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roledefinition_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roledefinition_info.py
new file mode 100644
index 00000000..2ace94e4
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_roledefinition_info.py
@@ -0,0 +1,310 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yunge Zhu, (@yungezz)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_roledefinition_info
+short_description: Get Azure Role Definition facts
+description:
+ - Get facts of Azure Role Definition.
+
+options:
+ scope:
+ description:
+ - The scope of role definition.
+ required: True
+ id:
+ description:
+ - Role definition id.
+ role_name:
+ description:
+ - Role name.
+ type:
+ description:
+ - Type of role.
+ choices:
+ - system
+ - custom
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu(@yungezz)
+
+'''
+
+EXAMPLES = '''
+ - name: List Role Definitions in scope
+ community.azure.azure_rm_roledefinition_info:
+ scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup
+
+ - name: Get Role Definition by name
+ community.azure.azure_rm_roledefinition_info:
+ scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup
+ name: myRoleDefinition
+'''
+
+RETURN = '''
+roledefinitions:
+ description:
+ - A list of Role Definition facts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Role Definition ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Authorization/roleDefinitions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+ role_name:
+ description:
+ - Role name.
+ returned: always
+ type: str
+ sample: myCustomRoleDefinition
+ name:
+ description:
+ - System assigned role name.
+ returned: always
+ type: str
+ sample: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ assignable_scopes:
+ description:
+ - List of assignable scopes of this definition.
+ returned: always
+ type: list
+ sample: [ "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup" ]
+ permissions:
+ description:
+ - List of Role Definition permissions.
+ returned: always
+ contains:
+ actions:
+ description:
+ - List of allowed actions.
+ returned: always
+ type: list
+ sample: [ 'Microsoft.Compute/virtualMachines/read' ]
+ not_actions:
+ description:
+ - List of denied actions.
+ returned: always
+ type: list
+ sample: [ 'Microsoft.Compute/virtualMachines/write' ]
+ data_actions:
+ description:
+ - List of allowed data actions.
+ returned: always
+ type: list
+ sample: [ 'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read' ]
+ not_data_actions:
+ description:
+ - List of denied data actions.
+ returned: always
+ type: list
+ sample: [ 'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write' ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils._text import to_native
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+ from azure.mgmt.authorization import AuthorizationManagementClient
+
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+def roledefinition_to_dict(role):
+ result = dict(
+ id=role.id,
+ name=role.name,
+ type=role.role_type,
+ assignable_scopes=role.assignable_scopes,
+ description=role.description,
+ role_name=role.role_name
+ )
+ if role.permissions:
+ result['permissions'] = [dict(
+ actions=p.actions,
+ not_actions=p.not_actions,
+ data_actions=p.data_actions,
+ not_data_actions=p.not_data_actions
+ ) for p in role.permissions]
+ return result
+
+
+class AzureRMRoleDefinitionInfo(AzureRMModuleBase):
+ def __init__(self):
+ self.module_arg_spec = dict(
+ scope=dict(
+ type='str',
+ required='true'
+ ),
+ role_name=dict(type='str'),
+ id=dict(type='str'),
+ type=dict(
+ type='str',
+ choices=['custom', 'system'])
+ )
+
+ self.role_name = None
+ self.scope = None
+ self.id = None
+ self.type = None
+
+ self.results = dict(
+ changed=False
+ )
+
+ self._client = None
+
+ super(AzureRMRoleDefinitionInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+ is_old_facts = self.module._name == 'azure_rm_roledefinition_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_roledefinition_facts' module has been renamed to 'azure_rm_roledefinition_info'", version='2.13')
+
+ for key in list(self.module_arg_spec.keys()):
+ if hasattr(self, key):
+ setattr(self, key, kwargs[key])
+
+ if self.type:
+ self.type = self.get_role_type(self.type)
+
+ # get management client
+ self._client = self.get_mgmt_svc_client(AuthorizationManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version="2018-01-01-preview")
+
+ if self.id:
+ self.results['roledefinitions'] = self.get_by_id()
+ elif self.role_name:
+ self.results['roledefinitions'] = self.get_by_role_name()
+ else:
+ self.results['roledefinitions'] = self.list()
+
+ return self.results
+
+ def get_role_type(self, role_type):
+ if role_type:
+ if role_type == 'custom':
+ return 'CustomRole'
+ else:
+ return 'SystemRole'
+ return role_type
+
+ def list(self):
+ '''
+ List Role Definition in scope.
+
+ :return: deserialized Role Definition state dictionary
+ '''
+ self.log("List Role Definition in scope {0}".format(self.scope))
+
+ response = []
+
+ try:
+ response = list(self._client.role_definitions.list(scope=self.scope))
+
+ if len(response) > 0:
+ self.log("Response : {0}".format(response))
+ roles = []
+
+ if self.type:
+ roles = [r for r in response if r.role_type == self.type]
+ else:
+ roles = response
+
+ if len(roles) > 0:
+ return [roledefinition_to_dict(r) for r in roles]
+
+ except CloudError as ex:
+ self.log("Didn't find role definition in scope {0}".format(self.scope))
+
+ return response
+
+ def get_by_id(self):
+ '''
+ Get Role Definition in scope by id.
+
+ :return: deserialized Role Definition state dictionary
+ '''
+ self.log("Get Role Definition by id {0}".format(self.id))
+
+ response = None
+
+ try:
+ response = self._client.role_definitions.get(scope=self.scope, role_definition_id=self.id)
+ if response:
+ response = roledefinition_to_dict(response)
+ if self.type:
+ if response.role_type == self.type:
+ return [response]
+ else:
+ return [response]
+
+ except CloudError as ex:
+ self.log("Didn't find role definition by id {0}".format(self.id))
+
+ return []
+
+ def get_by_role_name(self):
+ '''
+ Get Role Definition in scope by role name.
+
+ :return: deserialized role definition state dictionary
+ '''
+ self.log("Get Role Definition by name {0}".format(self.role_name))
+
+ response = []
+
+ try:
+ response = self.list()
+
+ if len(response) > 0:
+ roles = []
+ for r in response:
+ if r['role_name'] == self.role_name:
+ roles.append(r)
+
+ if len(roles) == 1:
+ self.log("Role Definition : {0} found".format(self.role_name))
+ return roles
+ if len(roles) > 1:
+ self.fail("Found multiple Role Definitions with name: {0}".format(self.role_name))
+
+ except CloudError as ex:
+ self.log("Didn't find Role Definition by name {0}".format(self.role_name))
+
+ return []
+
+
+def main():
+ """Main execution"""
+ AzureRMRoleDefinitionInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_routetable_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_routetable_facts.py
new file mode 100644
index 00000000..84cad826
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_routetable_facts.py
@@ -0,0 +1,219 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_routetable_info
+
+
+short_description: Get route table facts
+
+description:
+ - Get facts for a specific route table or all route table in a resource group or subscription.
+
+options:
+ name:
+ description:
+ - Limit results to a specific route table.
+ resource_group:
+ description:
+ - Limit results in a specific resource group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one route table
+ community.azure.azure_rm_routetable_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all route tables
+ community.azure.azure_rm_routetable_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by tags
+ community.azure.azure_rm_routetable_info:
+ tags:
+ - testing
+ - foo:bar
+'''
+RETURN = '''
+id:
+ description:
+ - Resource ID.
+ returned: success
+ type: str
+ sample: "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/routeTables/tableb57dc95236"
+name:
+ description:
+ - Name of the resource.
+ returned: success
+ type: str
+ sample: tableb57dc95236
+resource_group:
+ description:
+ - Resource group of the route table.
+ returned: success
+ type: str
+ sample: v-xisuRG
+disable_bgp_route_propagation:
+ description:
+ - Whether the routes learned by BGP on that route table disabled.
+ returned: success
+ type: bool
+ sample: false
+tags:
+ description:
+ - Tags of the route table.
+ returned: success
+ type: dict
+ sample: { 'key1':'value1', 'key2':'value2'}
+routes:
+ description:
+ - Current routes of the route table.
+ returned: success
+ type: list
+ sample: [
+ {
+ "id": "/subscriptions/xxx...xxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/routeTables/tableb57dc95236/routes/routeb57dc95540",
+ "name": "routeb57dc95540",
+ "resource_group": "v-xisuRG",
+ "route_table_name": "tableb57dc95236",
+ "address_prefix": "10.1.0.0/24",
+ "next_hop_type": "virtual_network_gateway",
+ "next_hop_ip_address": null
+ }
+ ]
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+
+def route_to_dict(route):
+ id_dict = azure_id_to_dict(route.id)
+ return dict(
+ id=route.id,
+ name=route.name,
+ resource_group=id_dict.get('resourceGroups'),
+ route_table_name=id_dict.get('routeTables'),
+ address_prefix=route.address_prefix,
+ next_hop_type=_camel_to_snake(route.next_hop_type),
+ next_hop_ip_address=route.next_hop_ip_address
+ )
+
+
+def instance_to_dict(table):
+ return dict(
+ id=table.id,
+ name=table.name,
+ resource_group=azure_id_to_dict(table.id).get('resourceGroups'),
+ location=table.location,
+ routes=[route_to_dict(i) for i in table.routes] if table.routes else [],
+ disable_bgp_route_propagation=table.disable_bgp_route_propagation,
+ tags=table.tags
+ )
+
+
+class AzureRMRouteTableInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ route_tables=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMRouteTableInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_routetable_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_routetable_facts' module has been renamed to 'azure_rm_routetable_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ response = []
+ if self.name:
+ response = self.get_item()
+ elif self.resource_group:
+ response = self.list_items()
+ else:
+ response = self.list_all_items()
+
+ self.results['route_tables'] = [instance_to_dict(x) for x in response if self.has_tags(x.tags, self.tags)]
+ return self.results
+
+ def get_item(self):
+ self.log('Get route table for {0}-{1}'.format(self.resource_group, self.name))
+ try:
+ item = self.network_client.route_tables.get(self.resource_group, self.name)
+ return [item]
+ except CloudError:
+ pass
+ return []
+
+ def list_items(self):
+ self.log('List all items in resource group')
+ try:
+ return self.network_client.route_tables.list(self.resource_group)
+ except CloudError as exc:
+ self.fail("Failed to list items - {0}".format(str(exc)))
+ return []
+
+ def list_all_items(self):
+ self.log("List all items in subscription")
+ try:
+ return self.network_client.route_tables.list_all()
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+ return []
+
+
+def main():
+ AzureRMRouteTableInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_routetable_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_routetable_info.py
new file mode 100644
index 00000000..84cad826
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_routetable_info.py
@@ -0,0 +1,219 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_routetable_info
+
+
+short_description: Get route table facts
+
+description:
+ - Get facts for a specific route table or all route table in a resource group or subscription.
+
+options:
+ name:
+ description:
+ - Limit results to a specific route table.
+ resource_group:
+ description:
+ - Limit results in a specific resource group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one route table
+ community.azure.azure_rm_routetable_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all route tables
+ community.azure.azure_rm_routetable_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by tags
+ community.azure.azure_rm_routetable_info:
+ tags:
+ - testing
+ - foo:bar
+'''
+RETURN = '''
+id:
+ description:
+ - Resource ID.
+ returned: success
+ type: str
+ sample: "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/routeTables/tableb57dc95236"
+name:
+ description:
+ - Name of the resource.
+ returned: success
+ type: str
+ sample: tableb57dc95236
+resource_group:
+ description:
+ - Resource group of the route table.
+ returned: success
+ type: str
+ sample: v-xisuRG
+disable_bgp_route_propagation:
+ description:
+ - Whether the routes learned by BGP on that route table disabled.
+ returned: success
+ type: bool
+ sample: false
+tags:
+ description:
+ - Tags of the route table.
+ returned: success
+ type: dict
+ sample: { 'key1':'value1', 'key2':'value2'}
+routes:
+ description:
+ - Current routes of the route table.
+ returned: success
+ type: list
+ sample: [
+ {
+ "id": "/subscriptions/xxx...xxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/routeTables/tableb57dc95236/routes/routeb57dc95540",
+ "name": "routeb57dc95540",
+ "resource_group": "v-xisuRG",
+ "route_table_name": "tableb57dc95236",
+ "address_prefix": "10.1.0.0/24",
+ "next_hop_type": "virtual_network_gateway",
+ "next_hop_ip_address": null
+ }
+ ]
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+
+def route_to_dict(route):
+ id_dict = azure_id_to_dict(route.id)
+ return dict(
+ id=route.id,
+ name=route.name,
+ resource_group=id_dict.get('resourceGroups'),
+ route_table_name=id_dict.get('routeTables'),
+ address_prefix=route.address_prefix,
+ next_hop_type=_camel_to_snake(route.next_hop_type),
+ next_hop_ip_address=route.next_hop_ip_address
+ )
+
+
+def instance_to_dict(table):
+ return dict(
+ id=table.id,
+ name=table.name,
+ resource_group=azure_id_to_dict(table.id).get('resourceGroups'),
+ location=table.location,
+ routes=[route_to_dict(i) for i in table.routes] if table.routes else [],
+ disable_bgp_route_propagation=table.disable_bgp_route_propagation,
+ tags=table.tags
+ )
+
+
+class AzureRMRouteTableInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ route_tables=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMRouteTableInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_routetable_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_routetable_facts' module has been renamed to 'azure_rm_routetable_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ response = []
+ if self.name:
+ response = self.get_item()
+ elif self.resource_group:
+ response = self.list_items()
+ else:
+ response = self.list_all_items()
+
+ self.results['route_tables'] = [instance_to_dict(x) for x in response if self.has_tags(x.tags, self.tags)]
+ return self.results
+
+ def get_item(self):
+ self.log('Get route table for {0}-{1}'.format(self.resource_group, self.name))
+ try:
+ item = self.network_client.route_tables.get(self.resource_group, self.name)
+ return [item]
+ except CloudError:
+ pass
+ return []
+
+ def list_items(self):
+ self.log('List all items in resource group')
+ try:
+ return self.network_client.route_tables.list(self.resource_group)
+ except CloudError as exc:
+ self.fail("Failed to list items - {0}".format(str(exc)))
+ return []
+
+ def list_all_items(self):
+ self.log("List all items in subscription")
+ try:
+ return self.network_client.route_tables.list_all()
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+ return []
+
+
+def main():
+ AzureRMRouteTableInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_securitygroup_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_securitygroup_facts.py
new file mode 100644
index 00000000..f962af4e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_securitygroup_facts.py
@@ -0,0 +1,320 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_securitygroup_info
+
+
+short_description: Get security group facts
+
+description:
+ - Get facts for a specific security group or all security groups within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific security group.
+ resource_group:
+ description:
+ - Name of the resource group to use.
+ required: true
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one security group
+ community.azure.azure_rm_securitygroup_info:
+ resource_group: myResourceGroup
+ name: secgroup001
+
+ - name: Get facts for all security groups
+ community.azure.azure_rm_securitygroup_info:
+ resource_group: myResourceGroup
+
+'''
+
+RETURN = '''
+securitygroups:
+ description:
+ - List containing security group dicts.
+ returned: always
+ type: complex
+ contains:
+ etag:
+ description:
+ - A unique read-only string that changes whenever the resource is updated.
+ returned: always
+ type: str
+ sample: 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"'
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001"
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: "eastus2"
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: "secgroup001"
+ properties:
+ description:
+ - List of security group's properties.
+ returned: always
+ type: dict
+ sample: {
+ "defaultSecurityRules": [
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowVnetInBound",
+ "name": "AllowVnetInBound",
+ "properties": {
+ "access": "Allow",
+ "description": "Allow inbound traffic from all VMs in VNET",
+ "destinationAddressPrefix": "VirtualNetwork",
+ "destinationPortRange": "*",
+ "direction": "Inbound",
+ "priority": 65000,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "VirtualNetwork",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowAzureLoadBalancerInBound",
+ "name": "AllowAzureLoadBalancerInBound",
+ "properties": {
+ "access": "Allow",
+ "description": "Allow inbound traffic from azure load balancer",
+ "destinationAddressPrefix": "*",
+ "destinationPortRange": "*",
+ "direction": "Inbound",
+ "priority": 65001,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "AzureLoadBalancer",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/DenyAllInBound",
+ "name": "DenyAllInBound",
+ "properties": {
+ "access": "Deny",
+ "description": "Deny all inbound traffic",
+ "destinationAddressPrefix": "*",
+ "destinationPortRange": "*",
+ "direction": "Inbound",
+ "priority": 65500,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "*",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowVnetOutBound",
+ "name": "AllowVnetOutBound",
+ "properties": {
+ "access": "Allow",
+ "description": "Allow outbound traffic from all VMs to all VMs in VNET",
+ "destinationAddressPrefix": "VirtualNetwork",
+ "destinationPortRange": "*",
+ "direction": "Outbound",
+ "priority": 65000,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "VirtualNetwork",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowInternetOutBound",
+ "name": "AllowInternetOutBound",
+ "properties": {
+ "access": "Allow",
+ "description": "Allow outbound traffic from all VMs to Internet",
+ "destinationAddressPrefix": "Internet",
+ "destinationPortRange": "*",
+ "direction": "Outbound",
+ "priority": 65001,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "*",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/DenyAllOutBound",
+ "name": "DenyAllOutBound",
+ "properties": {
+ "access": "Deny",
+ "description": "Deny all outbound traffic",
+ "destinationAddressPrefix": "*",
+ "destinationPortRange": "*",
+ "direction": "Outbound",
+ "priority": 65500,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "*",
+ "sourcePortRange": "*"
+ }
+ }
+ ],
+ "networkInterfaces": [
+ {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nic004"
+ }
+ ],
+ "provisioningState": "Succeeded",
+ "resourceGuid": "ebd00afa-5dc8-446f-810a-50dd6f671588",
+ "securityRules": []
+ }
+ tags:
+ description:
+ - Tags to assign to the security group.
+ returned: always
+ type: dict
+ sample: { 'tag': 'value' }
+ type:
+ description:
+ - Type of the resource.
+ returned: always
+ type: str
+ sample: "Microsoft.Network/networkSecurityGroups"
+
+''' # NOQA
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_OBJECT_CLASS = 'NetworkSecurityGroup'
+
+
+class AzureRMSecurityGroupInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(required=True, type='str'),
+ tags=dict(type='list'),
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMSecurityGroupInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_securitygroup_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_securitygroup_facts' module has been renamed to 'azure_rm_securitygroup_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ info = self.get_item()
+ else:
+ info = self.list_items()
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_securitygroups': info
+ }
+ self.results['securitygroups'] = info
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ result = []
+
+ try:
+ item = self.network_client.network_security_groups.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ grp = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ grp['name'] = item.name
+ result = [grp]
+
+ return result
+
+ def list_items(self):
+ self.log('List all items')
+ try:
+ response = self.network_client.network_security_groups.list(self.resource_group)
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ grp = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ grp['name'] = item.name
+ results.append(grp)
+ return results
+
+
+def main():
+ AzureRMSecurityGroupInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_securitygroup_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_securitygroup_info.py
new file mode 100644
index 00000000..f962af4e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_securitygroup_info.py
@@ -0,0 +1,320 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_securitygroup_info
+
+
+short_description: Get security group facts
+
+description:
+ - Get facts for a specific security group or all security groups within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific security group.
+ resource_group:
+ description:
+ - Name of the resource group to use.
+ required: true
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one security group
+ community.azure.azure_rm_securitygroup_info:
+ resource_group: myResourceGroup
+ name: secgroup001
+
+ - name: Get facts for all security groups
+ community.azure.azure_rm_securitygroup_info:
+ resource_group: myResourceGroup
+
+'''
+
+RETURN = '''
+securitygroups:
+ description:
+ - List containing security group dicts.
+ returned: always
+ type: complex
+ contains:
+ etag:
+ description:
+ - A unique read-only string that changes whenever the resource is updated.
+ returned: always
+ type: str
+ sample: 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"'
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001"
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: "eastus2"
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: "secgroup001"
+ properties:
+ description:
+ - List of security group's properties.
+ returned: always
+ type: dict
+ sample: {
+ "defaultSecurityRules": [
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowVnetInBound",
+ "name": "AllowVnetInBound",
+ "properties": {
+ "access": "Allow",
+ "description": "Allow inbound traffic from all VMs in VNET",
+ "destinationAddressPrefix": "VirtualNetwork",
+ "destinationPortRange": "*",
+ "direction": "Inbound",
+ "priority": 65000,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "VirtualNetwork",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowAzureLoadBalancerInBound",
+ "name": "AllowAzureLoadBalancerInBound",
+ "properties": {
+ "access": "Allow",
+ "description": "Allow inbound traffic from azure load balancer",
+ "destinationAddressPrefix": "*",
+ "destinationPortRange": "*",
+ "direction": "Inbound",
+ "priority": 65001,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "AzureLoadBalancer",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/DenyAllInBound",
+ "name": "DenyAllInBound",
+ "properties": {
+ "access": "Deny",
+ "description": "Deny all inbound traffic",
+ "destinationAddressPrefix": "*",
+ "destinationPortRange": "*",
+ "direction": "Inbound",
+ "priority": 65500,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "*",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowVnetOutBound",
+ "name": "AllowVnetOutBound",
+ "properties": {
+ "access": "Allow",
+ "description": "Allow outbound traffic from all VMs to all VMs in VNET",
+ "destinationAddressPrefix": "VirtualNetwork",
+ "destinationPortRange": "*",
+ "direction": "Outbound",
+ "priority": 65000,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "VirtualNetwork",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/AllowInternetOutBound",
+ "name": "AllowInternetOutBound",
+ "properties": {
+ "access": "Allow",
+ "description": "Allow outbound traffic from all VMs to Internet",
+ "destinationAddressPrefix": "Internet",
+ "destinationPortRange": "*",
+ "direction": "Outbound",
+ "priority": 65001,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "*",
+ "sourcePortRange": "*"
+ }
+ },
+ {
+ "etag": 'W/"d036f4d7-d977-429a-a8c6-879bc2523399"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkSecurityGroups/secgroup001/defaultSecurityRules/DenyAllOutBound",
+ "name": "DenyAllOutBound",
+ "properties": {
+ "access": "Deny",
+ "description": "Deny all outbound traffic",
+ "destinationAddressPrefix": "*",
+ "destinationPortRange": "*",
+ "direction": "Outbound",
+ "priority": 65500,
+ "protocol": "*",
+ "provisioningState": "Succeeded",
+ "sourceAddressPrefix": "*",
+ "sourcePortRange": "*"
+ }
+ }
+ ],
+ "networkInterfaces": [
+ {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nic004"
+ }
+ ],
+ "provisioningState": "Succeeded",
+ "resourceGuid": "ebd00afa-5dc8-446f-810a-50dd6f671588",
+ "securityRules": []
+ }
+ tags:
+ description:
+ - Tags to assign to the security group.
+ returned: always
+ type: dict
+ sample: { 'tag': 'value' }
+ type:
+ description:
+ - Type of the resource.
+ returned: always
+ type: str
+ sample: "Microsoft.Network/networkSecurityGroups"
+
+''' # NOQA
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_OBJECT_CLASS = 'NetworkSecurityGroup'
+
+
+class AzureRMSecurityGroupInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(required=True, type='str'),
+ tags=dict(type='list'),
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMSecurityGroupInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+
+ is_old_facts = self.module._name == 'azure_rm_securitygroup_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_securitygroup_facts' module has been renamed to 'azure_rm_securitygroup_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ info = self.get_item()
+ else:
+ info = self.list_items()
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_securitygroups': info
+ }
+ self.results['securitygroups'] = info
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ result = []
+
+ try:
+ item = self.network_client.network_security_groups.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ grp = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ grp['name'] = item.name
+ result = [grp]
+
+ return result
+
+ def list_items(self):
+ self.log('List all items')
+ try:
+ response = self.network_client.network_security_groups.list(self.resource_group)
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ grp = self.serialize_obj(item, AZURE_OBJECT_CLASS)
+ grp['name'] = item.name
+ results.append(grp)
+ return results
+
+
+def main():
+ AzureRMSecurityGroupInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_servicebus_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_servicebus_facts.py
new file mode 100644
index 00000000..fd88d5c9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_servicebus_facts.py
@@ -0,0 +1,584 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_servicebus_info
+
+
+short_description: Get servicebus facts
+
+description:
+ - Get facts for a specific servicebus or all servicebus in a resource group or subscription.
+
+options:
+ name:
+ description:
+ - Limit results to a specific servicebus.
+ resource_group:
+ description:
+ - Limit results in a specific resource group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ namespace:
+ description:
+ - Servicebus namespace name.
+ - A namespace is a scoping container for all messaging components.
+ - Multiple queues and topics can reside within a single namespace, and namespaces often serve as application containers.
+ - Required when I(type=namespace).
+ type:
+ description:
+ - Type of the resource.
+ choices:
+ - namespace
+ - queue
+ - topic
+ - subscription
+ topic:
+ description:
+ - Topic name.
+ - Required when I(type=subscription).
+ show_sas_policies:
+ description:
+ - Whether to show the SAS policies.
+ - Not support when I(type=subscription).
+ - Note if enable this option, the facts module will raise two more HTTP call for each resources, need more network overhead.
+ type: bool
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+- name: Get all namespaces under a resource group
+ community.azure.azure_rm_servicebus_info:
+ resource_group: myResourceGroup
+ type: namespace
+
+- name: Get all topics under a namespace
+ community.azure.azure_rm_servicebus_info:
+ resource_group: myResourceGroup
+ namespace: bar
+ type: topic
+
+- name: Get a single queue with SAS policies
+ community.azure.azure_rm_servicebus_info:
+ resource_group: myResourceGroup
+ namespace: bar
+ type: queue
+ name: sbqueue
+ show_sas_policies: true
+
+- name: Get all subscriptions under a resource group
+ community.azure.azure_rm_servicebus_info:
+ resource_group: myResourceGroup
+ type: subscription
+ namespace: bar
+ topic: sbtopic
+'''
+RETURN = '''
+servicebuses:
+ description:
+ - List of servicebus dicts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/foo/providers/Microsoft.ServiceBus/
+ namespaces/bar/topics/baz/subscriptions/qux"
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: qux
+ location:
+ description:
+ - The Geo-location where the resource lives.
+ returned: always
+ type: str
+ sample: eastus
+ namespace:
+ description:
+ - I(namespace) name of the C(queue) or C(topic), C(subscription).
+ returned: always
+ type: str
+ sample: bar
+ topic:
+ description:
+ - Topic name of a subscription.
+ returned: always
+ type: str
+ sample: baz
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: {env: sandbox}
+ sku:
+ description:
+ - Properties of namespace's SKU.
+ returned: always
+ type: str
+ sample: Standard
+ provisioning_state:
+ description:
+ - Provisioning state of the namespace.
+ returned: always
+ type: str
+ sample: Succeeded
+ service_bus_endpoint:
+ description:
+ - Endpoint you can use to perform Service Bus operations.
+ returned: always
+ type: str
+ sample: "https://bar.servicebus.windows.net:443/"
+ metric_id:
+ description:
+ - Identifier for Azure Insights metrics of namespace.
+ returned: always
+ type: str
+ sample: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:bar"
+ type:
+ description:
+ - Resource type.
+ - Namespace is a scoping container for all messaging components.
+ - Queue enables you to store messages until the receiving application is available to receive and process them.
+ - Topic and subscriptions enable 1:n relationships between publishers and subscribers.
+ returned: always
+ type: str
+ sample: "Microsoft.ServiceBus/Namespaces/Topics"
+ created_at:
+ description:
+ - Exact time the message was created.
+ returned: always
+ type: str
+ sample: "2019-01-25 02:46:55.543953+00:00"
+ updated_at:
+ description:
+ - The exact time the message was updated.
+ returned: always
+ type: str
+ sample: "2019-01-25 02:46:55.543953+00:00"
+ accessed_at:
+ description:
+ - Last time the message was sent, or a request was received for this topic.
+ returned: always
+ type: str
+ sample: "2019-01-25 02:46:55.543953+00:00"
+ subscription_count:
+ description:
+ - Number of subscriptions under a topic.
+ returned: always
+ type: int
+ sample: 1
+ count_details:
+ description:
+ - Message count details.
+ returned: always
+ type: complex
+ contains:
+ active_message_count:
+ description:
+ - Number of active messages in the C(queue), C(topic), or C(subscription).
+ returned: always
+ type: int
+ sample: 0
+ dead_letter_message_count:
+ description:
+ - Number of messages that are dead lettered.
+ returned: always
+ type: int
+ sample: 0
+ scheduled_message_count:
+ description:
+ - Number of scheduled messages.
+ returned: always
+ type: int
+ sample: 0
+ transfer_message_count:
+ description:
+ - Number of messages transferred to another C(queue), C(topic), or C(subscription).
+ returned: always
+ type: int
+ sample: 0
+ transfer_dead_letter_message_count:
+ description:
+ - Number of messages transferred into dead letters.
+ returned: always
+ type: int
+ sample: 0
+ support_ordering:
+ description:
+ - Value that indicates whether the C(topic) supports ordering.
+ returned: always
+ type: bool
+ sample: true
+ status:
+ description:
+ - The status of a messaging entity.
+ returned: always
+ type: str
+ sample: active
+ requires_session:
+ description:
+ - A value that indicates whether the C(queue) or C(topic) supports the concept of sessions.
+ returned: always
+ type: bool
+ sample: true
+ requires_duplicate_detection:
+ description:
+ - A value indicating if this C(queue) or C(topic) requires duplicate detection.
+ returned: always
+ type: bool
+ sample: true
+ max_size_in_mb:
+ description:
+ - Maximum size of the C(queue) or C(topic) in megabytes, which is the size of the memory allocated for the C(topic).
+ returned: always
+ type: int
+ sample: 5120
+ max_delivery_count:
+ description:
+ - The maximum delivery count.
+ - A message is automatically deadlettered after this number of deliveries.
+ returned: always
+ type: int
+ sample: 10
+ lock_duration_in_seconds:
+ description:
+ - ISO 8601 timespan duration of a peek-lock.
+ - The amount of time that the message is locked for other receivers.
+ - The maximum value for LockDuration is 5 minutes.
+ returned: always
+ type: int
+ sample: 60
+ forward_to:
+ description:
+ - C(queue) or C(topic) name to forward the messages.
+ returned: always
+ type: str
+ sample: quux
+ forward_dead_lettered_messages_to:
+ description:
+ - C(queue) or C(topic) name to forward the Dead Letter message.
+ returned: always
+ type: str
+ sample: corge
+ enable_partitioning:
+ description:
+ - Value that indicates whether the C(queue) or C(topic) to be partitioned across multiple message brokers is enabled.
+ returned: always
+ type: bool
+ sample: true
+ enable_express:
+ description:
+ - Value that indicates whether Express Entities are enabled.
+ - An express topic holds a message in memory temporarily before writing it to persistent storage.
+ returned: always
+ type: bool
+ sample: true
+ enable_batched_operations:
+ description:
+ - Value that indicates whether server-side batched operations are enabled.
+ returned: always
+ type: bool
+ sample: true
+ duplicate_detection_time_in_seconds:
+ description:
+ - ISO 8601 timeSpan structure that defines the duration of the duplicate detection history.
+ returned: always
+ type: int
+ sample: 600
+ default_message_time_to_live_seconds:
+ description:
+ - ISO 8061 Default message timespan to live value.
+ - This is the duration after which the message expires, starting from when the message is sent to Service Bus.
+ - This is the default value used when TimeToLive is not set on a message itself.
+ returned: always
+ type: int
+ sample: 0
+ dead_lettering_on_message_expiration:
+ description:
+ - A value that indicates whether this C(queue) or C(topic) has dead letter support when a message expires.
+ returned: always
+ type: int
+ sample: 0
+ dead_lettering_on_filter_evaluation_exceptions:
+ description:
+ - Value that indicates whether a subscription has dead letter support on filter evaluation exceptions.
+ returned: always
+ type: int
+ sample: 0
+ auto_delete_on_idle_in_seconds:
+ description:
+ - ISO 8061 timeSpan idle interval after which the queue or topic is automatically deleted.
+ - The minimum duration is 5 minutes.
+ returned: always
+ type: int
+ sample: true
+ size_in_bytes:
+ description:
+ - The size of the C(queue) or C(topic) in bytes.
+ returned: always
+ type: int
+ sample: 0
+ message_count:
+ description:
+ - Number of messages.
+ returned: always
+ type: int
+ sample: 10
+ sas_policies:
+ description:
+ - Dict of SAS policies.
+ - Will not be returned until I(show_sas_policy) set.
+ returned: always
+ type: dict
+ sample: {
+ "testpolicy1": {
+ "id": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/
+ foo/providers/Microsoft.ServiceBus/namespaces/bar/queues/qux/authorizationRules/testpolicy1",
+ "keys": {
+ "key_name": "testpolicy1",
+ "primary_connection_string": "Endpoint=sb://bar.servicebus.windows.net/;
+ SharedAccessKeyName=testpolicy1;SharedAccessKey=XXXXXXXXXXXXXXXXX;EntityPath=qux",
+ "primary_key": "XXXXXXXXXXXXXXXXX",
+ "secondary_connection_string": "Endpoint=sb://bar.servicebus.windows.net/;
+ SharedAccessKeyName=testpolicy1;SharedAccessKey=XXXXXXXXXXXXXXX;EntityPath=qux",
+ "secondary_key": "XXXXXXXXXXXXXXX"
+ },
+ "name": "testpolicy1",
+ "rights": "listen_send",
+ "type": "Microsoft.ServiceBus/Namespaces/Queues/AuthorizationRules"
+ }
+ }
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+from ansible.module_utils._text import to_native
+from datetime import datetime, timedelta
+
+duration_spec_map = dict(
+ default_message_time_to_live='default_message_time_to_live_seconds',
+ duplicate_detection_history_time_window='duplicate_detection_time_in_seconds',
+ auto_delete_on_idle='auto_delete_on_idle_in_seconds',
+ lock_duration='lock_duration_in_seconds'
+)
+
+
+def is_valid_timedelta(value):
+ if value == timedelta(10675199, 10085, 477581):
+ return None
+ return value
+
+
+class AzureRMServiceBusInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ type=dict(type='str', required=True, choices=['namespace', 'topic', 'queue', 'subscription']),
+ namespace=dict(type='str'),
+ topic=dict(type='str'),
+ show_sas_policies=dict(type='bool')
+ )
+
+ required_if = [
+ ('type', 'subscription', ['topic', 'resource_group', 'namespace']),
+ ('type', 'topic', ['resource_group', 'namespace']),
+ ('type', 'queue', ['resource_group', 'namespace'])
+ ]
+
+ self.results = dict(
+ changed=False,
+ servicebuses=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.type = None
+ self.namespace = None
+ self.topic = None
+ self.show_sas_policies = None
+
+ super(AzureRMServiceBusInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ required_if=required_if,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_servicebus_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_servicebus_facts' module has been renamed to 'azure_rm_servicebus_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ response = []
+ if self.name:
+ response = self.get_item()
+ elif self.resource_group:
+ response = self.list_items()
+ else:
+ response = self.list_all_items()
+
+ self.results['servicebuses'] = [self.instance_to_dict(x) for x in response]
+ return self.results
+
+ def instance_to_dict(self, instance):
+ result = dict()
+ instance_type = getattr(self.servicebus_models, 'SB{0}'.format(str.capitalize(self.type)))
+ attribute_map = instance_type._attribute_map
+ for attribute in attribute_map.keys():
+ value = getattr(instance, attribute)
+ if attribute_map[attribute]['type'] == 'duration':
+ if is_valid_timedelta(value):
+ key = duration_spec_map.get(attribute) or attribute
+ result[key] = int(value.total_seconds())
+ elif attribute == 'status':
+ result['status'] = _camel_to_snake(value)
+ elif isinstance(value, self.servicebus_models.MessageCountDetails):
+ result[attribute] = value.as_dict()
+ elif isinstance(value, self.servicebus_models.SBSku):
+ result[attribute] = value.name.lower()
+ elif isinstance(value, datetime):
+ result[attribute] = str(value)
+ elif isinstance(value, str):
+ result[attribute] = to_native(value)
+ elif attribute == 'max_size_in_megabytes':
+ result['max_size_in_mb'] = value
+ else:
+ result[attribute] = value
+ if self.show_sas_policies and self.type != 'subscription':
+ policies = self.get_auth_rules()
+ for name in policies.keys():
+ policies[name]['keys'] = self.get_sas_key(name)
+ result['sas_policies'] = policies
+ if self.namespace:
+ result['namespace'] = self.namespace
+ if self.topic:
+ result['topic'] = self.topic
+ return result
+
+ def _get_client(self):
+ return getattr(self.servicebus_client, '{0}s'.format(self.type))
+
+ def get_item(self):
+ try:
+ client = self._get_client()
+ if self.type == 'namespace':
+ item = client.get(self.resource_group, self.name)
+ return [item] if self.has_tags(item.tags, self.tags) else []
+ elif self.type == 'subscription':
+ return [client.get(self.resource_group, self.namespace, self.topic, self.name)]
+ else:
+ return [client.get(self.resource_group, self.namespace, self.name)]
+ except Exception:
+ pass
+ return []
+
+ def list_items(self):
+ try:
+ client = self._get_client()
+ if self.type == 'namespace':
+ response = client.list_by_resource_group(self.resource_group)
+ return [x for x in response if self.has_tags(x.tags, self.tags)]
+ elif self.type == 'subscription':
+ return client.list_by_topic(self.resource_group, self.namespace, self.topic)
+ else:
+ return client.list_by_namespace(self.resource_group, self.namespace)
+ except CloudError as exc:
+ self.fail("Failed to list items - {0}".format(str(exc)))
+ return []
+
+ def list_all_items(self):
+ self.log("List all items in subscription")
+ try:
+ if self.type != 'namespace':
+ return []
+ response = self.servicebus_client.namespaces.list()
+ return [x for x in response if self.has_tags(x.tags, self.tags)]
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+ return []
+
+ def get_auth_rules(self):
+ result = dict()
+ try:
+ client = self._get_client()
+ if self.type == 'namespace':
+ rules = client.list_authorization_rules(self.resource_group, self.name)
+ else:
+ rules = client.list_authorization_rules(self.resource_group, self.namespace, self.name)
+ while True:
+ rule = rules.next()
+ result[rule.name] = self.policy_to_dict(rule)
+ except StopIteration:
+ pass
+ except Exception as exc:
+ self.fail('Error when getting SAS policies for {0} {1}: {2}'.format(self.type, self.name, exc.message or str(exc)))
+ return result
+
+ def get_sas_key(self, name):
+ try:
+ client = self._get_client()
+ if self.type == 'namespace':
+ return client.list_keys(self.resource_group, self.name, name).as_dict()
+ else:
+ return client.list_keys(self.resource_group, self.namespace, self.name, name).as_dict()
+ except Exception as exc:
+ self.fail('Error when getting SAS policy {0}\'s key - {1}'.format(name, exc.message or str(exc)))
+ return None
+
+ def policy_to_dict(self, rule):
+ result = rule.as_dict()
+ rights = result['rights']
+ if 'Manage' in rights:
+ result['rights'] = 'manage'
+ elif 'Listen' in rights and 'Send' in rights:
+ result['rights'] = 'listen_send'
+ else:
+ result['rights'] = rights[0].lower()
+ return result
+
+
+def main():
+ AzureRMServiceBusInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_servicebus_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_servicebus_info.py
new file mode 100644
index 00000000..fd88d5c9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_servicebus_info.py
@@ -0,0 +1,584 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_servicebus_info
+
+
+short_description: Get servicebus facts
+
+description:
+ - Get facts for a specific servicebus or all servicebus in a resource group or subscription.
+
+options:
+ name:
+ description:
+ - Limit results to a specific servicebus.
+ resource_group:
+ description:
+ - Limit results in a specific resource group.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ namespace:
+ description:
+ - Servicebus namespace name.
+ - A namespace is a scoping container for all messaging components.
+ - Multiple queues and topics can reside within a single namespace, and namespaces often serve as application containers.
+ - Required when I(type=namespace).
+ type:
+ description:
+ - Type of the resource.
+ choices:
+ - namespace
+ - queue
+ - topic
+ - subscription
+ topic:
+ description:
+ - Topic name.
+ - Required when I(type=subscription).
+ show_sas_policies:
+ description:
+ - Whether to show the SAS policies.
+ - Not support when I(type=subscription).
+ - Note if enable this option, the facts module will raise two more HTTP call for each resources, need more network overhead.
+ type: bool
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yuwei Zhou (@yuwzho)
+
+'''
+
+EXAMPLES = '''
+- name: Get all namespaces under a resource group
+ community.azure.azure_rm_servicebus_info:
+ resource_group: myResourceGroup
+ type: namespace
+
+- name: Get all topics under a namespace
+ community.azure.azure_rm_servicebus_info:
+ resource_group: myResourceGroup
+ namespace: bar
+ type: topic
+
+- name: Get a single queue with SAS policies
+ community.azure.azure_rm_servicebus_info:
+ resource_group: myResourceGroup
+ namespace: bar
+ type: queue
+ name: sbqueue
+ show_sas_policies: true
+
+- name: Get all subscriptions under a resource group
+ community.azure.azure_rm_servicebus_info:
+ resource_group: myResourceGroup
+ type: subscription
+ namespace: bar
+ topic: sbtopic
+'''
+RETURN = '''
+servicebuses:
+ description:
+ - List of servicebus dicts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/foo/providers/Microsoft.ServiceBus/
+ namespaces/bar/topics/baz/subscriptions/qux"
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: qux
+ location:
+ description:
+ - The Geo-location where the resource lives.
+ returned: always
+ type: str
+ sample: eastus
+ namespace:
+ description:
+ - I(namespace) name of the C(queue) or C(topic), C(subscription).
+ returned: always
+ type: str
+ sample: bar
+ topic:
+ description:
+ - Topic name of a subscription.
+ returned: always
+ type: str
+ sample: baz
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: {env: sandbox}
+ sku:
+ description:
+ - Properties of namespace's SKU.
+ returned: always
+ type: str
+ sample: Standard
+ provisioning_state:
+ description:
+ - Provisioning state of the namespace.
+ returned: always
+ type: str
+ sample: Succeeded
+ service_bus_endpoint:
+ description:
+ - Endpoint you can use to perform Service Bus operations.
+ returned: always
+ type: str
+ sample: "https://bar.servicebus.windows.net:443/"
+ metric_id:
+ description:
+ - Identifier for Azure Insights metrics of namespace.
+ returned: always
+ type: str
+ sample: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:bar"
+ type:
+ description:
+ - Resource type.
+ - Namespace is a scoping container for all messaging components.
+ - Queue enables you to store messages until the receiving application is available to receive and process them.
+ - Topic and subscriptions enable 1:n relationships between publishers and subscribers.
+ returned: always
+ type: str
+ sample: "Microsoft.ServiceBus/Namespaces/Topics"
+ created_at:
+ description:
+ - Exact time the message was created.
+ returned: always
+ type: str
+ sample: "2019-01-25 02:46:55.543953+00:00"
+ updated_at:
+ description:
+ - The exact time the message was updated.
+ returned: always
+ type: str
+ sample: "2019-01-25 02:46:55.543953+00:00"
+ accessed_at:
+ description:
+ - Last time the message was sent, or a request was received for this topic.
+ returned: always
+ type: str
+ sample: "2019-01-25 02:46:55.543953+00:00"
+ subscription_count:
+ description:
+ - Number of subscriptions under a topic.
+ returned: always
+ type: int
+ sample: 1
+ count_details:
+ description:
+ - Message count details.
+ returned: always
+ type: complex
+ contains:
+ active_message_count:
+ description:
+ - Number of active messages in the C(queue), C(topic), or C(subscription).
+ returned: always
+ type: int
+ sample: 0
+ dead_letter_message_count:
+ description:
+ - Number of messages that are dead lettered.
+ returned: always
+ type: int
+ sample: 0
+ scheduled_message_count:
+ description:
+ - Number of scheduled messages.
+ returned: always
+ type: int
+ sample: 0
+ transfer_message_count:
+ description:
+ - Number of messages transferred to another C(queue), C(topic), or C(subscription).
+ returned: always
+ type: int
+ sample: 0
+ transfer_dead_letter_message_count:
+ description:
+ - Number of messages transferred into dead letters.
+ returned: always
+ type: int
+ sample: 0
+ support_ordering:
+ description:
+ - Value that indicates whether the C(topic) supports ordering.
+ returned: always
+ type: bool
+ sample: true
+ status:
+ description:
+ - The status of a messaging entity.
+ returned: always
+ type: str
+ sample: active
+ requires_session:
+ description:
+ - A value that indicates whether the C(queue) or C(topic) supports the concept of sessions.
+ returned: always
+ type: bool
+ sample: true
+ requires_duplicate_detection:
+ description:
+ - A value indicating if this C(queue) or C(topic) requires duplicate detection.
+ returned: always
+ type: bool
+ sample: true
+ max_size_in_mb:
+ description:
+ - Maximum size of the C(queue) or C(topic) in megabytes, which is the size of the memory allocated for the C(topic).
+ returned: always
+ type: int
+ sample: 5120
+ max_delivery_count:
+ description:
+ - The maximum delivery count.
+ - A message is automatically deadlettered after this number of deliveries.
+ returned: always
+ type: int
+ sample: 10
+ lock_duration_in_seconds:
+ description:
+ - ISO 8601 timespan duration of a peek-lock.
+ - The amount of time that the message is locked for other receivers.
+ - The maximum value for LockDuration is 5 minutes.
+ returned: always
+ type: int
+ sample: 60
+ forward_to:
+ description:
+ - C(queue) or C(topic) name to forward the messages.
+ returned: always
+ type: str
+ sample: quux
+ forward_dead_lettered_messages_to:
+ description:
+ - C(queue) or C(topic) name to forward the Dead Letter message.
+ returned: always
+ type: str
+ sample: corge
+ enable_partitioning:
+ description:
+ - Value that indicates whether the C(queue) or C(topic) to be partitioned across multiple message brokers is enabled.
+ returned: always
+ type: bool
+ sample: true
+ enable_express:
+ description:
+ - Value that indicates whether Express Entities are enabled.
+ - An express topic holds a message in memory temporarily before writing it to persistent storage.
+ returned: always
+ type: bool
+ sample: true
+ enable_batched_operations:
+ description:
+ - Value that indicates whether server-side batched operations are enabled.
+ returned: always
+ type: bool
+ sample: true
+ duplicate_detection_time_in_seconds:
+ description:
+ - ISO 8601 timeSpan structure that defines the duration of the duplicate detection history.
+ returned: always
+ type: int
+ sample: 600
+ default_message_time_to_live_seconds:
+ description:
+ - ISO 8061 Default message timespan to live value.
+ - This is the duration after which the message expires, starting from when the message is sent to Service Bus.
+ - This is the default value used when TimeToLive is not set on a message itself.
+ returned: always
+ type: int
+ sample: 0
+ dead_lettering_on_message_expiration:
+ description:
+ - A value that indicates whether this C(queue) or C(topic) has dead letter support when a message expires.
+ returned: always
+ type: int
+ sample: 0
+ dead_lettering_on_filter_evaluation_exceptions:
+ description:
+ - Value that indicates whether a subscription has dead letter support on filter evaluation exceptions.
+ returned: always
+ type: int
+ sample: 0
+ auto_delete_on_idle_in_seconds:
+ description:
+ - ISO 8061 timeSpan idle interval after which the queue or topic is automatically deleted.
+ - The minimum duration is 5 minutes.
+ returned: always
+ type: int
+ sample: true
+ size_in_bytes:
+ description:
+ - The size of the C(queue) or C(topic) in bytes.
+ returned: always
+ type: int
+ sample: 0
+ message_count:
+ description:
+ - Number of messages.
+ returned: always
+ type: int
+ sample: 10
+ sas_policies:
+ description:
+ - Dict of SAS policies.
+ - Will not be returned until I(show_sas_policy) set.
+ returned: always
+ type: dict
+ sample: {
+ "testpolicy1": {
+ "id": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/
+ foo/providers/Microsoft.ServiceBus/namespaces/bar/queues/qux/authorizationRules/testpolicy1",
+ "keys": {
+ "key_name": "testpolicy1",
+ "primary_connection_string": "Endpoint=sb://bar.servicebus.windows.net/;
+ SharedAccessKeyName=testpolicy1;SharedAccessKey=XXXXXXXXXXXXXXXXX;EntityPath=qux",
+ "primary_key": "XXXXXXXXXXXXXXXXX",
+ "secondary_connection_string": "Endpoint=sb://bar.servicebus.windows.net/;
+ SharedAccessKeyName=testpolicy1;SharedAccessKey=XXXXXXXXXXXXXXX;EntityPath=qux",
+ "secondary_key": "XXXXXXXXXXXXXXX"
+ },
+ "name": "testpolicy1",
+ "rights": "listen_send",
+ "type": "Microsoft.ServiceBus/Namespaces/Queues/AuthorizationRules"
+ }
+ }
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+from ansible.module_utils._text import to_native
+from datetime import datetime, timedelta
+
+duration_spec_map = dict(
+ default_message_time_to_live='default_message_time_to_live_seconds',
+ duplicate_detection_history_time_window='duplicate_detection_time_in_seconds',
+ auto_delete_on_idle='auto_delete_on_idle_in_seconds',
+ lock_duration='lock_duration_in_seconds'
+)
+
+
+def is_valid_timedelta(value):
+ if value == timedelta(10675199, 10085, 477581):
+ return None
+ return value
+
+
+class AzureRMServiceBusInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ type=dict(type='str', required=True, choices=['namespace', 'topic', 'queue', 'subscription']),
+ namespace=dict(type='str'),
+ topic=dict(type='str'),
+ show_sas_policies=dict(type='bool')
+ )
+
+ required_if = [
+ ('type', 'subscription', ['topic', 'resource_group', 'namespace']),
+ ('type', 'topic', ['resource_group', 'namespace']),
+ ('type', 'queue', ['resource_group', 'namespace'])
+ ]
+
+ self.results = dict(
+ changed=False,
+ servicebuses=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.type = None
+ self.namespace = None
+ self.topic = None
+ self.show_sas_policies = None
+
+ super(AzureRMServiceBusInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ required_if=required_if,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_servicebus_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_servicebus_facts' module has been renamed to 'azure_rm_servicebus_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ response = []
+ if self.name:
+ response = self.get_item()
+ elif self.resource_group:
+ response = self.list_items()
+ else:
+ response = self.list_all_items()
+
+ self.results['servicebuses'] = [self.instance_to_dict(x) for x in response]
+ return self.results
+
+ def instance_to_dict(self, instance):
+ result = dict()
+ instance_type = getattr(self.servicebus_models, 'SB{0}'.format(str.capitalize(self.type)))
+ attribute_map = instance_type._attribute_map
+ for attribute in attribute_map.keys():
+ value = getattr(instance, attribute)
+ if attribute_map[attribute]['type'] == 'duration':
+ if is_valid_timedelta(value):
+ key = duration_spec_map.get(attribute) or attribute
+ result[key] = int(value.total_seconds())
+ elif attribute == 'status':
+ result['status'] = _camel_to_snake(value)
+ elif isinstance(value, self.servicebus_models.MessageCountDetails):
+ result[attribute] = value.as_dict()
+ elif isinstance(value, self.servicebus_models.SBSku):
+ result[attribute] = value.name.lower()
+ elif isinstance(value, datetime):
+ result[attribute] = str(value)
+ elif isinstance(value, str):
+ result[attribute] = to_native(value)
+ elif attribute == 'max_size_in_megabytes':
+ result['max_size_in_mb'] = value
+ else:
+ result[attribute] = value
+ if self.show_sas_policies and self.type != 'subscription':
+ policies = self.get_auth_rules()
+ for name in policies.keys():
+ policies[name]['keys'] = self.get_sas_key(name)
+ result['sas_policies'] = policies
+ if self.namespace:
+ result['namespace'] = self.namespace
+ if self.topic:
+ result['topic'] = self.topic
+ return result
+
+ def _get_client(self):
+ return getattr(self.servicebus_client, '{0}s'.format(self.type))
+
+ def get_item(self):
+ try:
+ client = self._get_client()
+ if self.type == 'namespace':
+ item = client.get(self.resource_group, self.name)
+ return [item] if self.has_tags(item.tags, self.tags) else []
+ elif self.type == 'subscription':
+ return [client.get(self.resource_group, self.namespace, self.topic, self.name)]
+ else:
+ return [client.get(self.resource_group, self.namespace, self.name)]
+ except Exception:
+ pass
+ return []
+
+ def list_items(self):
+ try:
+ client = self._get_client()
+ if self.type == 'namespace':
+ response = client.list_by_resource_group(self.resource_group)
+ return [x for x in response if self.has_tags(x.tags, self.tags)]
+ elif self.type == 'subscription':
+ return client.list_by_topic(self.resource_group, self.namespace, self.topic)
+ else:
+ return client.list_by_namespace(self.resource_group, self.namespace)
+ except CloudError as exc:
+ self.fail("Failed to list items - {0}".format(str(exc)))
+ return []
+
+ def list_all_items(self):
+ self.log("List all items in subscription")
+ try:
+ if self.type != 'namespace':
+ return []
+ response = self.servicebus_client.namespaces.list()
+ return [x for x in response if self.has_tags(x.tags, self.tags)]
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+ return []
+
+ def get_auth_rules(self):
+ result = dict()
+ try:
+ client = self._get_client()
+ if self.type == 'namespace':
+ rules = client.list_authorization_rules(self.resource_group, self.name)
+ else:
+ rules = client.list_authorization_rules(self.resource_group, self.namespace, self.name)
+ while True:
+ rule = rules.next()
+ result[rule.name] = self.policy_to_dict(rule)
+ except StopIteration:
+ pass
+ except Exception as exc:
+ self.fail('Error when getting SAS policies for {0} {1}: {2}'.format(self.type, self.name, exc.message or str(exc)))
+ return result
+
+ def get_sas_key(self, name):
+ try:
+ client = self._get_client()
+ if self.type == 'namespace':
+ return client.list_keys(self.resource_group, self.name, name).as_dict()
+ else:
+ return client.list_keys(self.resource_group, self.namespace, self.name, name).as_dict()
+ except Exception as exc:
+ self.fail('Error when getting SAS policy {0}\'s key - {1}'.format(name, exc.message or str(exc)))
+ return None
+
+ def policy_to_dict(self, rule):
+ result = rule.as_dict()
+ rights = result['rights']
+ if 'Manage' in rights:
+ result['rights'] = 'manage'
+ elif 'Listen' in rights and 'Send' in rights:
+ result['rights'] = 'listen_send'
+ else:
+ result['rights'] = rights[0].lower()
+ return result
+
+
+def main():
+ AzureRMServiceBusInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqldatabase_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqldatabase_facts.py
new file mode 100644
index 00000000..95ea60c9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqldatabase_facts.py
@@ -0,0 +1,288 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_sqldatabase_info
+short_description: Get Azure SQL Database facts
+description:
+ - Get facts of Azure SQL Database.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ name:
+ description:
+ - The name of the database.
+ elastic_pool_name:
+ description:
+ - The name of the elastic pool.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of SQL Database
+ community.azure.azure_rm_sqldatabase_info:
+ resource_group: testrg
+ server_name: testserver
+ name: testdb
+
+ - name: List instances of SQL Database
+ community.azure.azure_rm_sqldatabase_info:
+ resource_group: testrg
+ server_name: testserver
+ elastic_pool_name: testep
+
+ - name: List instances of SQL Database
+ community.azure.azure_rm_sqldatabase_info:
+ resource_group: testrg
+ server_name: testserver
+'''
+
+RETURN = '''
+databases:
+ description:
+ - A list of dictionaries containing facts for SQL Database.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.Sql/servers/testserver/databases/testdb
+ name:
+ description:
+ - Database name.
+ returned: always
+ type: str
+ sample: testdb
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: southeastasia
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { 'taga':'aaa', 'tagb':'bbb' }
+ sku:
+ description:
+ - The name and tier of the SKU.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - The name of the SKU.
+ returned: always
+ type: str
+ sample: BC_Gen4_2
+ tier:
+ description:
+ - The SKU tier.
+ returned: always
+ type: str
+ sample: BusinessCritical
+ capacity:
+ description:
+ - The SKU capacity.
+ returned: always
+ type: int
+ sample: 2
+ kind:
+ description:
+ - Kind of database. This is metadata used for the Azure portal experience.
+ returned: always
+ type: str
+ sample: v12.0,user
+ collation:
+ description:
+ - The collation of the database.
+ returned: always
+ type: str
+ sample: SQL_Latin1_General_CP1_CI_AS
+ status:
+ description:
+ - The status of the database.
+ returned: always
+ type: str
+ sample: Online
+ zone_redundant:
+ description:
+ - Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones.
+ returned: always
+ type: bool
+ sample: true
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.sql import SqlManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMSqlDatabaseInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ elastic_pool_name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ self.elastic_pool_name = None
+ self.tags = None
+ super(AzureRMSqlDatabaseInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_sqldatabase_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_sqldatabase_facts' module has been renamed to 'azure_rm_sqldatabase_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ self.results['databases'] = self.get()
+ elif self.elastic_pool_name is not None:
+ self.results['databases'] = self.list_by_elastic_pool()
+ else:
+ self.results['databases'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.sql_client.databases.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ database_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Databases.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_elastic_pool(self):
+ response = None
+ results = []
+ try:
+ response = self.sql_client.databases.list_by_elastic_pool(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ elastic_pool_name=self.elastic_pool_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Databases.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.sql_client.databases.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Databases.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d.get('id', None),
+ 'name': d.get('name', None),
+ 'location': d.get('location', None),
+ 'tags': d.get('tags', None),
+ 'sku': {
+ 'name': d.get('sku', {}).get('name', None),
+ 'tier': d.get('sku', {}).get('tier', None),
+ 'capacity': d.get('sku', {}).get('capacity', None)
+ },
+ 'kind': d.get('kind', None),
+ 'collation': d.get('collation', None),
+ 'status': d.get('status', None),
+ 'zone_redundant': d.get('zone_redundant', None)
+ }
+ return d
+
+
+def main():
+ AzureRMSqlDatabaseInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqldatabase_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqldatabase_info.py
new file mode 100644
index 00000000..95ea60c9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqldatabase_info.py
@@ -0,0 +1,288 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_sqldatabase_info
+short_description: Get Azure SQL Database facts
+description:
+ - Get facts of Azure SQL Database.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ name:
+ description:
+ - The name of the database.
+ elastic_pool_name:
+ description:
+ - The name of the elastic pool.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of SQL Database
+ community.azure.azure_rm_sqldatabase_info:
+ resource_group: testrg
+ server_name: testserver
+ name: testdb
+
+ - name: List instances of SQL Database
+ community.azure.azure_rm_sqldatabase_info:
+ resource_group: testrg
+ server_name: testserver
+ elastic_pool_name: testep
+
+ - name: List instances of SQL Database
+ community.azure.azure_rm_sqldatabase_info:
+ resource_group: testrg
+ server_name: testserver
+'''
+
+RETURN = '''
+databases:
+ description:
+ - A list of dictionaries containing facts for SQL Database.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.Sql/servers/testserver/databases/testdb
+ name:
+ description:
+ - Database name.
+ returned: always
+ type: str
+ sample: testdb
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: southeastasia
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { 'taga':'aaa', 'tagb':'bbb' }
+ sku:
+ description:
+ - The name and tier of the SKU.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - The name of the SKU.
+ returned: always
+ type: str
+ sample: BC_Gen4_2
+ tier:
+ description:
+ - The SKU tier.
+ returned: always
+ type: str
+ sample: BusinessCritical
+ capacity:
+ description:
+ - The SKU capacity.
+ returned: always
+ type: int
+ sample: 2
+ kind:
+ description:
+ - Kind of database. This is metadata used for the Azure portal experience.
+ returned: always
+ type: str
+ sample: v12.0,user
+ collation:
+ description:
+ - The collation of the database.
+ returned: always
+ type: str
+ sample: SQL_Latin1_General_CP1_CI_AS
+ status:
+ description:
+ - The status of the database.
+ returned: always
+ type: str
+ sample: Online
+ zone_redundant:
+ description:
+ - Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones.
+ returned: always
+ type: bool
+ sample: true
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.sql import SqlManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMSqlDatabaseInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ elastic_pool_name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ self.elastic_pool_name = None
+ self.tags = None
+ super(AzureRMSqlDatabaseInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_sqldatabase_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_sqldatabase_facts' module has been renamed to 'azure_rm_sqldatabase_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ self.results['databases'] = self.get()
+ elif self.elastic_pool_name is not None:
+ self.results['databases'] = self.list_by_elastic_pool()
+ else:
+ self.results['databases'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.sql_client.databases.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ database_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Databases.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_elastic_pool(self):
+ response = None
+ results = []
+ try:
+ response = self.sql_client.databases.list_by_elastic_pool(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ elastic_pool_name=self.elastic_pool_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Databases.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def list_by_server(self):
+ response = None
+ results = []
+ try:
+ response = self.sql_client.databases.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Databases.')
+
+ if response is not None:
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d.get('id', None),
+ 'name': d.get('name', None),
+ 'location': d.get('location', None),
+ 'tags': d.get('tags', None),
+ 'sku': {
+ 'name': d.get('sku', {}).get('name', None),
+ 'tier': d.get('sku', {}).get('tier', None),
+ 'capacity': d.get('sku', {}).get('capacity', None)
+ },
+ 'kind': d.get('kind', None),
+ 'collation': d.get('collation', None),
+ 'status': d.get('status', None),
+ 'zone_redundant': d.get('zone_redundant', None)
+ }
+ return d
+
+
+def main():
+ AzureRMSqlDatabaseInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlfirewallrule_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlfirewallrule_facts.py
new file mode 100644
index 00000000..0f0eb37b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlfirewallrule_facts.py
@@ -0,0 +1,215 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_sqlfirewallrule_info
+short_description: Get Azure SQL Firewall Rule facts
+description:
+ - Get facts of SQL Firewall Rule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the server.
+ required: True
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ name:
+ description:
+ - The name of the firewall rule.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of SQL Firewall Rule
+ community.azure.azure_rm_sqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: testserver
+ name: testrule
+
+ - name: List instances of SQL Firewall Rule
+ community.azure.azure_rm_sqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: testserver
+'''
+
+RETURN = '''
+rules:
+ description:
+ - A list of dict results containing the facts for matching SQL firewall rules.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Sql/servers/testser
+ ver/firewallRules/testrule"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: testgroup
+ server_name:
+ description:
+ - SQL server name.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Firewall rule name.
+ returned: always
+ type: str
+ sample: testrule
+ start_ip_address:
+ description:
+ - The start IP address of the firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.1
+ end_ip_address:
+ description:
+ - The end IP address of the firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.5
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.polling import LROPoller
+ from azure.mgmt.sql import SqlManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMSqlFirewallRuleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMSqlFirewallRuleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_sqlfirewallrule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_sqlfirewallrule_facts' module has been renamed to 'azure_rm_sqlfirewallrule_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.name is not None):
+ self.results['rules'] = self.get()
+ else:
+ self.results['rules'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified SQL Firewall Rule.
+
+ :return: deserialized SQL Firewall Ruleinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.sql_client.firewall_rules.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ firewall_rule_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ '''
+ Gets facts of the specified SQL Firewall Rule.
+
+ :return: deserialized SQL Firewall Ruleinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.sql_client.firewall_rules.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d['id'],
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'start_ip_address': d['start_ip_address'],
+ 'end_ip_address': d['end_ip_address']
+ }
+ return d
+
+
+def main():
+ AzureRMSqlFirewallRuleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlfirewallrule_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlfirewallrule_info.py
new file mode 100644
index 00000000..0f0eb37b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlfirewallrule_info.py
@@ -0,0 +1,215 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_sqlfirewallrule_info
+short_description: Get Azure SQL Firewall Rule facts
+description:
+ - Get facts of SQL Firewall Rule.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the server.
+ required: True
+ server_name:
+ description:
+ - The name of the server.
+ required: True
+ name:
+ description:
+ - The name of the firewall rule.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of SQL Firewall Rule
+ community.azure.azure_rm_sqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: testserver
+ name: testrule
+
+ - name: List instances of SQL Firewall Rule
+ community.azure.azure_rm_sqlfirewallrule_info:
+ resource_group: myResourceGroup
+ server_name: testserver
+'''
+
+RETURN = '''
+rules:
+ description:
+ - A list of dict results containing the facts for matching SQL firewall rules.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Sql/servers/testser
+ ver/firewallRules/testrule"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: testgroup
+ server_name:
+ description:
+ - SQL server name.
+ returned: always
+ type: str
+ sample: testserver
+ name:
+ description:
+ - Firewall rule name.
+ returned: always
+ type: str
+ sample: testrule
+ start_ip_address:
+ description:
+ - The start IP address of the firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.1
+ end_ip_address:
+ description:
+ - The end IP address of the firewall rule.
+ returned: always
+ type: str
+ sample: 10.0.0.5
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.polling import LROPoller
+ from azure.mgmt.sql import SqlManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMSqlFirewallRuleInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.server_name = None
+ self.name = None
+ super(AzureRMSqlFirewallRuleInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_sqlfirewallrule_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_sqlfirewallrule_facts' module has been renamed to 'azure_rm_sqlfirewallrule_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.name is not None):
+ self.results['rules'] = self.get()
+ else:
+ self.results['rules'] = self.list_by_server()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified SQL Firewall Rule.
+
+ :return: deserialized SQL Firewall Ruleinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.sql_client.firewall_rules.get(resource_group_name=self.resource_group,
+ server_name=self.server_name,
+ firewall_rule_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ results.append(self.format_item(response))
+
+ return results
+
+ def list_by_server(self):
+ '''
+ Gets facts of the specified SQL Firewall Rule.
+
+ :return: deserialized SQL Firewall Ruleinstance state dictionary
+ '''
+ response = None
+ results = []
+ try:
+ response = self.sql_client.firewall_rules.list_by_server(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for FirewallRules.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_item(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d['id'],
+ 'resource_group': self.resource_group,
+ 'server_name': self.server_name,
+ 'name': d['name'],
+ 'start_ip_address': d['start_ip_address'],
+ 'end_ip_address': d['end_ip_address']
+ }
+ return d
+
+
+def main():
+ AzureRMSqlFirewallRuleInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlserver_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlserver_facts.py
new file mode 100644
index 00000000..98cda6f4
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlserver_facts.py
@@ -0,0 +1,207 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_sqlserver_info
+short_description: Get SQL Server facts
+description:
+ - Get facts of SQL Server.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ server_name:
+ description:
+ - The name of the server.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of SQL Server
+ community.azure.azure_rm_sqlserver_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+
+ - name: List instances of SQL Server
+ community.azure.azure_rm_sqlserver_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+servers:
+ description:
+ - A list of dict results where the key is the name of the SQL Server and the values are the facts for that SQL Server.
+ returned: always
+ type: complex
+ contains:
+ sqlserver_name:
+ description:
+ - The key is the name of the server that the values relate to.
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Sql/servers/sqlcrudtest-4645
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: sqlcrudtest-4645
+ type:
+ description:
+ - Resource type.
+ returned: always
+ type: str
+ sample: Microsoft.Sql/servers
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: japaneast
+ kind:
+ description:
+ - Kind of sql server. This is metadata used for the Azure portal experience.
+ returned: always
+ type: str
+ sample: v12.0
+ version:
+ description:
+ - The version of the server.
+ returned: always
+ type: str
+ sample: 12.0
+ state:
+ description:
+ - The state of the server.
+ returned: always
+ type: str
+ sample: Ready
+ fully_qualified_domain_name:
+ description:
+ - The fully qualified domain name of the server.
+ returned: always
+ type: str
+ sample: fully_qualified_domain_name
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.sql import SqlManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMSqlServerInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False,
+ )
+ self.resource_group = None
+ self.server_name = None
+ super(AzureRMSqlServerInfo, self).__init__(self.module_arg_spec)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_sqlserver_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_sqlserver_facts' module has been renamed to 'azure_rm_sqlserver_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.server_name is not None):
+ self.results['servers'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['servers'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified SQL Server.
+
+ :return: deserialized SQL Serverinstance state dictionary
+ '''
+ response = None
+ results = {}
+ try:
+ response = self.sql_client.servers.get(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Servers.')
+
+ if response is not None:
+ results[response.name] = response.as_dict()
+
+ return results
+
+ def list_by_resource_group(self):
+ '''
+ Gets facts of the specified SQL Server.
+
+ :return: deserialized SQL Serverinstance state dictionary
+ '''
+ response = None
+ results = {}
+ try:
+ response = self.sql_client.servers.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Servers.')
+
+ if response is not None:
+ for item in response:
+ results[item.name] = item.as_dict()
+
+ return results
+
+
+def main():
+ AzureRMSqlServerInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlserver_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlserver_info.py
new file mode 100644
index 00000000..98cda6f4
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_sqlserver_info.py
@@ -0,0 +1,207 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_sqlserver_info
+short_description: Get SQL Server facts
+description:
+ - Get facts of SQL Server.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
+ required: True
+ server_name:
+ description:
+ - The name of the server.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get instance of SQL Server
+ community.azure.azure_rm_sqlserver_info:
+ resource_group: myResourceGroup
+ server_name: server_name
+
+ - name: List instances of SQL Server
+ community.azure.azure_rm_sqlserver_info:
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+servers:
+ description:
+ - A list of dict results where the key is the name of the SQL Server and the values are the facts for that SQL Server.
+ returned: always
+ type: complex
+ contains:
+ sqlserver_name:
+ description:
+ - The key is the name of the server that the values relate to.
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Sql/servers/sqlcrudtest-4645
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: sqlcrudtest-4645
+ type:
+ description:
+ - Resource type.
+ returned: always
+ type: str
+ sample: Microsoft.Sql/servers
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: japaneast
+ kind:
+ description:
+ - Kind of sql server. This is metadata used for the Azure portal experience.
+ returned: always
+ type: str
+ sample: v12.0
+ version:
+ description:
+ - The version of the server.
+ returned: always
+ type: str
+ sample: 12.0
+ state:
+ description:
+ - The state of the server.
+ returned: always
+ type: str
+ sample: Ready
+ fully_qualified_domain_name:
+ description:
+ - The fully qualified domain name of the server.
+ returned: always
+ type: str
+ sample: fully_qualified_domain_name
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.sql import SqlManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMSqlServerInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ server_name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False,
+ )
+ self.resource_group = None
+ self.server_name = None
+ super(AzureRMSqlServerInfo, self).__init__(self.module_arg_spec)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_sqlserver_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_sqlserver_facts' module has been renamed to 'azure_rm_sqlserver_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if (self.resource_group is not None and
+ self.server_name is not None):
+ self.results['servers'] = self.get()
+ elif (self.resource_group is not None):
+ self.results['servers'] = self.list_by_resource_group()
+ return self.results
+
+ def get(self):
+ '''
+ Gets facts of the specified SQL Server.
+
+ :return: deserialized SQL Serverinstance state dictionary
+ '''
+ response = None
+ results = {}
+ try:
+ response = self.sql_client.servers.get(resource_group_name=self.resource_group,
+ server_name=self.server_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Servers.')
+
+ if response is not None:
+ results[response.name] = response.as_dict()
+
+ return results
+
+ def list_by_resource_group(self):
+ '''
+ Gets facts of the specified SQL Server.
+
+ :return: deserialized SQL Serverinstance state dictionary
+ '''
+ response = None
+ results = {}
+ try:
+ response = self.sql_client.servers.list_by_resource_group(resource_group_name=self.resource_group)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Servers.')
+
+ if response is not None:
+ for item in response:
+ results[item.name] = item.as_dict()
+
+ return results
+
+
+def main():
+ AzureRMSqlServerInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_storageaccount_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_storageaccount_facts.py
new file mode 100644
index 00000000..a7e11880
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_storageaccount_facts.py
@@ -0,0 +1,555 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_storageaccount_info
+
+
+short_description: Get storage account facts
+
+description:
+ - Get facts for one storage account or all storage accounts within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific account.
+ resource_group:
+ description:
+ - Limit results to a resource group. Required when filtering by name.
+ aliases:
+ - resource_group_name
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ show_connection_string:
+ description:
+ - Show the connection string for each of the storageaccount's endpoints.
+ - For convenient usage, C(show_connection_string) will also show the access keys for each of the storageaccount's endpoints.
+ - Note that it will cost a lot of time when list all storageaccount rather than query a single one.
+ type: bool
+ show_blob_cors:
+ description:
+ - Show the blob CORS settings for each blob related to the storage account.
+ - Querying all storage accounts will take a long time.
+ type: bool
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one account
+ community.azure.azure_rm_storageaccount_info:
+ resource_group: myResourceGroup
+ name: clh0002
+
+ - name: Get facts for all accounts in a resource group
+ community.azure.azure_rm_storageaccount_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts for all accounts by tags
+ community.azure.azure_rm_storageaccount_info:
+ tags:
+ - testing
+ - foo:bar
+'''
+
+RETURN = '''
+azure_storageaccounts:
+ description:
+ - List of storage account dicts.
+ returned: always
+ type: list
+ example: [{
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/myResourceGroups/testing/providers/Microsoft.Storage/storageAccounts/testaccount001",
+ "location": "eastus2",
+ "name": "testaccount001",
+ "properties": {
+ "accountType": "Standard_LRS",
+ "creationTime": "2016-03-28T02:46:58.290113Z",
+ "primaryEndpoints": {
+ "blob": "https://testaccount001.blob.core.windows.net/",
+ "file": "https://testaccount001.file.core.windows.net/",
+ "queue": "https://testaccount001.queue.core.windows.net/",
+ "table": "https://testaccount001.table.core.windows.net/"
+ },
+ "primaryLocation": "eastus2",
+ "provisioningState": "Succeeded",
+ "statusOfPrimary": "Available"
+ },
+ "tags": {},
+ "type": "Microsoft.Storage/storageAccounts"
+ }]
+storageaccounts:
+ description:
+ - List of storage account dicts in resource module's parameter format.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/t
+ estaccount001"
+ name:
+ description:
+ - Name of the storage account to update or create.
+ returned: always
+ type: str
+ sample: testaccount001
+ location:
+ description:
+ - Valid Azure location. Defaults to location of the resource group.
+ returned: always
+ type: str
+ sample: eastus
+ account_type:
+ description:
+ - Type of storage account.
+ - C(Standard_ZRS) and C(Premium_LRS) accounts cannot be changed to other account types.
+ - Other account types cannot be changed to C(Standard_ZRS) or C(Premium_LRS).
+ returned: always
+ type: str
+ sample: Standard_ZRS
+ custom_domain:
+ description:
+ - User domain assigned to the storage account.
+ - Must be a dictionary with I(name) and I(use_sub_domain) keys where I(name) is the CNAME source.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - CNAME source.
+ returned: always
+ type: str
+ sample: testaccount
+ use_sub_domain:
+ description:
+ - Whether to use sub domain.
+ returned: always
+ type: bool
+ sample: true
+ kind:
+ description:
+ - The kind of storage.
+ returned: always
+ type: str
+ sample: Storage
+ access_tier:
+ description:
+ - The access tier for this storage account.
+ returned: always
+ type: str
+ sample: Hot
+ https_only:
+ description:
+ - Allows https traffic only to storage service when set to C(true).
+ returned: always
+ type: bool
+ sample: false
+ provisioning_state:
+ description:
+ - The status of the storage account at the time the operation was called.
+ - Possible values include C(Creating), C(ResolvingDNS), C(Succeeded).
+ returned: always
+ type: str
+ sample: Succeeded
+ secondary_location:
+ description:
+ - The location of the geo-replicated secondary for the storage account.
+ - Only available if the I(account_type=Standard_GRS) or I(account_type=Standard_RAGRS).
+ returned: always
+ type: str
+ sample: westus
+ status_of_primary:
+ description:
+ - Status of the primary location of the storage account; either C(available) or C(unavailable).
+ returned: always
+ type: str
+ sample: available
+ status_of_secondary:
+ description:
+ - Status of the secondary location of the storage account; either C(available) or C(unavailable).
+ returned: always
+ type: str
+ sample: available
+ primary_location:
+ description:
+ - The location of the primary data center for the storage account.
+ returned: always
+ type: str
+ sample: eastus
+ primary_endpoints:
+ description:
+ - URLs to retrieve a public I(blob), I(queue), or I(table) object.
+ - Note that C(Standard_ZRS) and C(Premium_LRS) accounts only return the blob endpoint.
+ returned: always
+ type: complex
+ contains:
+ blob:
+ description:
+ - The primary blob endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The primary blob endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.blob.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the blob endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;BlobEndpoint=X"
+ queue:
+ description:
+ - The primary queue endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The primary queue endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.queue.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the queue endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;QueueEndpoint=X"
+ table:
+ description:
+ - The primary table endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The primary table endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.table.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the table endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;TableEndpoint=X"
+ key:
+ description:
+ - The account key for the primary_endpoints
+ returned: always
+ type: str
+ sample: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ secondary_endpoints:
+ description:
+ - The URLs to retrieve a public I(blob), I(queue), or I(table) object from the secondary location.
+ - Only available if the SKU I(name=Standard_RAGRS).
+ returned: always
+ type: complex
+ contains:
+ blob:
+ description:
+ - The secondary blob endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The secondary blob endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.blob.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the blob endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;BlobEndpoint=X"
+ queue:
+ description:
+ - The secondary queue endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The secondary queue endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.queue.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the queue endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;QueueEndpoint=X"
+ table:
+ description:
+ - The secondary table endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The secondary table endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.table.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the table endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;TableEndpoint=X"
+ key:
+ description:
+ - The account key for the secondary_endpoints
+ sample: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { "tag1": "abc" }
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils._text import to_native
+
+
+AZURE_OBJECT_CLASS = 'StorageAccount'
+
+
+class AzureRMStorageAccountInfo(AzureRMModuleBase):
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str', aliases=['resource_group_name']),
+ tags=dict(type='list'),
+ show_connection_string=dict(type='bool'),
+ show_blob_cors=dict(type='bool')
+ )
+
+ self.results = dict(
+ changed=False,
+ storageaccounts=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.show_connection_string = None
+ self.show_blob_cors = None
+
+ super(AzureRMStorageAccountInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_storageaccount_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_storageaccount_facts' module has been renamed to 'azure_rm_storageaccount_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ results = []
+ if self.name:
+ results = self.get_account()
+ elif self.resource_group:
+ results = self.list_resource_group()
+ else:
+ results = self.list_all()
+
+ filtered = self.filter_tag(results)
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_storageaccounts': self.serialize(filtered),
+ 'storageaccounts': self.format_to_dict(filtered),
+ }
+ self.results['storageaccounts'] = self.format_to_dict(filtered)
+ return self.results
+
+ def get_account(self):
+ self.log('Get properties for account {0}'.format(self.name))
+ account = None
+ try:
+ account = self.storage_client.storage_accounts.get_properties(self.resource_group, self.name)
+ return [account]
+ except CloudError:
+ pass
+ return []
+
+ def list_resource_group(self):
+ self.log('List items')
+ try:
+ response = self.storage_client.storage_accounts.list_by_resource_group(self.resource_group)
+ except Exception as exc:
+ self.fail("Error listing for resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ return response
+
+ def list_all(self):
+ self.log('List all items')
+ try:
+ response = self.storage_client.storage_accounts.list()
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ return response
+
+ def filter_tag(self, raw):
+ return [item for item in raw if self.has_tags(item.tags, self.tags)]
+
+ def serialize(self, raw):
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raw]
+
+ def format_to_dict(self, raw):
+ return [self.account_obj_to_dict(item) for item in raw]
+
+ def account_obj_to_dict(self, account_obj, blob_service_props=None):
+ account_dict = dict(
+ id=account_obj.id,
+ name=account_obj.name,
+ location=account_obj.location,
+ access_tier=(account_obj.access_tier.value
+ if account_obj.access_tier is not None else None),
+ account_type=account_obj.sku.name.value,
+ kind=account_obj.kind.value if account_obj.kind else None,
+ provisioning_state=account_obj.provisioning_state.value,
+ secondary_location=account_obj.secondary_location,
+ status_of_primary=(account_obj.status_of_primary.value
+ if account_obj.status_of_primary is not None else None),
+ status_of_secondary=(account_obj.status_of_secondary.value
+ if account_obj.status_of_secondary is not None else None),
+ primary_location=account_obj.primary_location,
+ https_only=account_obj.enable_https_traffic_only
+ )
+
+ id_dict = self.parse_resource_to_dict(account_obj.id)
+ account_dict['resource_group'] = id_dict.get('resource_group')
+ account_key = self.get_connectionstring(account_dict['resource_group'], account_dict['name'])
+ account_dict['custom_domain'] = None
+ if account_obj.custom_domain:
+ account_dict['custom_domain'] = dict(
+ name=account_obj.custom_domain.name,
+ use_sub_domain=account_obj.custom_domain.use_sub_domain
+ )
+
+ account_dict['primary_endpoints'] = None
+ if account_obj.primary_endpoints:
+ account_dict['primary_endpoints'] = dict(
+ blob=self.format_endpoint_dict(account_dict['name'], account_key[0], account_obj.primary_endpoints.blob, 'blob'),
+ queue=self.format_endpoint_dict(account_dict['name'], account_key[0], account_obj.primary_endpoints.queue, 'queue'),
+ table=self.format_endpoint_dict(account_dict['name'], account_key[0], account_obj.primary_endpoints.table, 'table')
+ )
+ if account_key[0]:
+ account_dict['primary_endpoints']['key'] = '{0}'.format(account_key[0])
+ account_dict['secondary_endpoints'] = None
+ if account_obj.secondary_endpoints:
+ account_dict['secondary_endpoints'] = dict(
+ blob=self.format_endpoint_dict(account_dict['name'], account_key[1], account_obj.primary_endpoints.blob, 'blob'),
+ queue=self.format_endpoint_dict(account_dict['name'], account_key[1], account_obj.primary_endpoints.queue, 'queue'),
+ table=self.format_endpoint_dict(account_dict['name'], account_key[1], account_obj.primary_endpoints.table, 'table'),
+ )
+ if account_key[1]:
+ account_dict['secondary_endpoints']['key'] = '{0}'.format(account_key[1])
+ account_dict['tags'] = None
+ if account_obj.tags:
+ account_dict['tags'] = account_obj.tags
+ blob_service_props = self.get_blob_service_props(account_dict['resource_group'], account_dict['name'])
+ if blob_service_props and blob_service_props.cors and blob_service_props.cors.cors_rules:
+ account_dict['blob_cors'] = [dict(
+ allowed_origins=to_native(x.allowed_origins),
+ allowed_methods=to_native(x.allowed_methods),
+ max_age_in_seconds=x.max_age_in_seconds,
+ exposed_headers=to_native(x.exposed_headers),
+ allowed_headers=to_native(x.allowed_headers)
+ ) for x in blob_service_props.cors.cors_rules]
+ return account_dict
+
+ def format_endpoint_dict(self, name, key, endpoint, storagetype, protocol='https'):
+ result = dict(endpoint=endpoint)
+ if key:
+ result['connectionstring'] = 'DefaultEndpointsProtocol={0};EndpointSuffix={1};AccountName={2};AccountKey={3};{4}Endpoint={5}'.format(
+ protocol,
+ self._cloud_environment.suffixes.storage_endpoint,
+ name,
+ key,
+ str.title(storagetype),
+ endpoint)
+ return result
+
+ def get_blob_service_props(self, resource_group, name):
+ if not self.show_blob_cors:
+ return None
+ try:
+ blob_service_props = self.storage_client.blob_services.get_service_properties(resource_group, name)
+ return blob_service_props
+ except Exception:
+ pass
+ return None
+
+ def get_connectionstring(self, resource_group, name):
+ keys = ['', '']
+ if not self.show_connection_string:
+ return keys
+ try:
+ cred = self.storage_client.storage_accounts.list_keys(resource_group, name)
+ # get the following try catch from CLI
+ try:
+ keys = [cred.keys[0].value, cred.keys[1].value]
+ except AttributeError:
+ keys = [cred.key1, cred.key2]
+ except Exception:
+ pass
+ return keys
+
+
+def main():
+ AzureRMStorageAccountInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_storageaccount_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_storageaccount_info.py
new file mode 100644
index 00000000..a7e11880
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_storageaccount_info.py
@@ -0,0 +1,555 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_storageaccount_info
+
+
+short_description: Get storage account facts
+
+description:
+ - Get facts for one storage account or all storage accounts within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific account.
+ resource_group:
+ description:
+ - Limit results to a resource group. Required when filtering by name.
+ aliases:
+ - resource_group_name
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+ show_connection_string:
+ description:
+ - Show the connection string for each of the storageaccount's endpoints.
+ - For convenient usage, C(show_connection_string) will also show the access keys for each of the storageaccount's endpoints.
+ - Note that it will cost a lot of time when list all storageaccount rather than query a single one.
+ type: bool
+ show_blob_cors:
+ description:
+ - Show the blob CORS settings for each blob related to the storage account.
+ - Querying all storage accounts will take a long time.
+ type: bool
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one account
+ community.azure.azure_rm_storageaccount_info:
+ resource_group: myResourceGroup
+ name: clh0002
+
+ - name: Get facts for all accounts in a resource group
+ community.azure.azure_rm_storageaccount_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts for all accounts by tags
+ community.azure.azure_rm_storageaccount_info:
+ tags:
+ - testing
+ - foo:bar
+'''
+
+RETURN = '''
+azure_storageaccounts:
+ description:
+ - List of storage account dicts.
+ returned: always
+ type: list
+ example: [{
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/myResourceGroups/testing/providers/Microsoft.Storage/storageAccounts/testaccount001",
+ "location": "eastus2",
+ "name": "testaccount001",
+ "properties": {
+ "accountType": "Standard_LRS",
+ "creationTime": "2016-03-28T02:46:58.290113Z",
+ "primaryEndpoints": {
+ "blob": "https://testaccount001.blob.core.windows.net/",
+ "file": "https://testaccount001.file.core.windows.net/",
+ "queue": "https://testaccount001.queue.core.windows.net/",
+ "table": "https://testaccount001.table.core.windows.net/"
+ },
+ "primaryLocation": "eastus2",
+ "provisioningState": "Succeeded",
+ "statusOfPrimary": "Available"
+ },
+ "tags": {},
+ "type": "Microsoft.Storage/storageAccounts"
+ }]
+storageaccounts:
+ description:
+ - List of storage account dicts in resource module's parameter format.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/t
+ estaccount001"
+ name:
+ description:
+ - Name of the storage account to update or create.
+ returned: always
+ type: str
+ sample: testaccount001
+ location:
+ description:
+ - Valid Azure location. Defaults to location of the resource group.
+ returned: always
+ type: str
+ sample: eastus
+ account_type:
+ description:
+ - Type of storage account.
+ - C(Standard_ZRS) and C(Premium_LRS) accounts cannot be changed to other account types.
+ - Other account types cannot be changed to C(Standard_ZRS) or C(Premium_LRS).
+ returned: always
+ type: str
+ sample: Standard_ZRS
+ custom_domain:
+ description:
+ - User domain assigned to the storage account.
+ - Must be a dictionary with I(name) and I(use_sub_domain) keys where I(name) is the CNAME source.
+ returned: always
+ type: complex
+ contains:
+ name:
+ description:
+ - CNAME source.
+ returned: always
+ type: str
+ sample: testaccount
+ use_sub_domain:
+ description:
+ - Whether to use sub domain.
+ returned: always
+ type: bool
+ sample: true
+ kind:
+ description:
+ - The kind of storage.
+ returned: always
+ type: str
+ sample: Storage
+ access_tier:
+ description:
+ - The access tier for this storage account.
+ returned: always
+ type: str
+ sample: Hot
+ https_only:
+ description:
+ - Allows https traffic only to storage service when set to C(true).
+ returned: always
+ type: bool
+ sample: false
+ provisioning_state:
+ description:
+ - The status of the storage account at the time the operation was called.
+ - Possible values include C(Creating), C(ResolvingDNS), C(Succeeded).
+ returned: always
+ type: str
+ sample: Succeeded
+ secondary_location:
+ description:
+ - The location of the geo-replicated secondary for the storage account.
+ - Only available if the I(account_type=Standard_GRS) or I(account_type=Standard_RAGRS).
+ returned: always
+ type: str
+ sample: westus
+ status_of_primary:
+ description:
+ - Status of the primary location of the storage account; either C(available) or C(unavailable).
+ returned: always
+ type: str
+ sample: available
+ status_of_secondary:
+ description:
+ - Status of the secondary location of the storage account; either C(available) or C(unavailable).
+ returned: always
+ type: str
+ sample: available
+ primary_location:
+ description:
+ - The location of the primary data center for the storage account.
+ returned: always
+ type: str
+ sample: eastus
+ primary_endpoints:
+ description:
+ - URLs to retrieve a public I(blob), I(queue), or I(table) object.
+ - Note that C(Standard_ZRS) and C(Premium_LRS) accounts only return the blob endpoint.
+ returned: always
+ type: complex
+ contains:
+ blob:
+ description:
+ - The primary blob endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The primary blob endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.blob.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the blob endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;BlobEndpoint=X"
+ queue:
+ description:
+ - The primary queue endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The primary queue endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.queue.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the queue endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;QueueEndpoint=X"
+ table:
+ description:
+ - The primary table endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The primary table endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.table.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the table endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;TableEndpoint=X"
+ key:
+ description:
+ - The account key for the primary_endpoints
+ returned: always
+ type: str
+ sample: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ secondary_endpoints:
+ description:
+ - The URLs to retrieve a public I(blob), I(queue), or I(table) object from the secondary location.
+ - Only available if the SKU I(name=Standard_RAGRS).
+ returned: always
+ type: complex
+ contains:
+ blob:
+ description:
+ - The secondary blob endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The secondary blob endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.blob.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the blob endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;BlobEndpoint=X"
+ queue:
+ description:
+ - The secondary queue endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The secondary queue endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.queue.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the queue endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;QueueEndpoint=X"
+ table:
+ description:
+ - The secondary table endpoint and connection string.
+ returned: always
+ type: complex
+ contains:
+ endpoint:
+ description:
+ - The secondary table endpoint.
+ returned: always
+ type: str
+ sample: "https://testaccount001.table.core.windows.net/"
+ connectionstring:
+ description:
+ - Connectionstring of the table endpoint.
+ returned: always
+ type: str
+ sample: "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=X;AccountKey=X;TableEndpoint=X"
+ key:
+ description:
+ - The account key for the secondary_endpoints
+ sample: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { "tag1": "abc" }
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils._text import to_native
+
+
+AZURE_OBJECT_CLASS = 'StorageAccount'
+
+
+class AzureRMStorageAccountInfo(AzureRMModuleBase):
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str', aliases=['resource_group_name']),
+ tags=dict(type='list'),
+ show_connection_string=dict(type='bool'),
+ show_blob_cors=dict(type='bool')
+ )
+
+ self.results = dict(
+ changed=False,
+ storageaccounts=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.show_connection_string = None
+ self.show_blob_cors = None
+
+ super(AzureRMStorageAccountInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_storageaccount_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_storageaccount_facts' module has been renamed to 'azure_rm_storageaccount_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ results = []
+ if self.name:
+ results = self.get_account()
+ elif self.resource_group:
+ results = self.list_resource_group()
+ else:
+ results = self.list_all()
+
+ filtered = self.filter_tag(results)
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_storageaccounts': self.serialize(filtered),
+ 'storageaccounts': self.format_to_dict(filtered),
+ }
+ self.results['storageaccounts'] = self.format_to_dict(filtered)
+ return self.results
+
+ def get_account(self):
+ self.log('Get properties for account {0}'.format(self.name))
+ account = None
+ try:
+ account = self.storage_client.storage_accounts.get_properties(self.resource_group, self.name)
+ return [account]
+ except CloudError:
+ pass
+ return []
+
+ def list_resource_group(self):
+ self.log('List items')
+ try:
+ response = self.storage_client.storage_accounts.list_by_resource_group(self.resource_group)
+ except Exception as exc:
+ self.fail("Error listing for resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ return response
+
+ def list_all(self):
+ self.log('List all items')
+ try:
+ response = self.storage_client.storage_accounts.list()
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ return response
+
+ def filter_tag(self, raw):
+ return [item for item in raw if self.has_tags(item.tags, self.tags)]
+
+ def serialize(self, raw):
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raw]
+
+ def format_to_dict(self, raw):
+ return [self.account_obj_to_dict(item) for item in raw]
+
+ def account_obj_to_dict(self, account_obj, blob_service_props=None):
+ account_dict = dict(
+ id=account_obj.id,
+ name=account_obj.name,
+ location=account_obj.location,
+ access_tier=(account_obj.access_tier.value
+ if account_obj.access_tier is not None else None),
+ account_type=account_obj.sku.name.value,
+ kind=account_obj.kind.value if account_obj.kind else None,
+ provisioning_state=account_obj.provisioning_state.value,
+ secondary_location=account_obj.secondary_location,
+ status_of_primary=(account_obj.status_of_primary.value
+ if account_obj.status_of_primary is not None else None),
+ status_of_secondary=(account_obj.status_of_secondary.value
+ if account_obj.status_of_secondary is not None else None),
+ primary_location=account_obj.primary_location,
+ https_only=account_obj.enable_https_traffic_only
+ )
+
+ id_dict = self.parse_resource_to_dict(account_obj.id)
+ account_dict['resource_group'] = id_dict.get('resource_group')
+ account_key = self.get_connectionstring(account_dict['resource_group'], account_dict['name'])
+ account_dict['custom_domain'] = None
+ if account_obj.custom_domain:
+ account_dict['custom_domain'] = dict(
+ name=account_obj.custom_domain.name,
+ use_sub_domain=account_obj.custom_domain.use_sub_domain
+ )
+
+ account_dict['primary_endpoints'] = None
+ if account_obj.primary_endpoints:
+ account_dict['primary_endpoints'] = dict(
+ blob=self.format_endpoint_dict(account_dict['name'], account_key[0], account_obj.primary_endpoints.blob, 'blob'),
+ queue=self.format_endpoint_dict(account_dict['name'], account_key[0], account_obj.primary_endpoints.queue, 'queue'),
+ table=self.format_endpoint_dict(account_dict['name'], account_key[0], account_obj.primary_endpoints.table, 'table')
+ )
+ if account_key[0]:
+ account_dict['primary_endpoints']['key'] = '{0}'.format(account_key[0])
+ account_dict['secondary_endpoints'] = None
+ if account_obj.secondary_endpoints:
+ account_dict['secondary_endpoints'] = dict(
+ blob=self.format_endpoint_dict(account_dict['name'], account_key[1], account_obj.primary_endpoints.blob, 'blob'),
+ queue=self.format_endpoint_dict(account_dict['name'], account_key[1], account_obj.primary_endpoints.queue, 'queue'),
+ table=self.format_endpoint_dict(account_dict['name'], account_key[1], account_obj.primary_endpoints.table, 'table'),
+ )
+ if account_key[1]:
+ account_dict['secondary_endpoints']['key'] = '{0}'.format(account_key[1])
+ account_dict['tags'] = None
+ if account_obj.tags:
+ account_dict['tags'] = account_obj.tags
+ blob_service_props = self.get_blob_service_props(account_dict['resource_group'], account_dict['name'])
+ if blob_service_props and blob_service_props.cors and blob_service_props.cors.cors_rules:
+ account_dict['blob_cors'] = [dict(
+ allowed_origins=to_native(x.allowed_origins),
+ allowed_methods=to_native(x.allowed_methods),
+ max_age_in_seconds=x.max_age_in_seconds,
+ exposed_headers=to_native(x.exposed_headers),
+ allowed_headers=to_native(x.allowed_headers)
+ ) for x in blob_service_props.cors.cors_rules]
+ return account_dict
+
+ def format_endpoint_dict(self, name, key, endpoint, storagetype, protocol='https'):
+ result = dict(endpoint=endpoint)
+ if key:
+ result['connectionstring'] = 'DefaultEndpointsProtocol={0};EndpointSuffix={1};AccountName={2};AccountKey={3};{4}Endpoint={5}'.format(
+ protocol,
+ self._cloud_environment.suffixes.storage_endpoint,
+ name,
+ key,
+ str.title(storagetype),
+ endpoint)
+ return result
+
+ def get_blob_service_props(self, resource_group, name):
+ if not self.show_blob_cors:
+ return None
+ try:
+ blob_service_props = self.storage_client.blob_services.get_service_properties(resource_group, name)
+ return blob_service_props
+ except Exception:
+ pass
+ return None
+
+ def get_connectionstring(self, resource_group, name):
+ keys = ['', '']
+ if not self.show_connection_string:
+ return keys
+ try:
+ cred = self.storage_client.storage_accounts.list_keys(resource_group, name)
+ # get the following try catch from CLI
+ try:
+ keys = [cred.keys[0].value, cred.keys[1].value]
+ except AttributeError:
+ keys = [cred.key1, cred.key2]
+ except Exception:
+ pass
+ return keys
+
+
+def main():
+ AzureRMStorageAccountInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_subnet_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_subnet_facts.py
new file mode 100644
index 00000000..dd4c3608
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_subnet_facts.py
@@ -0,0 +1,246 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_subnet_info
+short_description: Get Azure Subnet facts
+description:
+ - Get facts of Azure Subnet.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ virtual_network_name:
+ description:
+ - The name of the virtual network.
+ required: True
+ name:
+ description:
+ - The name of the subnet.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts of specific subnet
+ community.azure.azure_rm_subnet_info:
+ resource_group: myResourceGroup
+ virtual_network_name: myVirtualNetwork
+ name: mySubnet
+
+ - name: List facts for all subnets in virtual network
+ community.azure.azure_rm_subnet_info:
+ resource_group: myResourceGroup
+ virtual_network_name: myVirtualNetwork
+ name: mySubnet
+'''
+
+RETURN = '''
+subnets:
+ description:
+ - A list of dictionaries containing facts for subnet.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Subnet resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/my
+ VirtualNetwork/subnets/mySubnet"
+ resource_group:
+ description:
+ - Name of resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ virtual_network_name:
+ description:
+ - Name of the containing virtual network.
+ returned: always
+ type: str
+ sample: myVirtualNetwork
+ name:
+ description:
+ - Name of the subnet.
+ returned: always
+ type: str
+ sample: mySubnet
+ address_prefix_cidr:
+ description:
+ - CIDR defining the IPv4 address space of the subnet.
+ returned: always
+ type: str
+ sample: "10.1.0.0/16"
+ route_table:
+ description:
+ - Associated route table ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/routeTables/myRouteTable
+ security_group:
+ description:
+ - Associated security group ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGr
+ oups/myNsg"
+ service_endpoints:
+ description:
+ - List of service endpoints.
+ type: list
+ returned: when available
+ contains:
+ service:
+ description:
+ - The type of the endpoint service.
+ returned: always
+ type: str
+ sample: Microsoft.Sql
+ locations:
+ description:
+ - A list of location names.
+ type: list
+ returned: always
+ sample: [ 'eastus', 'westus' ]
+ provisioning_state:
+ description:
+ - Provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+ provisioning_state:
+ description:
+ - Provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.network import NetworkManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMSubnetInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ virtual_network_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.virtual_network_name = None
+ self.name = None
+ super(AzureRMSubnetInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_subnet_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_subnet_facts' module has been renamed to 'azure_rm_subnet_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ self.results['subnets'] = self.get()
+ else:
+ self.results['subnets'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.network_client.subnets.get(resource_group_name=self.resource_group,
+ virtual_network_name=self.virtual_network_name,
+ subnet_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Subnet.')
+
+ if response is not None:
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.network_client.subnets.get(resource_group_name=self.resource_group,
+ virtual_network_name=self.virtual_network_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Subnet.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'virtual_network_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'name': d.get('name'),
+ 'id': d.get('id'),
+ 'address_prefix_cidr': d.get('address_prefix'),
+ 'route_table': d.get('route_table', {}).get('id'),
+ 'security_group': d.get('network_security_group', {}).get('id'),
+ 'provisioning_state': d.get('provisioning_state'),
+ 'service_endpoints': d.get('service_endpoints')
+ }
+ return d
+
+
+def main():
+ AzureRMSubnetInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_subnet_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_subnet_info.py
new file mode 100644
index 00000000..dd4c3608
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_subnet_info.py
@@ -0,0 +1,246 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_subnet_info
+short_description: Get Azure Subnet facts
+description:
+ - Get facts of Azure Subnet.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ virtual_network_name:
+ description:
+ - The name of the virtual network.
+ required: True
+ name:
+ description:
+ - The name of the subnet.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts of specific subnet
+ community.azure.azure_rm_subnet_info:
+ resource_group: myResourceGroup
+ virtual_network_name: myVirtualNetwork
+ name: mySubnet
+
+ - name: List facts for all subnets in virtual network
+ community.azure.azure_rm_subnet_info:
+ resource_group: myResourceGroup
+ virtual_network_name: myVirtualNetwork
+ name: mySubnet
+'''
+
+RETURN = '''
+subnets:
+ description:
+ - A list of dictionaries containing facts for subnet.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Subnet resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/my
+ VirtualNetwork/subnets/mySubnet"
+ resource_group:
+ description:
+ - Name of resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ virtual_network_name:
+ description:
+ - Name of the containing virtual network.
+ returned: always
+ type: str
+ sample: myVirtualNetwork
+ name:
+ description:
+ - Name of the subnet.
+ returned: always
+ type: str
+ sample: mySubnet
+ address_prefix_cidr:
+ description:
+ - CIDR defining the IPv4 address space of the subnet.
+ returned: always
+ type: str
+ sample: "10.1.0.0/16"
+ route_table:
+ description:
+ - Associated route table ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/routeTables/myRouteTable
+ security_group:
+ description:
+ - Associated security group ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkSecurityGr
+ oups/myNsg"
+ service_endpoints:
+ description:
+ - List of service endpoints.
+ type: list
+ returned: when available
+ contains:
+ service:
+ description:
+ - The type of the endpoint service.
+ returned: always
+ type: str
+ sample: Microsoft.Sql
+ locations:
+ description:
+ - A list of location names.
+ type: list
+ returned: always
+ sample: [ 'eastus', 'westus' ]
+ provisioning_state:
+ description:
+ - Provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+ provisioning_state:
+ description:
+ - Provisioning state.
+ returned: always
+ type: str
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.network import NetworkManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMSubnetInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ virtual_network_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.virtual_network_name = None
+ self.name = None
+ super(AzureRMSubnetInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_subnet_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_subnet_facts' module has been renamed to 'azure_rm_subnet_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ self.results['subnets'] = self.get()
+ else:
+ self.results['subnets'] = self.list()
+
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.network_client.subnets.get(resource_group_name=self.resource_group,
+ virtual_network_name=self.virtual_network_name,
+ subnet_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Subnet.')
+
+ if response is not None:
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ response = None
+ results = []
+ try:
+ response = self.network_client.subnets.get(resource_group_name=self.resource_group,
+ virtual_network_name=self.virtual_network_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.fail('Could not get facts for Subnet.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_item(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'resource_group': self.resource_group,
+ 'virtual_network_name': self.parse_resource_to_dict(d.get('id')).get('name'),
+ 'name': d.get('name'),
+ 'id': d.get('id'),
+ 'address_prefix_cidr': d.get('address_prefix'),
+ 'route_table': d.get('route_table', {}).get('id'),
+ 'security_group': d.get('network_security_group', {}).get('id'),
+ 'provisioning_state': d.get('provisioning_state'),
+ 'service_endpoints': d.get('service_endpoints')
+ }
+ return d
+
+
+def main():
+ AzureRMSubnetInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerendpoint_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerendpoint_facts.py
new file mode 100644
index 00000000..63a32491
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerendpoint_facts.py
@@ -0,0 +1,311 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Hai Cao, <t-haicao@microsoft.com>, Yunge Zhu <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_trafficmanagerendpoint_info
+
+
+short_description: Get Azure Traffic Manager endpoint facts
+
+description:
+ - Get facts for a specific Traffic Manager endpoints or all endpoints in a Traffic Manager profile.
+
+options:
+ name:
+ description:
+ - Limit results to a specific Traffic Manager endpoint.
+ resource_group:
+ description:
+ - The resource group to search for the desired Traffic Manager profile.
+ required: True
+ profile_name:
+ description:
+ - Name of Traffic Manager Profile.
+ required: True
+ type:
+ description:
+ - Type of endpoint.
+ choices:
+ - azure_endpoints
+ - external_endpoints
+ - nested_endpoints
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Hai Cao (@caohai)
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get endpoints facts of a Traffic Manager profile
+ community.azure.azure_rm_trafficmanagerendpoint_info:
+ resource_group: myResourceGroup
+ profile_name: Testing
+
+ - name: Get specific endpoint of a Traffic Manager profile
+ azure_rm_trafficmanager_info:
+ resource_group: myResourceGroup
+ profile_name: Testing
+ name: test_external_endpoint
+
+'''
+
+RETURN = '''
+endpoints:
+ description:
+ - List of Traffic Manager endpoints.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Name of the Traffic Manager endpoint.
+ returned: always
+ type: str
+ sample: testendpoint
+ type:
+ description:
+ - The type of the endpoint.
+ returned: always
+ type: str
+ sample: external_endpoints
+ target_resource_id:
+ description:
+ - The Azure Resource URI of the of the endpoint.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/vscjavaci
+ target:
+ description:
+ - The fully-qualified DNS name of the endpoint.
+ returned: always
+ type: str
+ sample: 8.8.8.8
+ enabled:
+ description:
+ - The status of the endpoint.
+ returned: always
+ type: str
+ sample: Enabled
+ weight:
+ description:
+ - The weight of this endpoint when using the 'Weighted' traffic routing method.
+ returned: always
+ type: int
+ sample: 10
+ priority:
+ description:
+ - The priority of this endpoint when using the 'Priority' traffic routing method.
+ returned: always
+ type: str
+ sample: 3
+ location:
+ description:
+ - The location of the external or nested endpoints when using the 'Performance' traffic routing method.
+ returned: always
+ type: str
+ sample: East US
+ min_child_endpoints:
+ description:
+ - The minimum number of endpoints that must be available in the child profile to make the parent profile available.
+ returned: always
+ type: int
+ sample: 3
+ geo_mapping:
+ description:
+ - The list of countries/regions mapped to this endpoint when using the 'Geographic' traffic routing method.
+ returned: always
+ type: list
+ sample: [
+ "GEO-NA",
+ "GEO-AS"
+ ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import (
+ _snake_to_camel, _camel_to_snake
+)
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+AZURE_OBJECT_CLASS = 'TrafficManagerEndpoints'
+
+
+def serialize_endpoint(endpoint, resource_group):
+ result = dict(
+ id=endpoint.id,
+ name=endpoint.name,
+ target_resource_id=endpoint.target_resource_id,
+ target=endpoint.target,
+ enabled=True,
+ weight=endpoint.weight,
+ priority=endpoint.priority,
+ location=endpoint.endpoint_location,
+ min_child_endpoints=endpoint.min_child_endpoints,
+ geo_mapping=endpoint.geo_mapping,
+ monitor_status=endpoint.endpoint_monitor_status,
+ resource_group=resource_group
+ )
+
+ if endpoint.endpoint_status and endpoint.endpoint_status == 'Disabled':
+ result['enabled'] = False
+
+ if endpoint.type:
+ result['type'] = _camel_to_snake(endpoint.type.split("/")[-1])
+
+ return result
+
+
+class AzureRMTrafficManagerEndpointInfo(AzureRMModuleBase):
+ """Utility class to get Azure Traffic Manager Endpoint facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ profile_name=dict(
+ type='str',
+ required=True),
+ resource_group=dict(
+ type='str',
+ required=True),
+ name=dict(type='str'),
+ type=dict(
+ type='str',
+ choices=[
+ 'azure_endpoints',
+ 'external_endpoints',
+ 'nested_endpoints'
+ ])
+ )
+
+ self.results = dict(
+ changed=False,
+ endpoints=[]
+ )
+
+ self.profile_name = None
+ self.name = None
+ self.resource_group = None
+ self.type = None
+
+ super(AzureRMTrafficManagerEndpointInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_trafficmanagerendpoint_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_trafficmanagerendpoint_facts' module has been renamed to 'azure_rm_trafficmanagerendpoint_info'",
+ version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ if self.type:
+ self.type = _snake_to_camel(self.type)
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ self.results['endpoints'] = self.get_item()
+ elif self.type:
+ self.results['endpoints'] = self.list_by_type()
+ else:
+ self.results['endpoints'] = self.list_by_profile()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Traffic Manager endpoint"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.traffic_manager_management_client.endpoints.get(
+ self.resource_group, self.profile_name, self.type, self.name)
+ except CloudError:
+ pass
+
+ if item:
+ if (self.type and self.type == item.type) or self.type is None:
+ result = [self.serialize_tm(item)]
+
+ return result
+
+ def list_by_profile(self):
+ """Get all Azure Traffic Manager endpoints of a profile"""
+
+ self.log('List all endpoints belongs to a Traffic Manager profile')
+
+ try:
+ response = self.traffic_manager_management_client.profiles.get(self.resource_group, self.profile_name)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ if response and response.endpoints:
+ for endpoint in response.endpoints:
+ results.append(serialize_endpoint(endpoint, self.resource_group))
+
+ return results
+
+ def list_by_type(self):
+ """Get all Azure Traffic Managers endpoints of a profile by type"""
+ self.log('List all Traffic Manager endpoints of a profile by type')
+ try:
+ response = self.traffic_manager_management_client.profiles.get(self.resource_group, self.profile_name)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if item.endpoints:
+ for endpoint in item.endpoints:
+ if endpoint.type == self.type:
+ results.append(serialize_endpoint(endpoint, self.resource_group))
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMTrafficManagerEndpointInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerendpoint_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerendpoint_info.py
new file mode 100644
index 00000000..63a32491
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerendpoint_info.py
@@ -0,0 +1,311 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Hai Cao, <t-haicao@microsoft.com>, Yunge Zhu <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_trafficmanagerendpoint_info
+
+
+short_description: Get Azure Traffic Manager endpoint facts
+
+description:
+ - Get facts for a specific Traffic Manager endpoints or all endpoints in a Traffic Manager profile.
+
+options:
+ name:
+ description:
+ - Limit results to a specific Traffic Manager endpoint.
+ resource_group:
+ description:
+ - The resource group to search for the desired Traffic Manager profile.
+ required: True
+ profile_name:
+ description:
+ - Name of Traffic Manager Profile.
+ required: True
+ type:
+ description:
+ - Type of endpoint.
+ choices:
+ - azure_endpoints
+ - external_endpoints
+ - nested_endpoints
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Hai Cao (@caohai)
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get endpoints facts of a Traffic Manager profile
+ community.azure.azure_rm_trafficmanagerendpoint_info:
+ resource_group: myResourceGroup
+ profile_name: Testing
+
+ - name: Get specific endpoint of a Traffic Manager profile
+ azure_rm_trafficmanager_info:
+ resource_group: myResourceGroup
+ profile_name: Testing
+ name: test_external_endpoint
+
+'''
+
+RETURN = '''
+endpoints:
+ description:
+ - List of Traffic Manager endpoints.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ name:
+ description:
+ - Name of the Traffic Manager endpoint.
+ returned: always
+ type: str
+ sample: testendpoint
+ type:
+ description:
+ - The type of the endpoint.
+ returned: always
+ type: str
+ sample: external_endpoints
+ target_resource_id:
+ description:
+ - The Azure Resource URI of the of the endpoint.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/domainNames/vscjavaci
+ target:
+ description:
+ - The fully-qualified DNS name of the endpoint.
+ returned: always
+ type: str
+ sample: 8.8.8.8
+ enabled:
+ description:
+ - The status of the endpoint.
+ returned: always
+ type: str
+ sample: Enabled
+ weight:
+ description:
+ - The weight of this endpoint when using the 'Weighted' traffic routing method.
+ returned: always
+ type: int
+ sample: 10
+ priority:
+ description:
+ - The priority of this endpoint when using the 'Priority' traffic routing method.
+ returned: always
+ type: str
+ sample: 3
+ location:
+ description:
+ - The location of the external or nested endpoints when using the 'Performance' traffic routing method.
+ returned: always
+ type: str
+ sample: East US
+ min_child_endpoints:
+ description:
+ - The minimum number of endpoints that must be available in the child profile to make the parent profile available.
+ returned: always
+ type: int
+ sample: 3
+ geo_mapping:
+ description:
+ - The list of countries/regions mapped to this endpoint when using the 'Geographic' traffic routing method.
+ returned: always
+ type: list
+ sample: [
+ "GEO-NA",
+ "GEO-AS"
+ ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import (
+ _snake_to_camel, _camel_to_snake
+)
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+AZURE_OBJECT_CLASS = 'TrafficManagerEndpoints'
+
+
+def serialize_endpoint(endpoint, resource_group):
+ result = dict(
+ id=endpoint.id,
+ name=endpoint.name,
+ target_resource_id=endpoint.target_resource_id,
+ target=endpoint.target,
+ enabled=True,
+ weight=endpoint.weight,
+ priority=endpoint.priority,
+ location=endpoint.endpoint_location,
+ min_child_endpoints=endpoint.min_child_endpoints,
+ geo_mapping=endpoint.geo_mapping,
+ monitor_status=endpoint.endpoint_monitor_status,
+ resource_group=resource_group
+ )
+
+ if endpoint.endpoint_status and endpoint.endpoint_status == 'Disabled':
+ result['enabled'] = False
+
+ if endpoint.type:
+ result['type'] = _camel_to_snake(endpoint.type.split("/")[-1])
+
+ return result
+
+
+class AzureRMTrafficManagerEndpointInfo(AzureRMModuleBase):
+ """Utility class to get Azure Traffic Manager Endpoint facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ profile_name=dict(
+ type='str',
+ required=True),
+ resource_group=dict(
+ type='str',
+ required=True),
+ name=dict(type='str'),
+ type=dict(
+ type='str',
+ choices=[
+ 'azure_endpoints',
+ 'external_endpoints',
+ 'nested_endpoints'
+ ])
+ )
+
+ self.results = dict(
+ changed=False,
+ endpoints=[]
+ )
+
+ self.profile_name = None
+ self.name = None
+ self.resource_group = None
+ self.type = None
+
+ super(AzureRMTrafficManagerEndpointInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_trafficmanagerendpoint_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_trafficmanagerendpoint_facts' module has been renamed to 'azure_rm_trafficmanagerendpoint_info'",
+ version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ if self.type:
+ self.type = _snake_to_camel(self.type)
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ self.results['endpoints'] = self.get_item()
+ elif self.type:
+ self.results['endpoints'] = self.list_by_type()
+ else:
+ self.results['endpoints'] = self.list_by_profile()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Traffic Manager endpoint"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.traffic_manager_management_client.endpoints.get(
+ self.resource_group, self.profile_name, self.type, self.name)
+ except CloudError:
+ pass
+
+ if item:
+ if (self.type and self.type == item.type) or self.type is None:
+ result = [self.serialize_tm(item)]
+
+ return result
+
+ def list_by_profile(self):
+ """Get all Azure Traffic Manager endpoints of a profile"""
+
+ self.log('List all endpoints belongs to a Traffic Manager profile')
+
+ try:
+ response = self.traffic_manager_management_client.profiles.get(self.resource_group, self.profile_name)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ if response and response.endpoints:
+ for endpoint in response.endpoints:
+ results.append(serialize_endpoint(endpoint, self.resource_group))
+
+ return results
+
+ def list_by_type(self):
+ """Get all Azure Traffic Managers endpoints of a profile by type"""
+ self.log('List all Traffic Manager endpoints of a profile by type')
+ try:
+ response = self.traffic_manager_management_client.profiles.get(self.resource_group, self.profile_name)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if item.endpoints:
+ for endpoint in item.endpoints:
+ if endpoint.type == self.type:
+ results.append(serialize_endpoint(endpoint, self.resource_group))
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMTrafficManagerEndpointInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerprofile_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerprofile_facts.py
new file mode 100644
index 00000000..8a04cc87
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerprofile_facts.py
@@ -0,0 +1,422 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Hai Cao, <t-haicao@microsoft.com>, Yunge Zhu <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_trafficmanagerprofile_info
+
+
+short_description: Get Azure Traffic Manager profile facts
+
+description:
+ - Get facts for a Azure specific Traffic Manager profile or all Traffic Manager profiles.
+
+options:
+ name:
+ description:
+ - Limit results to a specific Traffic Manager profile.
+ resource_group:
+ description:
+ - The resource group to search for the desired Traffic Manager profile.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Hai Cao (@caohai)
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one Traffic Manager profile
+ azure_rm_trafficmanager_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all Traffic Manager profiles
+ azure_rm_trafficmanager_info:
+
+ - name: Get facts by tags
+ azure_rm_trafficmanager_info:
+ tags:
+ - Environment:Test
+'''
+
+RETURN = '''
+tms:
+ description:
+ - List of Traffic Manager profiles.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group where the Traffic Manager profile exists.
+ returned: always
+ type: str
+ sample: testGroup
+ name:
+ description:
+ - Name of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: testTm
+ state:
+ description:
+ - The state of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: present
+ location:
+ description:
+ - Location of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: global
+ profile_status:
+ description:
+ - The status of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: Enabled
+ routing_method:
+ description:
+ - The traffic routing method of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: performance
+ dns_config:
+ description:
+ - The DNS settings of the Traffic Manager profile.
+ returned: always
+ type: complex
+ contains:
+ relative_name:
+ description:
+ - The relative DNS name provided by the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: testTm
+ fqdn:
+ description:
+ - The fully-qualified domain name(FQDN) of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: testTm.trafficmanager.net
+ ttl:
+ description:
+ - The DNS Time-To-Live(TTL), in seconds.
+ returned: always
+ type: int
+ sample: 60
+ monitor_config:
+ description:
+ - The endpoint monitoring settings of the Traffic Manager profile.
+ returned: always
+ type: complex
+ contains:
+ protocol:
+ description:
+ - The protocol C(HTTP), C(HTTPS) or C(TCP) used to probe for endpoint health.
+ returned: always
+ type: str
+ sample: HTTP
+ port:
+ description:
+ - The TCP port used to probe for endpoint health.
+ returned: always
+ type: int
+ sample: 80
+ path:
+ description:
+ - The path relative to the endpoint domain name used to probe for endpoint health.
+ returned: always
+ type: str
+ sample: /
+ interval:
+ description:
+ - The monitor interval for endpoints in this profile in seconds.
+ returned: always
+ type: int
+ sample: 10
+ timeout:
+ description:
+ - The monitor timeout for endpoints in this profile in seconds.
+ returned: always
+ type: int
+ sample: 30
+ tolerated_failures:
+ description:
+ - The number of consecutive failed health check before declaring an endpoint Degraded after the next failed health check.
+ returned: always
+ type: int
+ sample: 3
+ endpoints:
+ description:
+ - The list of endpoints in the Traffic Manager profile.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Fully qualified resource ID for the resource.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/trafficMan
+ agerProfiles/tmtest/externalEndpoints/e1"
+ name:
+ description:
+ - The name of the endpoint.
+ returned: always
+ type: str
+ sample: e1
+ type:
+ description:
+ - The type of the endpoint.
+ returned: always
+ type: str
+ sample: external_endpoints
+ target_resource_id:
+ description:
+ - The Azure Resource URI of the of the endpoint.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/dom
+ ainNames/vscjavaci"
+ target:
+ description:
+ - The fully-qualified DNS name of the endpoint.
+ returned: always
+ type: str
+ sample: 8.8.8.8
+ status:
+ description:
+ - The status of the endpoint.
+ returned: always
+ type: str
+ sample: Enabled
+ weight:
+ description:
+ - The weight of this endpoint when the profile has I(routing_method=weighted).
+ returned: always
+ type: int
+ sample: 10
+ priority:
+ description:
+ - The priority of this endpoint when the profile has I(routing_method=priority).
+ returned: always
+ type: str
+ sample: 3
+ location:
+ description:
+ - The location of endpoints when I(type=external_endpoints) or I(type=nested_endpoints), and profile I(routing_method=performance).
+ returned: always
+ type: str
+ sample: East US
+ min_child_endpoints:
+ description:
+ - The minimum number of endpoints that must be available in the child profile to make the parent profile available.
+ returned: always
+ type: int
+ sample: 3
+ geo_mapping:
+ description:
+ - The list of countries/regions mapped to this endpoint when the profile has routing_method C(geographic).
+ returned: always
+ type: list
+ sample: [
+ "GEO-NA",
+ "GEO-AS"
+ ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+AZURE_OBJECT_CLASS = 'trafficManagerProfiles'
+
+
+def serialize_endpoint(endpoint):
+ result = dict(
+ id=endpoint.id,
+ name=endpoint.name,
+ target_resource_id=endpoint.target_resource_id,
+ target=endpoint.target,
+ status=endpoint.endpoint_status,
+ weight=endpoint.weight,
+ priority=endpoint.priority,
+ location=endpoint.endpoint_location,
+ min_child_endpoints=endpoint.min_child_endpoints,
+ geo_mapping=endpoint.geo_mapping,
+ )
+
+ if endpoint.type:
+ result['type'] = _camel_to_snake(endpoint.type.split("/")[-1])
+
+ return result
+
+
+class AzureRMTrafficManagerProfileInfo(AzureRMModuleBase):
+ """Utility class to get Azure Traffic Manager profile facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ tms=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMTrafficManagerProfileInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_trafficmanagerprofile_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_trafficmanagerprofile_facts' module has been renamed to 'azure_rm_trafficmanagerprofile_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ self.results['tms'] = self.get_item()
+ elif self.resource_group:
+ self.results['tms'] = self.list_resource_group()
+ else:
+ self.results['tms'] = self.list_all()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Traffic Manager profile"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.traffic_manager_management_client.profiles.get(
+ self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_tm(item)]
+
+ return result
+
+ def list_resource_group(self):
+ """Get all Azure Traffic Managers profiles within a resource group"""
+
+ self.log('List all Azure Traffic Managers within a resource group')
+
+ try:
+ response = self.traffic_manager_management_client.profiles.list_by_resource_group(
+ self.resource_group)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_tm(item))
+
+ return results
+
+ def list_all(self):
+ """Get all Azure Traffic Manager profiles within a subscription"""
+ self.log('List all Traffic Manager profiles within a subscription')
+ try:
+ response = self.traffic_manager_management_client.profiles.list_by_subscription()
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_tm(item))
+ return results
+
+ def serialize_tm(self, tm):
+ '''
+ Convert a Traffic Manager profile object to dict.
+ :param tm: Traffic Manager profile object
+ :return: dict
+ '''
+ result = self.serialize_obj(tm, AZURE_OBJECT_CLASS)
+
+ new_result = {}
+ new_result['id'] = tm.id
+ new_result['resource_group'] = re.sub('\\/.*', '', re.sub('.*resourceGroups\\/', '', result['id']))
+ new_result['name'] = tm.name
+ new_result['state'] = 'present'
+ new_result['location'] = tm.location
+ new_result['profile_status'] = tm.profile_status
+ new_result['routing_method'] = tm.traffic_routing_method.lower()
+ new_result['dns_config'] = dict(
+ relative_name=tm.dns_config.relative_name,
+ fqdn=tm.dns_config.fqdn,
+ ttl=tm.dns_config.ttl
+ )
+ new_result['monitor_config'] = dict(
+ profile_monitor_status=tm.monitor_config.profile_monitor_status,
+ protocol=tm.monitor_config.protocol,
+ port=tm.monitor_config.port,
+ path=tm.monitor_config.path,
+ interval=tm.monitor_config.interval_in_seconds,
+ timeout=tm.monitor_config.timeout_in_seconds,
+ tolerated_failures=tm.monitor_config.tolerated_number_of_failures
+ )
+ new_result['endpoints'] = [serialize_endpoint(endpoint) for endpoint in tm.endpoints]
+ new_result['tags'] = tm.tags
+ return new_result
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMTrafficManagerProfileInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerprofile_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerprofile_info.py
new file mode 100644
index 00000000..8a04cc87
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_trafficmanagerprofile_info.py
@@ -0,0 +1,422 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Hai Cao, <t-haicao@microsoft.com>, Yunge Zhu <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_trafficmanagerprofile_info
+
+
+short_description: Get Azure Traffic Manager profile facts
+
+description:
+ - Get facts for a Azure specific Traffic Manager profile or all Traffic Manager profiles.
+
+options:
+ name:
+ description:
+ - Limit results to a specific Traffic Manager profile.
+ resource_group:
+ description:
+ - The resource group to search for the desired Traffic Manager profile.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Hai Cao (@caohai)
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one Traffic Manager profile
+ azure_rm_trafficmanager_info:
+ name: Testing
+ resource_group: myResourceGroup
+
+ - name: Get facts for all Traffic Manager profiles
+ azure_rm_trafficmanager_info:
+
+ - name: Get facts by tags
+ azure_rm_trafficmanager_info:
+ tags:
+ - Environment:Test
+'''
+
+RETURN = '''
+tms:
+ description:
+ - List of Traffic Manager profiles.
+ returned: always
+ type: complex
+ contains:
+ resource_group:
+ description:
+ - Name of a resource group where the Traffic Manager profile exists.
+ returned: always
+ type: str
+ sample: testGroup
+ name:
+ description:
+ - Name of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: testTm
+ state:
+ description:
+ - The state of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: present
+ location:
+ description:
+ - Location of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: global
+ profile_status:
+ description:
+ - The status of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: Enabled
+ routing_method:
+ description:
+ - The traffic routing method of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: performance
+ dns_config:
+ description:
+ - The DNS settings of the Traffic Manager profile.
+ returned: always
+ type: complex
+ contains:
+ relative_name:
+ description:
+ - The relative DNS name provided by the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: testTm
+ fqdn:
+ description:
+ - The fully-qualified domain name(FQDN) of the Traffic Manager profile.
+ returned: always
+ type: str
+ sample: testTm.trafficmanager.net
+ ttl:
+ description:
+ - The DNS Time-To-Live(TTL), in seconds.
+ returned: always
+ type: int
+ sample: 60
+ monitor_config:
+ description:
+ - The endpoint monitoring settings of the Traffic Manager profile.
+ returned: always
+ type: complex
+ contains:
+ protocol:
+ description:
+ - The protocol C(HTTP), C(HTTPS) or C(TCP) used to probe for endpoint health.
+ returned: always
+ type: str
+ sample: HTTP
+ port:
+ description:
+ - The TCP port used to probe for endpoint health.
+ returned: always
+ type: int
+ sample: 80
+ path:
+ description:
+ - The path relative to the endpoint domain name used to probe for endpoint health.
+ returned: always
+ type: str
+ sample: /
+ interval:
+ description:
+ - The monitor interval for endpoints in this profile in seconds.
+ returned: always
+ type: int
+ sample: 10
+ timeout:
+ description:
+ - The monitor timeout for endpoints in this profile in seconds.
+ returned: always
+ type: int
+ sample: 30
+ tolerated_failures:
+ description:
+ - The number of consecutive failed health check before declaring an endpoint Degraded after the next failed health check.
+ returned: always
+ type: int
+ sample: 3
+ endpoints:
+ description:
+ - The list of endpoints in the Traffic Manager profile.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Fully qualified resource ID for the resource.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/trafficMan
+ agerProfiles/tmtest/externalEndpoints/e1"
+ name:
+ description:
+ - The name of the endpoint.
+ returned: always
+ type: str
+ sample: e1
+ type:
+ description:
+ - The type of the endpoint.
+ returned: always
+ type: str
+ sample: external_endpoints
+ target_resource_id:
+ description:
+ - The Azure Resource URI of the of the endpoint.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicCompute/dom
+ ainNames/vscjavaci"
+ target:
+ description:
+ - The fully-qualified DNS name of the endpoint.
+ returned: always
+ type: str
+ sample: 8.8.8.8
+ status:
+ description:
+ - The status of the endpoint.
+ returned: always
+ type: str
+ sample: Enabled
+ weight:
+ description:
+ - The weight of this endpoint when the profile has I(routing_method=weighted).
+ returned: always
+ type: int
+ sample: 10
+ priority:
+ description:
+ - The priority of this endpoint when the profile has I(routing_method=priority).
+ returned: always
+ type: str
+ sample: 3
+ location:
+ description:
+ - The location of endpoints when I(type=external_endpoints) or I(type=nested_endpoints), and profile I(routing_method=performance).
+ returned: always
+ type: str
+ sample: East US
+ min_child_endpoints:
+ description:
+ - The minimum number of endpoints that must be available in the child profile to make the parent profile available.
+ returned: always
+ type: int
+ sample: 3
+ geo_mapping:
+ description:
+ - The list of countries/regions mapped to this endpoint when the profile has routing_method C(geographic).
+ returned: always
+ type: list
+ sample: [
+ "GEO-NA",
+ "GEO-AS"
+ ]
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.common.dict_transformations import _camel_to_snake
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.common import AzureHttpError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+import re
+
+AZURE_OBJECT_CLASS = 'trafficManagerProfiles'
+
+
+def serialize_endpoint(endpoint):
+ result = dict(
+ id=endpoint.id,
+ name=endpoint.name,
+ target_resource_id=endpoint.target_resource_id,
+ target=endpoint.target,
+ status=endpoint.endpoint_status,
+ weight=endpoint.weight,
+ priority=endpoint.priority,
+ location=endpoint.endpoint_location,
+ min_child_endpoints=endpoint.min_child_endpoints,
+ geo_mapping=endpoint.geo_mapping,
+ )
+
+ if endpoint.type:
+ result['type'] = _camel_to_snake(endpoint.type.split("/")[-1])
+
+ return result
+
+
+class AzureRMTrafficManagerProfileInfo(AzureRMModuleBase):
+ """Utility class to get Azure Traffic Manager profile facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ tms=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMTrafficManagerProfileInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_trafficmanagerprofile_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_trafficmanagerprofile_facts' module has been renamed to 'azure_rm_trafficmanagerprofile_info'", version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ self.results['tms'] = self.get_item()
+ elif self.resource_group:
+ self.results['tms'] = self.list_resource_group()
+ else:
+ self.results['tms'] = self.list_all()
+
+ return self.results
+
+ def get_item(self):
+ """Get a single Azure Traffic Manager profile"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ result = []
+
+ try:
+ item = self.traffic_manager_management_client.profiles.get(
+ self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ result = [self.serialize_tm(item)]
+
+ return result
+
+ def list_resource_group(self):
+ """Get all Azure Traffic Managers profiles within a resource group"""
+
+ self.log('List all Azure Traffic Managers within a resource group')
+
+ try:
+ response = self.traffic_manager_management_client.profiles.list_by_resource_group(
+ self.resource_group)
+ except AzureHttpError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_tm(item))
+
+ return results
+
+ def list_all(self):
+ """Get all Azure Traffic Manager profiles within a subscription"""
+ self.log('List all Traffic Manager profiles within a subscription')
+ try:
+ response = self.traffic_manager_management_client.profiles.list_by_subscription()
+ except Exception as exc:
+ self.fail("Error listing all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_tm(item))
+ return results
+
+ def serialize_tm(self, tm):
+ '''
+ Convert a Traffic Manager profile object to dict.
+ :param tm: Traffic Manager profile object
+ :return: dict
+ '''
+ result = self.serialize_obj(tm, AZURE_OBJECT_CLASS)
+
+ new_result = {}
+ new_result['id'] = tm.id
+ new_result['resource_group'] = re.sub('\\/.*', '', re.sub('.*resourceGroups\\/', '', result['id']))
+ new_result['name'] = tm.name
+ new_result['state'] = 'present'
+ new_result['location'] = tm.location
+ new_result['profile_status'] = tm.profile_status
+ new_result['routing_method'] = tm.traffic_routing_method.lower()
+ new_result['dns_config'] = dict(
+ relative_name=tm.dns_config.relative_name,
+ fqdn=tm.dns_config.fqdn,
+ ttl=tm.dns_config.ttl
+ )
+ new_result['monitor_config'] = dict(
+ profile_monitor_status=tm.monitor_config.profile_monitor_status,
+ protocol=tm.monitor_config.protocol,
+ port=tm.monitor_config.port,
+ path=tm.monitor_config.path,
+ interval=tm.monitor_config.interval_in_seconds,
+ timeout=tm.monitor_config.timeout_in_seconds,
+ tolerated_failures=tm.monitor_config.tolerated_number_of_failures
+ )
+ new_result['endpoints'] = [serialize_endpoint(endpoint) for endpoint in tm.endpoints]
+ new_result['tags'] = tm.tags
+ return new_result
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMTrafficManagerProfileInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_extension.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_extension.py
new file mode 100644
index 00000000..a2dff8cd
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_extension.py
@@ -0,0 +1,339 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Sertac Ozercan <seozerca@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachineextension
+
+
+short_description: Managed Azure Virtual Machine extension
+
+description:
+ - Create, update and delete Azure Virtual Machine Extension.
+ - Note that this module was called M(community.azure.azure_rm_virtualmachine_extension) before Ansible 2.8. The usage did not change.
+
+options:
+ resource_group:
+ description:
+ - Name of a resource group where the vm extension exists or will be created.
+ required: true
+ name:
+ description:
+ - Name of the vm extension.
+ required: true
+ state:
+ description:
+ - State of the vm extension. Use C(present) to create or update a vm extension and C(absent) to delete a vm extension.
+ default: present
+ choices:
+ - absent
+ - present
+ location:
+ description:
+ - Valid Azure location. Defaults to location of the resource group.
+ virtual_machine_name:
+ description:
+ - The name of the virtual machine where the extension should be create or updated.
+ publisher:
+ description:
+ - The name of the extension handler publisher.
+ virtual_machine_extension_type:
+ description:
+ - The type of the extension handler.
+ type_handler_version:
+ description:
+ - The type version of the extension handler.
+ settings:
+ description:
+ - Json formatted public settings for the extension.
+ protected_settings:
+ description:
+ - Json formatted protected settings for the extension.
+ auto_upgrade_minor_version:
+ description:
+ - Whether the extension handler should be automatically upgraded across minor versions.
+ type: bool
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Sertac Ozercan (@sozercan)
+ - Julien Stroheker (@julienstroheker)
+'''
+
+EXAMPLES = '''
+ - name: Create VM Extension
+ community.azure.azure_rm_virtualmachineextension:
+ name: myvmextension
+ location: eastus
+ resource_group: myResourceGroup
+ virtual_machine_name: myvm
+ publisher: Microsoft.Azure.Extensions
+ virtual_machine_extension_type: CustomScript
+ type_handler_version: 2.0
+ settings: '{"commandToExecute": "hostname"}'
+ auto_upgrade_minor_version: true
+
+ - name: Delete VM Extension
+ community.azure.azure_rm_virtualmachineextension:
+ name: myvmextension
+ location: eastus
+ resource_group: myResourceGroup
+ virtual_machine_name: myvm
+ state: absent
+'''
+
+RETURN = '''
+state:
+ description:
+ - Current state of the vm extension.
+ returned: always
+ type: dict
+ sample: { "state":"Deleted" }
+
+changed:
+ description:
+ - Whether or not the resource has changed.
+ returned: always
+ type: bool
+ sample: true
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+def vmextension_to_dict(extension):
+ '''
+ Serializing the VM Extension from the API to Dict
+ :return: dict
+ '''
+ return dict(
+ id=extension.id,
+ name=extension.name,
+ location=extension.location,
+ publisher=extension.publisher,
+ virtual_machine_extension_type=extension.virtual_machine_extension_type,
+ type_handler_version=extension.type_handler_version,
+ auto_upgrade_minor_version=extension.auto_upgrade_minor_version,
+ settings=extension.settings,
+ protected_settings=extension.protected_settings,
+ )
+
+
+class AzureRMVMExtension(AzureRMModuleBase):
+ """Configuration class for an Azure RM VM Extension resource"""
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str',
+ required=True
+ ),
+ state=dict(
+ type='str',
+ default='present',
+ choices=['present', 'absent']
+ ),
+ location=dict(
+ type='str'
+ ),
+ virtual_machine_name=dict(
+ type='str'
+ ),
+ publisher=dict(
+ type='str'
+ ),
+ virtual_machine_extension_type=dict(
+ type='str'
+ ),
+ type_handler_version=dict(
+ type='str'
+ ),
+ auto_upgrade_minor_version=dict(
+ type='bool'
+ ),
+ settings=dict(
+ type='dict'
+ ),
+ protected_settings=dict(
+ type='dict'
+ )
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.location = None
+ self.publisher = None
+ self.virtual_machine_extension_type = None
+ self.type_handler_version = None
+ self.auto_upgrade_minor_version = None
+ self.settings = None
+ self.protected_settings = None
+ self.state = None
+
+ required_if = [
+ ('state', 'present', [
+ 'publisher', 'virtual_machine_extension_type', 'type_handler_version'])
+ ]
+
+ self.results = dict(changed=False, state=dict())
+
+ super(AzureRMVMExtension, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_check_mode=False,
+ supports_tags=False,
+ required_if=required_if)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+
+ for key in list(self.module_arg_spec.keys()):
+ setattr(self, key, kwargs[key])
+
+ if self.module._name == 'azure_rm_virtualmachine_extension':
+ self.module.deprecate("The 'azure_rm_virtualmachine_extension' module has been renamed to 'azure_rm_virtualmachineextension'", version='2.12')
+
+ resource_group = None
+ response = None
+ to_be_updated = False
+
+ resource_group = self.get_resource_group(self.resource_group)
+ if not self.location:
+ self.location = resource_group.location
+
+ if self.state == 'present':
+ response = self.get_vmextension()
+ if not response:
+ to_be_updated = True
+ else:
+ if self.settings is not None:
+ if response['settings'] != self.settings:
+ response['settings'] = self.settings
+ to_be_updated = True
+ else:
+ self.settings = response['settings']
+
+ if self.protected_settings is not None:
+ if response['protected_settings'] != self.protected_settings:
+ response['protected_settings'] = self.protected_settings
+ to_be_updated = True
+ else:
+ self.protected_settings = response['protected_settings']
+
+ if response['location'] != self.location:
+ self.location = response['location']
+ self.module.warn("Property 'location' cannot be changed")
+
+ if response['publisher'] != self.publisher:
+ self.publisher = response['publisher']
+ self.module.warn("Property 'publisher' cannot be changed")
+
+ if response['virtual_machine_extension_type'] != self.virtual_machine_extension_type:
+ self.virtual_machine_extension_type = response['virtual_machine_extension_type']
+ self.module.warn("Property 'virtual_machine_extension_type' cannot be changed")
+
+ if response['type_handler_version'] != self.type_handler_version:
+ response['type_handler_version'] = self.type_handler_version
+ to_be_updated = True
+
+ if self.auto_upgrade_minor_version is not None:
+ if response['auto_upgrade_minor_version'] != self.auto_upgrade_minor_version:
+ response['auto_upgrade_minor_version'] = self.auto_upgrade_minor_version
+ to_be_updated = True
+ else:
+ self.auto_upgrade_minor_version = response['auto_upgrade_minor_version']
+
+ if to_be_updated:
+ self.results['changed'] = True
+ self.results['state'] = self.create_or_update_vmextension()
+ elif self.state == 'absent':
+ self.delete_vmextension()
+ self.results['changed'] = True
+
+ return self.results
+
+ def create_or_update_vmextension(self):
+ '''
+ Method calling the Azure SDK to create or update the VM extension.
+ :return: void
+ '''
+ self.log("Creating VM extension {0}".format(self.name))
+ try:
+ params = self.compute_models.VirtualMachineExtension(
+ location=self.location,
+ publisher=self.publisher,
+ virtual_machine_extension_type=self.virtual_machine_extension_type,
+ type_handler_version=self.type_handler_version,
+ auto_upgrade_minor_version=self.auto_upgrade_minor_version,
+ settings=self.settings,
+ protected_settings=self.protected_settings
+ )
+ poller = self.compute_client.virtual_machine_extensions.create_or_update(self.resource_group, self.virtual_machine_name, self.name, params)
+ response = self.get_poller_result(poller)
+ return vmextension_to_dict(response)
+
+ except CloudError as e:
+ self.log('Error attempting to create the VM extension.')
+ self.fail("Error creating the VM extension: {0}".format(str(e)))
+
+ def delete_vmextension(self):
+ '''
+ Method calling the Azure SDK to delete the VM Extension.
+ :return: void
+ '''
+ self.log("Deleting vmextension {0}".format(self.name))
+ try:
+ poller = self.compute_client.virtual_machine_extensions.delete(self.resource_group, self.virtual_machine_name, self.name)
+ self.get_poller_result(poller)
+ except CloudError as e:
+ self.log('Error attempting to delete the vmextension.')
+ self.fail("Error deleting the vmextension: {0}".format(str(e)))
+
+ def get_vmextension(self):
+ '''
+ Method calling the Azure SDK to get a VM Extension.
+ :return: void
+ '''
+ self.log("Checking if the vm extension {0} is present".format(self.name))
+ found = False
+ try:
+ response = self.compute_client.virtual_machine_extensions.get(self.resource_group, self.virtual_machine_name, self.name)
+ found = True
+ except CloudError as e:
+ self.log('Did not find vm extension')
+ if found:
+ return vmextension_to_dict(response)
+ else:
+ return False
+
+
+def main():
+ """Main execution"""
+ AzureRMVMExtension()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_facts.py
new file mode 100644
index 00000000..06b0cafc
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_facts.py
@@ -0,0 +1,456 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018
+# Gustavo Muniz do Carmo <gustavo@esign.com.br>
+# Zim Kalinowski <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachine_info
+
+
+short_description: Get virtual machine facts
+
+description:
+ - Get facts for one or all virtual machines in a resource group.
+
+options:
+ resource_group:
+ description:
+ - Name of the resource group containing the virtual machines (required when filtering by vm name).
+ name:
+ description:
+ - Name of the virtual machine.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Gustavo Muniz do Carmo (@gustavomcarmo)
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for all virtual machines of a resource group
+ community.azure.azure_rm_virtualmachine_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by name
+ community.azure.azure_rm_virtualmachine_info:
+ resource_group: myResourceGroup
+ name: myVm
+
+ - name: Get facts by tags
+ community.azure.azure_rm_virtualmachine_info:
+ resource_group: myResourceGroup
+ tags:
+ - testing
+ - foo:bar
+'''
+
+RETURN = '''
+vms:
+ description:
+ - List of virtual machines.
+ returned: always
+ type: complex
+ contains:
+ admin_username:
+ description:
+ - Administrator user name.
+ returned: always
+ type: str
+ sample: admin
+ boot_diagnostics:
+ description:
+ - Information about the boot diagnostics settings.
+ returned: always
+ type: complex
+ contains:
+ enabled:
+ description:
+ - Indicates if boot diagnostics are enabled.
+ returned: always
+ type: bool
+ sample: true
+ storage_uri:
+ description:
+ - Indicates the storage account used by boot diagnostics.
+ returned: always
+ type: str
+ sample: https://mystorageaccountname.blob.core.windows.net/
+ console_screenshot_uri:
+ description:
+ - Contains a URI to grab a console screenshot.
+ - Only present if enabled.
+ returned: always
+ type: str
+ sample: https://mystorageaccountname.blob.core.windows.net/bootdiagnostics-myvm01-a4db09a6-ab7f-4d80-9da8-fbceaef9288a/
+ myVm.a4db09a6-ab7f-4d80-9da8-fbceaef9288a.screenshot.bmp
+ serial_console_log_uri:
+ description:
+ - Contains a URI to grab the serial console log.
+ - Only present if enabled.
+ returned: always
+ type: str
+ sample: https://mystorageaccountname.blob.core.windows.net/bootdiagnostics-myvm01-a4db09a6-ab7f-4d80-9da8-fbceaef9288a/
+ myVm.a4db09a6-ab7f-4d80-9da8-fbceaef9288a.serialconsole.log
+ data_disks:
+ description:
+ - List of attached data disks.
+ returned: always
+ type: complex
+ contains:
+ caching:
+ description:
+ - Type of data disk caching.
+ returned: always
+ type: str
+ sample: ReadOnly
+ disk_size_gb:
+ description:
+ - The initial disk size in GB for blank data disks.
+ returned: always
+ type: int
+ sample: 64
+ lun:
+ description:
+ - The logical unit number for data disk.
+ returned: always
+ type: int
+ sample: 0
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ returned: always
+ type: str
+ sample: Standard_LRS
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm
+ image:
+ description:
+ - Image specification.
+ returned: always
+ type: complex
+ contains:
+ offer:
+ description:
+ - The offer of the platform image or marketplace image used to create the virtual machine.
+ type: str
+ returned: when created from marketplace image
+ sample: RHEL
+ publisher:
+ description:
+ - Publisher name.
+ type: str
+ returned: when created from marketplace image
+ sample: RedHat
+ sku:
+ description:
+ - SKU name.
+ type: str
+ returned: when created from marketplace image
+ sample: 7-RAW
+ version:
+ description:
+ - Image version.
+ type: str
+ returned: when created from marketplace image
+ sample: 7.5.2018050901
+ id:
+ description:
+ - Custom image resource ID.
+ type: str
+ returned: when created from custom image
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: japaneast
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myVm
+ network_interface_names:
+ description:
+ - List of attached network interfaces.
+ returned: always
+ type: list
+ sample: [
+ "myNetworkInterface"
+ ]
+ os_disk_caching:
+ description:
+ - Type of OS disk caching.
+ returned: always
+ type: str
+ sample: ReadOnly
+ os_type:
+ description:
+ - Base type of operating system.
+ returned: always
+ type: str
+ sample: Linux
+ resource_group:
+ description:
+ - Resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ state:
+ description:
+ - State of the resource.
+ returned: always
+ type: str
+ sample: present
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { "key1":"value1" }
+ vm_size:
+ description:
+ - Virtual machine size.
+ returned: always
+ type: str
+ sample: Standard_D4
+ power_state:
+ description:
+ - Power state of the virtual machine.
+ returned: always
+ type: str
+ sample: running
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.tools import parse_resource_id
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.six.moves.urllib.parse import urlparse
+import re
+
+
+AZURE_OBJECT_CLASS = 'VirtualMachine'
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMVirtualMachineInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str'),
+ name=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ vms=[]
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+
+ super(AzureRMVirtualMachineInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachine_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachine_facts' module has been renamed to 'azure_rm_virtualmachine_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+ if self.name:
+ self.results['vms'] = self.get_item()
+ elif self.resource_group:
+ self.results['vms'] = self.list_items_by_resourcegroup()
+ else:
+ self.results['vms'] = self.list_all_items()
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ result = []
+
+ item = self.get_vm(self.resource_group, self.name)
+
+ if item and self.has_tags(item.get('tags'), self.tags):
+ result = [item]
+
+ return result
+
+ def list_items_by_resourcegroup(self):
+ self.log('List all items')
+ try:
+ items = self.compute_client.virtual_machines.list(self.resource_group)
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in items:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.get_vm(self.resource_group, item.name))
+ return results
+
+ def list_all_items(self):
+ self.log('List all items')
+ try:
+ items = self.compute_client.virtual_machines.list_all()
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in items:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.get_vm(parse_resource_id(item.id).get('resource_group'), item.name))
+ return results
+
+ def get_vm(self, resource_group, name):
+ '''
+ Get the VM with expanded instanceView
+
+ :return: VirtualMachine object
+ '''
+ try:
+ vm = self.compute_client.virtual_machines.get(resource_group, name, expand='instanceview')
+ return self.serialize_vm(vm)
+ except Exception as exc:
+ self.fail("Error getting virtual machine {0} - {1}".format(self.name, str(exc)))
+
+ def serialize_vm(self, vm):
+ '''
+ Convert a VirtualMachine object to dict.
+
+ :param vm: VirtualMachine object
+ :return: dict
+ '''
+
+ result = self.serialize_obj(vm, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES)
+ resource_group = parse_resource_id(result['id']).get('resource_group')
+ instance = None
+ power_state = None
+
+ try:
+ instance = self.compute_client.virtual_machines.instance_view(resource_group, vm.name)
+ instance = self.serialize_obj(instance, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES)
+ except Exception as exc:
+ self.fail("Error getting virtual machine {0} instance view - {1}".format(vm.name, str(exc)))
+
+ for index in range(len(instance['statuses'])):
+ code = instance['statuses'][index]['code'].split('/')
+ if code[0] == 'PowerState':
+ power_state = code[1]
+ elif code[0] == 'OSState' and code[1] == 'generalized':
+ power_state = 'generalized'
+ break
+
+ new_result = {}
+ new_result['power_state'] = power_state
+ new_result['id'] = vm.id
+ new_result['resource_group'] = resource_group
+ new_result['name'] = vm.name
+ new_result['state'] = 'present'
+ new_result['location'] = vm.location
+ new_result['vm_size'] = result['properties']['hardwareProfile']['vmSize']
+ os_profile = result['properties'].get('osProfile')
+ if os_profile is not None:
+ new_result['admin_username'] = os_profile.get('adminUsername')
+ image = result['properties']['storageProfile'].get('imageReference')
+ if image is not None:
+ if image.get('publisher', None) is not None:
+ new_result['image'] = {
+ 'publisher': image['publisher'],
+ 'sku': image['sku'],
+ 'offer': image['offer'],
+ 'version': image['version']
+ }
+ else:
+ new_result['image'] = {
+ 'id': image.get('id', None)
+ }
+
+ new_result['boot_diagnostics'] = {
+ 'enabled': 'diagnosticsProfile' in result['properties'] and
+ 'bootDiagnostics' in result['properties']['diagnosticsProfile'] and
+ result['properties']['diagnosticsProfile']['bootDiagnostics']['enabled'] or False,
+ 'storage_uri': 'diagnosticsProfile' in result['properties'] and
+ 'bootDiagnostics' in result['properties']['diagnosticsProfile'] and
+ result['properties']['diagnosticsProfile']['bootDiagnostics']['storageUri'] or None
+ }
+ if new_result['boot_diagnostics']['enabled']:
+ new_result['boot_diagnostics']['console_screenshot_uri'] = result['properties']['instanceView']['bootDiagnostics']['consoleScreenshotBlobUri']
+ new_result['boot_diagnostics']['serial_console_log_uri'] = result['properties']['instanceView']['bootDiagnostics']['serialConsoleLogBlobUri']
+
+ vhd = result['properties']['storageProfile']['osDisk'].get('vhd')
+ if vhd is not None:
+ url = urlparse(vhd['uri'])
+ new_result['storage_account_name'] = url.netloc.split('.')[0]
+ new_result['storage_container_name'] = url.path.split('/')[1]
+ new_result['storage_blob_name'] = url.path.split('/')[-1]
+
+ new_result['os_disk_caching'] = result['properties']['storageProfile']['osDisk']['caching']
+ new_result['os_type'] = result['properties']['storageProfile']['osDisk']['osType']
+ new_result['data_disks'] = []
+ disks = result['properties']['storageProfile']['dataDisks']
+ for disk_index in range(len(disks)):
+ new_result['data_disks'].append({
+ 'lun': disks[disk_index].get('lun'),
+ 'disk_size_gb': disks[disk_index].get('diskSizeGB'),
+ 'managed_disk_type': disks[disk_index].get('managedDisk', {}).get('storageAccountType'),
+ 'caching': disks[disk_index].get('caching')
+ })
+
+ new_result['network_interface_names'] = []
+ nics = result['properties']['networkProfile']['networkInterfaces']
+ for nic_index in range(len(nics)):
+ new_result['network_interface_names'].append(re.sub('.*networkInterfaces/', '', nics[nic_index]['id']))
+
+ new_result['tags'] = vm.tags
+ return new_result
+
+
+def main():
+ AzureRMVirtualMachineInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_info.py
new file mode 100644
index 00000000..06b0cafc
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_info.py
@@ -0,0 +1,456 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018
+# Gustavo Muniz do Carmo <gustavo@esign.com.br>
+# Zim Kalinowski <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachine_info
+
+
+short_description: Get virtual machine facts
+
+description:
+ - Get facts for one or all virtual machines in a resource group.
+
+options:
+ resource_group:
+ description:
+ - Name of the resource group containing the virtual machines (required when filtering by vm name).
+ name:
+ description:
+ - Name of the virtual machine.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Gustavo Muniz do Carmo (@gustavomcarmo)
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for all virtual machines of a resource group
+ community.azure.azure_rm_virtualmachine_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by name
+ community.azure.azure_rm_virtualmachine_info:
+ resource_group: myResourceGroup
+ name: myVm
+
+ - name: Get facts by tags
+ community.azure.azure_rm_virtualmachine_info:
+ resource_group: myResourceGroup
+ tags:
+ - testing
+ - foo:bar
+'''
+
+RETURN = '''
+vms:
+ description:
+ - List of virtual machines.
+ returned: always
+ type: complex
+ contains:
+ admin_username:
+ description:
+ - Administrator user name.
+ returned: always
+ type: str
+ sample: admin
+ boot_diagnostics:
+ description:
+ - Information about the boot diagnostics settings.
+ returned: always
+ type: complex
+ contains:
+ enabled:
+ description:
+ - Indicates if boot diagnostics are enabled.
+ returned: always
+ type: bool
+ sample: true
+ storage_uri:
+ description:
+ - Indicates the storage account used by boot diagnostics.
+ returned: always
+ type: str
+ sample: https://mystorageaccountname.blob.core.windows.net/
+ console_screenshot_uri:
+ description:
+ - Contains a URI to grab a console screenshot.
+ - Only present if enabled.
+ returned: always
+ type: str
+ sample: https://mystorageaccountname.blob.core.windows.net/bootdiagnostics-myvm01-a4db09a6-ab7f-4d80-9da8-fbceaef9288a/
+ myVm.a4db09a6-ab7f-4d80-9da8-fbceaef9288a.screenshot.bmp
+ serial_console_log_uri:
+ description:
+ - Contains a URI to grab the serial console log.
+ - Only present if enabled.
+ returned: always
+ type: str
+ sample: https://mystorageaccountname.blob.core.windows.net/bootdiagnostics-myvm01-a4db09a6-ab7f-4d80-9da8-fbceaef9288a/
+ myVm.a4db09a6-ab7f-4d80-9da8-fbceaef9288a.serialconsole.log
+ data_disks:
+ description:
+ - List of attached data disks.
+ returned: always
+ type: complex
+ contains:
+ caching:
+ description:
+ - Type of data disk caching.
+ returned: always
+ type: str
+ sample: ReadOnly
+ disk_size_gb:
+ description:
+ - The initial disk size in GB for blank data disks.
+ returned: always
+ type: int
+ sample: 64
+ lun:
+ description:
+ - The logical unit number for data disk.
+ returned: always
+ type: int
+ sample: 0
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ returned: always
+ type: str
+ sample: Standard_LRS
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm
+ image:
+ description:
+ - Image specification.
+ returned: always
+ type: complex
+ contains:
+ offer:
+ description:
+ - The offer of the platform image or marketplace image used to create the virtual machine.
+ type: str
+ returned: when created from marketplace image
+ sample: RHEL
+ publisher:
+ description:
+ - Publisher name.
+ type: str
+ returned: when created from marketplace image
+ sample: RedHat
+ sku:
+ description:
+ - SKU name.
+ type: str
+ returned: when created from marketplace image
+ sample: 7-RAW
+ version:
+ description:
+ - Image version.
+ type: str
+ returned: when created from marketplace image
+ sample: 7.5.2018050901
+ id:
+ description:
+ - Custom image resource ID.
+ type: str
+ returned: when created from custom image
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage
+ location:
+ description:
+ - Resource location.
+ returned: always
+ type: str
+ sample: japaneast
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myVm
+ network_interface_names:
+ description:
+ - List of attached network interfaces.
+ returned: always
+ type: list
+ sample: [
+ "myNetworkInterface"
+ ]
+ os_disk_caching:
+ description:
+ - Type of OS disk caching.
+ returned: always
+ type: str
+ sample: ReadOnly
+ os_type:
+ description:
+ - Base type of operating system.
+ returned: always
+ type: str
+ sample: Linux
+ resource_group:
+ description:
+ - Resource group.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ state:
+ description:
+ - State of the resource.
+ returned: always
+ type: str
+ sample: present
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { "key1":"value1" }
+ vm_size:
+ description:
+ - Virtual machine size.
+ returned: always
+ type: str
+ sample: Standard_D4
+ power_state:
+ description:
+ - Power state of the virtual machine.
+ returned: always
+ type: str
+ sample: running
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.tools import parse_resource_id
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+from ansible.module_utils.six.moves.urllib.parse import urlparse
+import re
+
+
+AZURE_OBJECT_CLASS = 'VirtualMachine'
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMVirtualMachineInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str'),
+ name=dict(type='str'),
+ tags=dict(type='list')
+ )
+
+ self.results = dict(
+ changed=False,
+ vms=[]
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.tags = None
+
+ super(AzureRMVirtualMachineInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachine_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachine_facts' module has been renamed to 'azure_rm_virtualmachine_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+ if self.name:
+ self.results['vms'] = self.get_item()
+ elif self.resource_group:
+ self.results['vms'] = self.list_items_by_resourcegroup()
+ else:
+ self.results['vms'] = self.list_all_items()
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ result = []
+
+ item = self.get_vm(self.resource_group, self.name)
+
+ if item and self.has_tags(item.get('tags'), self.tags):
+ result = [item]
+
+ return result
+
+ def list_items_by_resourcegroup(self):
+ self.log('List all items')
+ try:
+ items = self.compute_client.virtual_machines.list(self.resource_group)
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in items:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.get_vm(self.resource_group, item.name))
+ return results
+
+ def list_all_items(self):
+ self.log('List all items')
+ try:
+ items = self.compute_client.virtual_machines.list_all()
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in items:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.get_vm(parse_resource_id(item.id).get('resource_group'), item.name))
+ return results
+
+ def get_vm(self, resource_group, name):
+ '''
+ Get the VM with expanded instanceView
+
+ :return: VirtualMachine object
+ '''
+ try:
+ vm = self.compute_client.virtual_machines.get(resource_group, name, expand='instanceview')
+ return self.serialize_vm(vm)
+ except Exception as exc:
+ self.fail("Error getting virtual machine {0} - {1}".format(self.name, str(exc)))
+
+ def serialize_vm(self, vm):
+ '''
+ Convert a VirtualMachine object to dict.
+
+ :param vm: VirtualMachine object
+ :return: dict
+ '''
+
+ result = self.serialize_obj(vm, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES)
+ resource_group = parse_resource_id(result['id']).get('resource_group')
+ instance = None
+ power_state = None
+
+ try:
+ instance = self.compute_client.virtual_machines.instance_view(resource_group, vm.name)
+ instance = self.serialize_obj(instance, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES)
+ except Exception as exc:
+ self.fail("Error getting virtual machine {0} instance view - {1}".format(vm.name, str(exc)))
+
+ for index in range(len(instance['statuses'])):
+ code = instance['statuses'][index]['code'].split('/')
+ if code[0] == 'PowerState':
+ power_state = code[1]
+ elif code[0] == 'OSState' and code[1] == 'generalized':
+ power_state = 'generalized'
+ break
+
+ new_result = {}
+ new_result['power_state'] = power_state
+ new_result['id'] = vm.id
+ new_result['resource_group'] = resource_group
+ new_result['name'] = vm.name
+ new_result['state'] = 'present'
+ new_result['location'] = vm.location
+ new_result['vm_size'] = result['properties']['hardwareProfile']['vmSize']
+ os_profile = result['properties'].get('osProfile')
+ if os_profile is not None:
+ new_result['admin_username'] = os_profile.get('adminUsername')
+ image = result['properties']['storageProfile'].get('imageReference')
+ if image is not None:
+ if image.get('publisher', None) is not None:
+ new_result['image'] = {
+ 'publisher': image['publisher'],
+ 'sku': image['sku'],
+ 'offer': image['offer'],
+ 'version': image['version']
+ }
+ else:
+ new_result['image'] = {
+ 'id': image.get('id', None)
+ }
+
+ new_result['boot_diagnostics'] = {
+ 'enabled': 'diagnosticsProfile' in result['properties'] and
+ 'bootDiagnostics' in result['properties']['diagnosticsProfile'] and
+ result['properties']['diagnosticsProfile']['bootDiagnostics']['enabled'] or False,
+ 'storage_uri': 'diagnosticsProfile' in result['properties'] and
+ 'bootDiagnostics' in result['properties']['diagnosticsProfile'] and
+ result['properties']['diagnosticsProfile']['bootDiagnostics']['storageUri'] or None
+ }
+ if new_result['boot_diagnostics']['enabled']:
+ new_result['boot_diagnostics']['console_screenshot_uri'] = result['properties']['instanceView']['bootDiagnostics']['consoleScreenshotBlobUri']
+ new_result['boot_diagnostics']['serial_console_log_uri'] = result['properties']['instanceView']['bootDiagnostics']['serialConsoleLogBlobUri']
+
+ vhd = result['properties']['storageProfile']['osDisk'].get('vhd')
+ if vhd is not None:
+ url = urlparse(vhd['uri'])
+ new_result['storage_account_name'] = url.netloc.split('.')[0]
+ new_result['storage_container_name'] = url.path.split('/')[1]
+ new_result['storage_blob_name'] = url.path.split('/')[-1]
+
+ new_result['os_disk_caching'] = result['properties']['storageProfile']['osDisk']['caching']
+ new_result['os_type'] = result['properties']['storageProfile']['osDisk']['osType']
+ new_result['data_disks'] = []
+ disks = result['properties']['storageProfile']['dataDisks']
+ for disk_index in range(len(disks)):
+ new_result['data_disks'].append({
+ 'lun': disks[disk_index].get('lun'),
+ 'disk_size_gb': disks[disk_index].get('diskSizeGB'),
+ 'managed_disk_type': disks[disk_index].get('managedDisk', {}).get('storageAccountType'),
+ 'caching': disks[disk_index].get('caching')
+ })
+
+ new_result['network_interface_names'] = []
+ nics = result['properties']['networkProfile']['networkInterfaces']
+ for nic_index in range(len(nics)):
+ new_result['network_interface_names'].append(re.sub('.*networkInterfaces/', '', nics[nic_index]['id']))
+
+ new_result['tags'] = vm.tags
+ return new_result
+
+
+def main():
+ AzureRMVirtualMachineInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_scaleset.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_scaleset.py
new file mode 100644
index 00000000..c0e4f606
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_scaleset.py
@@ -0,0 +1,1235 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Sertac Ozercan, <seozerca@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachinescaleset
+
+
+short_description: Manage Azure virtual machine scale sets
+
+description:
+ - Create and update a virtual machine scale set.
+ - Note that this module was called M(community.azure.azure_rm_virtualmachine_scaleset) before Ansible 2.8. The usage did not change.
+
+options:
+ resource_group:
+ description:
+ - Name of the resource group containing the virtual machine scale set.
+ required: true
+ name:
+ description:
+ - Name of the virtual machine.
+ required: true
+ state:
+ description:
+ - Assert the state of the virtual machine scale set.
+ - State C(present) will check that the machine exists with the requested configuration. If the configuration
+ of the existing machine does not match, the machine will be updated.
+ - State C(absent) will remove the virtual machine scale set.
+ default: present
+ choices:
+ - absent
+ - present
+ location:
+ description:
+ - Valid Azure location. Defaults to location of the resource group.
+ short_hostname:
+ description:
+ - Short host name.
+ vm_size:
+ description:
+ - A valid Azure VM size value. For example, C(Standard_D4).
+ - The list of choices varies depending on the subscription and location. Check your subscription for available choices.
+ capacity:
+ description:
+ - Capacity of VMSS.
+ default: 1
+ tier:
+ description:
+ - SKU Tier.
+ choices:
+ - Basic
+ - Standard
+ upgrade_policy:
+ description:
+ - Upgrade policy.
+ - Required when creating the Azure virtual machine scale sets.
+ choices:
+ - Manual
+ - Automatic
+ admin_username:
+ description:
+ - Admin username used to access the host after it is created. Required when creating a VM.
+ admin_password:
+ description:
+ - Password for the admin username.
+ - Not required if the os_type is Linux and SSH password authentication is disabled by setting I(ssh_password_enabled=false).
+ ssh_password_enabled:
+ description:
+ - When the os_type is Linux, setting I(ssh_password_enabled=false) will disable SSH password authentication and require use of SSH keys.
+ type: bool
+ default: true
+ ssh_public_keys:
+ description:
+ - For I(os_type=Linux) provide a list of SSH keys.
+ - Each item in the list should be a dictionary where the dictionary contains two keys, C(path) and C(key_data).
+ - Set the C(path) to the default location of the authorized_keys files.
+ - On an Enterprise Linux host, for example, the I(path=/home/<admin username>/.ssh/authorized_keys).
+ Set C(key_data) to the actual value of the public key.
+ image:
+ description:
+ - Specifies the image used to build the VM.
+ - If a string, the image is sourced from a custom image based on the name.
+ - If a dict with the keys I(publisher), I(offer), I(sku), and I(version), the image is sourced from a Marketplace image.
+ Note that set I(version=latest) to get the most recent version of a given image.
+ - If a dict with the keys I(name) and I(resource_group), the image is sourced from a custom image based on the I(name) and I(resource_group) set.
+ Note that the key I(resource_group) is optional and if omitted, all images in the subscription will be searched for by I(name).
+ - Custom image support was added in Ansible 2.5.
+ required: true
+ os_disk_caching:
+ description:
+ - Type of OS disk caching.
+ choices:
+ - ReadOnly
+ - ReadWrite
+ default: ReadOnly
+ aliases:
+ - disk_caching
+ os_type:
+ description:
+ - Base type of operating system.
+ choices:
+ - Windows
+ - Linux
+ default: Linux
+ managed_disk_type:
+ description:
+ - Managed disk type.
+ choices:
+ - Standard_LRS
+ - Premium_LRS
+ data_disks:
+ description:
+ - Describes list of data disks.
+ suboptions:
+ lun:
+ description:
+ - The logical unit number for data disk.
+ default: 0
+ disk_size_gb:
+ description:
+ - The initial disk size in GB for blank data disks.
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ choices:
+ - Standard_LRS
+ - Premium_LRS
+ caching:
+ description:
+ - Type of data disk caching.
+ choices:
+ - ReadOnly
+ - ReadWrite
+ default: ReadOnly
+ create_option:
+ description:
+ - Specify whether disk should be created Empty or FromImage. This is required to allow custom
+ images with data disks to be used.
+ choices:
+ - Empty
+ - FromImage
+ virtual_network_resource_group:
+ description:
+ - When creating a virtual machine, if a specific virtual network from another resource group should be
+ used.
+ - Use this parameter to specify the resource group to use.
+ virtual_network_name:
+ description:
+ - Virtual Network name.
+ aliases:
+ - virtual_network
+ subnet_name:
+ description:
+ - Subnet name.
+ aliases:
+ - subnet
+ load_balancer:
+ description:
+ - Load balancer name.
+ application_gateway:
+ description:
+ - Application gateway name.
+ remove_on_absent:
+ description:
+ - When removing a VM using I(state=absent), also remove associated resources.
+ - It can be C(all) or a list with any of the following ['network_interfaces', 'virtual_storage', 'public_ips'].
+ - Any other input will be ignored.
+ default: ['all']
+ enable_accelerated_networking:
+ description:
+ - Indicates whether user wants to allow accelerated networking for virtual machines in scaleset being created.
+ type: bool
+ security_group:
+ description:
+ - Existing security group with which to associate the subnet.
+ - It can be the security group name which is in the same resource group.
+ - It can be the resource ID.
+ - It can be a dict which contains I(name) and I(resource_group) of the security group.
+ aliases:
+ - security_group_name
+ overprovision:
+ description:
+ - Specifies whether the Virtual Machine Scale Set should be overprovisioned.
+ type: bool
+ default: True
+ single_placement_group:
+ description:
+ - When true this limits the scale set to a single placement group, of max size 100 virtual machines.
+ type: bool
+ default: True
+ plan:
+ description:
+ - Third-party billing plan for the VM.
+ type: dict
+ suboptions:
+ name:
+ description:
+ - Billing plan name.
+ required: true
+ product:
+ description:
+ - Product name.
+ required: true
+ publisher:
+ description:
+ - Publisher offering the plan.
+ required: true
+ promotion_code:
+ description:
+ - Optional promotion code.
+ zones:
+ description:
+ - A list of Availability Zones for your virtual machine scale set.
+ type: list
+ custom_data:
+ description:
+ - Data which is made available to the virtual machine and used by e.g., C(cloud-init).
+ - Many images in the marketplace are not cloud-init ready. Thus, data sent to I(custom_data) would be ignored.
+ - If the image you are attempting to use is not listed in
+ U(https://docs.microsoft.com/en-us/azure/virtual-machines/linux/using-cloud-init#cloud-init-overview),
+ follow these steps U(https://docs.microsoft.com/en-us/azure/virtual-machines/linux/cloudinit-prepare-custom-image).
+ scale_in_policy:
+ description:
+ - define the order in which vmss instances are scaled-in
+ choices:
+ - Default
+ - NewestVM
+ - OldestVM
+ terminate_event_timeout_minutes:
+ description:
+ - timeout time for termination notification event
+ - in range between 5 and 15
+ priority:
+ description:
+ - If you want to request low-priority VMs for the VMSS, set this to "Low". The default is "Regular"
+ default: Regular
+ choices:
+ - Regular
+ - Low
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Sertac Ozercan (@sozercan)
+
+'''
+EXAMPLES = '''
+
+- name: Create VMSS
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 2
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ terminate_event_timeout_minutes: 10
+ scale_in_policy: NewestVM
+ admin_username: adminUser
+ ssh_password_enabled: false
+ ssh_public_keys:
+ - path: /home/adminUser/.ssh/authorized_keys
+ key_data: < insert yor ssh public key here... >
+ managed_disk_type: Standard_LRS
+ image:
+ offer: CoreOS
+ publisher: CoreOS
+ sku: Stable
+ version: latest
+ data_disks:
+ - lun: 0
+ disk_size_gb: 64
+ caching: ReadWrite
+ managed_disk_type: Standard_LRS
+
+- name: Create VMSS with an image that requires plan information
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 3
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ ssh_password_enabled: false
+ ssh_public_keys:
+ - path: /home/adminUser/.ssh/authorized_keys
+ key_data: < insert yor ssh public key here... >
+ managed_disk_type: Standard_LRS
+ image:
+ offer: cis-ubuntu-linux-1804-l1
+ publisher: center-for-internet-security-inc
+ sku: Stable
+ version: latest
+ plan:
+ name: cis-ubuntu-linux-1804-l1
+ product: cis-ubuntu-linux-1804-l1
+ publisher: center-for-internet-security-inc
+ data_disks:
+ - lun: 0
+ disk_size_gb: 64
+ caching: ReadWrite
+ managed_disk_type: Standard_LRS
+
+- name: Create a VMSS with a custom image
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 2
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ admin_password: password01
+ managed_disk_type: Standard_LRS
+ image: customimage001
+
+- name: Create a VMSS with a custom image and override data disk
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 2
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ admin_password: password01
+ managed_disk_type: Standard_LRS
+ image: customimage001
+ data_disks:
+ - lun: 0
+ disk_size_gb: 64
+ caching: ReadWrite
+ managed_disk_type: Standard_LRS
+ create_option: FromImage
+
+- name: Create a VMSS with over 100 instances
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 120
+ single_placement_group: False
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ admin_password: password01
+ managed_disk_type: Standard_LRS
+ image: customimage001
+
+- name: Create a VMSS with a custom image from a particular resource group
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 2
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ admin_password: password01
+ managed_disk_type: Standard_LRS
+ image:
+ name: customimage001
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+azure_vmss:
+ description:
+ - Facts about the current state of the object.
+ - Note that facts are not part of the registered output but available directly.
+ returned: always
+ type: dict
+ sample: {
+ "properties": {
+ "overprovision": true,
+ "scaleInPolicy": {
+ "rules": [
+ "NewestVM"
+ ]
+ },
+ "singlePlacementGroup": true,
+ "upgradePolicy": {
+ "mode": "Manual"
+ },
+ "virtualMachineProfile": {
+ "networkProfile": {
+ "networkInterfaceConfigurations": [
+ {
+ "name": "testvmss",
+ "properties": {
+ "dnsSettings": {
+ "dnsServers": []
+ },
+ "enableAcceleratedNetworking": false,
+ "ipConfigurations": [
+ {
+ "name": "default",
+ "properties": {
+ "privateIPAddressVersion": "IPv4",
+ "subnet": {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"
+ }
+ }
+ }
+ ],
+ "primary": true
+ }
+ }
+ ]
+ },
+ "osProfile": {
+ "adminUsername": "testuser",
+ "computerNamePrefix": "testvmss",
+ "linuxConfiguration": {
+ "disablePasswordAuthentication": true,
+ "ssh": {
+ "publicKeys": [
+ {
+ "keyData": "",
+ "path": "/home/testuser/.ssh/authorized_keys"
+ }
+ ]
+ }
+ },
+ "secrets": []
+ },
+ "scheduledEventsProfile": {
+ "terminateNotificationProfile": {
+ "enable": true,
+ "notBeforeTimeout": "PT10M"
+ }
+ },
+ "storageProfile": {
+ "dataDisks": [
+ {
+ "caching": "ReadWrite",
+ "createOption": "empty",
+ "diskSizeGB": 64,
+ "lun": 0,
+ "managedDisk": {
+ "storageAccountType": "Standard_LRS"
+ }
+ }
+ ],
+ "imageReference": {
+ "offer": "CoreOS",
+ "publisher": "CoreOS",
+ "sku": "Stable",
+ "version": "899.17.0"
+ },
+ "osDisk": {
+ "caching": "ReadWrite",
+ "createOption": "fromImage",
+ "managedDisk": {
+ "storageAccountType": "Standard_LRS"
+ }
+ }
+ }
+ }
+ },
+ "sku": {
+ "capacity": 2,
+ "name": "Standard_DS1_v2",
+ "tier": "Standard"
+ },
+ "tags": null,
+ "type": "Microsoft.Compute/virtualMachineScaleSets"
+ }
+''' # NOQA
+
+import base64
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.tools import parse_resource_id
+
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict, format_resource_id
+from ansible.module_utils.basic import to_native, to_bytes
+
+
+AZURE_OBJECT_CLASS = 'VirtualMachineScaleSet'
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str', required=True),
+ name=dict(type='str', required=True),
+ state=dict(choices=['present', 'absent'], default='present', type='str'),
+ location=dict(type='str'),
+ short_hostname=dict(type='str'),
+ vm_size=dict(type='str'),
+ tier=dict(type='str', choices=['Basic', 'Standard']),
+ capacity=dict(type='int', default=1),
+ upgrade_policy=dict(type='str', choices=['Automatic', 'Manual']),
+ admin_username=dict(type='str'),
+ admin_password=dict(type='str', no_log=True),
+ ssh_password_enabled=dict(type='bool', default=True),
+ ssh_public_keys=dict(type='list'),
+ image=dict(type='raw'),
+ os_disk_caching=dict(type='str', aliases=['disk_caching'], choices=['ReadOnly', 'ReadWrite'],
+ default='ReadOnly'),
+ os_type=dict(type='str', choices=['Linux', 'Windows'], default='Linux'),
+ managed_disk_type=dict(type='str', choices=['Standard_LRS', 'Premium_LRS']),
+ data_disks=dict(type='list'),
+ subnet_name=dict(type='str', aliases=['subnet']),
+ load_balancer=dict(type='str'),
+ application_gateway=dict(type='str'),
+ virtual_network_resource_group=dict(type='str'),
+ virtual_network_name=dict(type='str', aliases=['virtual_network']),
+ remove_on_absent=dict(type='list', default=['all']),
+ enable_accelerated_networking=dict(type='bool'),
+ security_group=dict(type='raw', aliases=['security_group_name']),
+ overprovision=dict(type='bool', default=True),
+ single_placement_group=dict(type='bool', default=True),
+ zones=dict(type='list'),
+ custom_data=dict(type='str'),
+ plan=dict(type='dict', options=dict(publisher=dict(type='str', required=True),
+ product=dict(type='str', required=True), name=dict(type='str', required=True),
+ promotion_code=dict(type='str'))),
+ scale_in_policy=dict(type='str', choices=['Default', 'OldestVM', 'NewestVM']),
+ terminate_event_timeout_minutes=dict(type='int'),
+ priority=dict(type='str', choices=['Regular', 'Low'], default='Regular')
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.state = None
+ self.location = None
+ self.short_hostname = None
+ self.vm_size = None
+ self.capacity = None
+ self.tier = None
+ self.upgrade_policy = None
+ self.admin_username = None
+ self.admin_password = None
+ self.ssh_password_enabled = None
+ self.ssh_public_keys = None
+ self.image = None
+ self.os_disk_caching = None
+ self.managed_disk_type = None
+ self.data_disks = None
+ self.os_type = None
+ self.subnet_name = None
+ self.virtual_network_resource_group = None
+ self.virtual_network_name = None
+ self.tags = None
+ self.differences = None
+ self.load_balancer = None
+ self.application_gateway = None
+ self.enable_accelerated_networking = None
+ self.security_group = None
+ self.overprovision = None
+ self.single_placement_group = None
+ self.zones = None
+ self.custom_data = None
+ self.plan = None
+ self.scale_in_policy = None
+ self.terminate_event_timeout_minutes = None
+ self.priority = None
+
+ mutually_exclusive = [('load_balancer', 'application_gateway')]
+ self.results = dict(
+ changed=False,
+ actions=[],
+ ansible_facts=dict(azure_vmss=None)
+ )
+
+ super(AzureRMVirtualMachineScaleSet, self).__init__(
+ derived_arg_spec=self.module_arg_spec,
+ supports_check_mode=True,
+ mutually_exclusive=mutually_exclusive)
+
+ def exec_module(self, **kwargs):
+
+ for key in list(self.module_arg_spec.keys()) + ['tags']:
+ setattr(self, key, kwargs[key])
+
+ if self.module._name == 'azure_rm_virtualmachine_scaleset':
+ self.module.deprecate("The 'azure_rm_virtualmachine_scaleset' module has been renamed to 'azure_rm_virtualmachinescaleset'", version='2.12')
+
+ # make sure options are lower case
+ self.remove_on_absent = set([resource.lower() for resource in self.remove_on_absent])
+
+ # convert elements to ints
+ self.zones = [int(i) for i in self.zones] if self.zones else None
+
+ # default virtual_network_resource_group to resource_group
+ if not self.virtual_network_resource_group:
+ self.virtual_network_resource_group = self.resource_group
+
+ changed = False
+ results = dict()
+ vmss = None
+ disable_ssh_password = None
+ subnet = None
+ image_reference = None
+ load_balancer_backend_address_pools = None
+ load_balancer_inbound_nat_pools = None
+ load_balancer = None
+ application_gateway = None
+ application_gateway_backend_address_pools = None
+ support_lb_change = True
+
+ resource_group = self.get_resource_group(self.resource_group)
+ if not self.location:
+ # Set default location
+ self.location = resource_group.location
+
+ if self.custom_data:
+ self.custom_data = to_native(base64.b64encode(to_bytes(self.custom_data)))
+
+ if self.state == 'present':
+ # Verify parameters and resolve any defaults
+
+ if self.vm_size and not self.vm_size_is_valid():
+ self.fail("Parameter error: vm_size {0} is not valid for your subscription and location.".format(
+ self.vm_size
+ ))
+
+ # if self.virtual_network_name:
+ # virtual_network = self.get_virtual_network(self.virtual_network_name)
+
+ if self.ssh_public_keys:
+ msg = "Parameter error: expecting ssh_public_keys to be a list of type dict where " \
+ "each dict contains keys: path, key_data."
+ for key in self.ssh_public_keys:
+ if not isinstance(key, dict):
+ self.fail(msg)
+ if not key.get('path') or not key.get('key_data'):
+ self.fail(msg)
+
+ if self.image and isinstance(self.image, dict):
+ if all(key in self.image for key in ('publisher', 'offer', 'sku', 'version')):
+ marketplace_image = self.get_marketplace_image_version()
+ if self.image['version'] == 'latest':
+ self.image['version'] = marketplace_image.name
+ self.log("Using image version {0}".format(self.image['version']))
+
+ image_reference = self.compute_models.ImageReference(
+ publisher=self.image['publisher'],
+ offer=self.image['offer'],
+ sku=self.image['sku'],
+ version=self.image['version']
+ )
+ elif self.image.get('name'):
+ custom_image = True
+ image_reference = self.get_custom_image_reference(
+ self.image.get('name'),
+ self.image.get('resource_group'))
+ elif self.image.get('id'):
+ try:
+ image_reference = self.compute_models.ImageReference(id=self.image['id'])
+ except Exception as exc:
+ self.fail("id Error: Cannot get image from the reference id - {0}".format(self.image['id']))
+ else:
+ self.fail("parameter error: expecting image to contain [publisher, offer, sku, version], [name, resource_group] or [id]")
+ elif self.image and isinstance(self.image, str):
+ custom_image = True
+ image_reference = self.get_custom_image_reference(self.image)
+ elif self.image:
+ self.fail("parameter error: expecting image to be a string or dict not {0}".format(type(self.image).__name__))
+
+ disable_ssh_password = not self.ssh_password_enabled
+
+ if self.load_balancer:
+ load_balancer = self.get_load_balancer(self.load_balancer)
+ load_balancer_backend_address_pools = ([self.compute_models.SubResource(id=resource.id)
+ for resource in load_balancer.backend_address_pools]
+ if load_balancer.backend_address_pools else None)
+ load_balancer_inbound_nat_pools = ([self.compute_models.SubResource(id=resource.id)
+ for resource in load_balancer.inbound_nat_pools]
+ if load_balancer.inbound_nat_pools else None)
+
+ if self.application_gateway:
+ application_gateway = self.get_application_gateway(self.application_gateway)
+ application_gateway_backend_address_pools = ([self.compute_models.SubResource(id=resource.id)
+ for resource in application_gateway.backend_address_pools]
+ if application_gateway.backend_address_pools else None)
+
+ try:
+ self.log("Fetching virtual machine scale set {0}".format(self.name))
+ vmss = self.compute_client.virtual_machine_scale_sets.get(self.resource_group, self.name)
+ self.check_provisioning_state(vmss, self.state)
+ vmss_dict = self.serialize_vmss(vmss)
+
+ if self.state == 'present':
+ differences = []
+ results = vmss_dict
+
+ if self.os_disk_caching and \
+ self.os_disk_caching != vmss_dict['properties']['virtualMachineProfile']['storageProfile']['osDisk']['caching']:
+ self.log('CHANGED: virtual machine scale set {0} - OS disk caching'.format(self.name))
+ differences.append('OS Disk caching')
+ changed = True
+ vmss_dict['properties']['virtualMachineProfile']['storageProfile']['osDisk']['caching'] = self.os_disk_caching
+
+ if self.capacity and \
+ self.capacity != vmss_dict['sku']['capacity']:
+ self.log('CHANGED: virtual machine scale set {0} - Capacity'.format(self.name))
+ differences.append('Capacity')
+ changed = True
+ vmss_dict['sku']['capacity'] = self.capacity
+
+ if self.data_disks and \
+ len(self.data_disks) != len(vmss_dict['properties']['virtualMachineProfile']['storageProfile'].get('dataDisks', [])):
+ self.log('CHANGED: virtual machine scale set {0} - Data Disks'.format(self.name))
+ differences.append('Data Disks')
+ changed = True
+
+ if self.upgrade_policy and \
+ self.upgrade_policy != vmss_dict['properties']['upgradePolicy']['mode']:
+ self.log('CHANGED: virtual machine scale set {0} - Upgrade Policy'.format(self.name))
+ differences.append('Upgrade Policy')
+ changed = True
+ vmss_dict['properties']['upgradePolicy']['mode'] = self.upgrade_policy
+
+ if image_reference and \
+ image_reference.as_dict() != vmss_dict['properties']['virtualMachineProfile']['storageProfile']['imageReference']:
+ self.log('CHANGED: virtual machine scale set {0} - Image'.format(self.name))
+ differences.append('Image')
+ changed = True
+ vmss_dict['properties']['virtualMachineProfile']['storageProfile']['imageReference'] = image_reference.as_dict()
+
+ update_tags, vmss_dict['tags'] = self.update_tags(vmss_dict.get('tags', dict()))
+ if update_tags:
+ differences.append('Tags')
+ changed = True
+
+ if bool(self.overprovision) != bool(vmss_dict['properties']['overprovision']):
+ differences.append('overprovision')
+ changed = True
+
+ if bool(self.single_placement_group) != bool(vmss_dict['properties']['singlePlacementGroup']):
+ differences.append('single_placement_group')
+ changed = True
+
+ vmss_dict['zones'] = [int(i) for i in vmss_dict['zones']] if 'zones' in vmss_dict and vmss_dict['zones'] else None
+ if self.zones != vmss_dict['zones']:
+ self.log("CHANGED: virtual machine scale sets {0} zones".format(self.name))
+ differences.append('Zones')
+ changed = True
+ vmss_dict['zones'] = self.zones
+
+ if self.terminate_event_timeout_minutes:
+ timeout = self.terminate_event_timeout_minutes
+ if timeout < 5 or timeout > 15:
+ self.fail("terminate_event_timeout_minutes should >= 5 and <= 15")
+ iso_8601_format = "PT" + str(timeout) + "M"
+ old = vmss_dict['properties']['virtualMachineProfile'].get('scheduledEventsProfile', {}).\
+ get('terminateNotificationProfile', {}).get('notBeforeTimeout', "")
+ if old != iso_8601_format:
+ differences.append('terminateNotification')
+ changed = True
+ vmss_dict['properties']['virtualMachineProfile'].setdefault('scheduledEventsProfile', {})['terminateNotificationProfile'] = {
+ 'notBeforeTimeout': iso_8601_format,
+ "enable": 'true'
+ }
+
+ if self.scale_in_policy and self.scale_in_policy != vmss_dict['properties'].get('scaleInPolicy', {}).get('rules', [""])[0]:
+ self.log("CHANGED: virtual machine sale sets {0} scale in policy".format(self.name))
+ differences.append('scaleInPolicy')
+ changed = True
+ vmss_dict['properties'].setdefault('scaleInPolicy', {})['rules'] = [self.scale_in_policy]
+
+ nicConfigs = vmss_dict['properties']['virtualMachineProfile']['networkProfile']['networkInterfaceConfigurations']
+
+ backend_address_pool = nicConfigs[0]['properties']['ipConfigurations'][0]['properties'].get('loadBalancerBackendAddressPools', [])
+ backend_address_pool += nicConfigs[0]['properties']['ipConfigurations'][0]['properties'].get('applicationGatewayBackendAddressPools', [])
+ lb_or_ag_id = None
+ if (len(nicConfigs) != 1 or len(backend_address_pool) != 1):
+ support_lb_change = False # Currently not support for the vmss contains more than one loadbalancer
+ self.module.warn('Updating more than one load balancer on VMSS is currently not supported')
+ else:
+ if load_balancer:
+ lb_or_ag_id = "{0}/".format(load_balancer.id)
+ elif application_gateway:
+ lb_or_ag_id = "{0}/".format(application_gateway.id)
+
+ backend_address_pool_id = backend_address_pool[0].get('id')
+ if lb_or_ag_id is not None and (bool(lb_or_ag_id) != bool(backend_address_pool_id) or not backend_address_pool_id.startswith(lb_or_ag_id)):
+ differences.append('load_balancer')
+ changed = True
+
+ if self.custom_data:
+ if self.custom_data != vmss_dict['properties']['virtualMachineProfile']['osProfile'].get('customData'):
+ differences.append('custom_data')
+ changed = True
+ vmss_dict['properties']['virtualMachineProfile']['osProfile']['customData'] = self.custom_data
+
+ self.differences = differences
+
+ elif self.state == 'absent':
+ self.log("CHANGED: virtual machine scale set {0} exists and requested state is 'absent'".format(self.name))
+ results = dict()
+ changed = True
+
+ except CloudError:
+ self.log('Virtual machine scale set {0} does not exist'.format(self.name))
+ if self.state == 'present':
+ self.log("CHANGED: virtual machine scale set {0} does not exist but state is 'present'.".format(self.name))
+ changed = True
+
+ self.results['changed'] = changed
+ self.results['ansible_facts']['azure_vmss'] = results
+
+ if self.check_mode:
+ return self.results
+
+ if changed:
+ if self.state == 'present':
+ if not vmss:
+ # Create the VMSS
+ if self.vm_size is None:
+ self.fail("vm size must be set")
+
+ self.log("Create virtual machine scale set {0}".format(self.name))
+ self.results['actions'].append('Created VMSS {0}'.format(self.name))
+
+ if self.os_type == 'Linux':
+ if disable_ssh_password and not self.ssh_public_keys:
+ self.fail("Parameter error: ssh_public_keys required when disabling SSH password.")
+
+ if not self.virtual_network_name:
+ self.fail("virtual network name is required")
+
+ if self.subnet_name:
+ subnet = self.get_subnet(self.virtual_network_name, self.subnet_name)
+
+ if not self.short_hostname:
+ self.short_hostname = self.name
+
+ if not image_reference:
+ self.fail("Parameter error: an image is required when creating a virtual machine.")
+
+ managed_disk = self.compute_models.VirtualMachineScaleSetManagedDiskParameters(storage_account_type=self.managed_disk_type)
+
+ if self.security_group:
+ nsg = self.parse_nsg()
+ if nsg:
+ self.security_group = self.network_models.NetworkSecurityGroup(id=nsg.get('id'))
+
+ plan = None
+ if self.plan:
+ plan = self.compute_models.Plan(name=self.plan.get('name'), product=self.plan.get('product'),
+ publisher=self.plan.get('publisher'),
+ promotion_code=self.plan.get('promotion_code'))
+
+ os_profile = None
+ if self.admin_username or self.custom_data or self.ssh_public_keys:
+ os_profile = self.compute_models.VirtualMachineScaleSetOSProfile(
+ admin_username=self.admin_username,
+ computer_name_prefix=self.short_hostname,
+ custom_data=self.custom_data
+ )
+
+ vmss_resource = self.compute_models.VirtualMachineScaleSet(
+ location=self.location,
+ overprovision=self.overprovision,
+ single_placement_group=self.single_placement_group,
+ tags=self.tags,
+ upgrade_policy=self.compute_models.UpgradePolicy(
+ mode=self.upgrade_policy
+ ),
+ sku=self.compute_models.Sku(
+ name=self.vm_size,
+ capacity=self.capacity,
+ tier=self.tier,
+ ),
+ plan=plan,
+ virtual_machine_profile=self.compute_models.VirtualMachineScaleSetVMProfile(
+ priority=self.priority,
+ os_profile=os_profile,
+ storage_profile=self.compute_models.VirtualMachineScaleSetStorageProfile(
+ os_disk=self.compute_models.VirtualMachineScaleSetOSDisk(
+ managed_disk=managed_disk,
+ create_option=self.compute_models.DiskCreateOptionTypes.from_image,
+ caching=self.os_disk_caching,
+ ),
+ image_reference=image_reference,
+ ),
+ network_profile=self.compute_models.VirtualMachineScaleSetNetworkProfile(
+ network_interface_configurations=[
+ self.compute_models.VirtualMachineScaleSetNetworkConfiguration(
+ name=self.name,
+ primary=True,
+ ip_configurations=[
+ self.compute_models.VirtualMachineScaleSetIPConfiguration(
+ name='default',
+ subnet=self.compute_models.ApiEntityReference(
+ id=subnet.id
+ ),
+ primary=True,
+ load_balancer_backend_address_pools=load_balancer_backend_address_pools,
+ load_balancer_inbound_nat_pools=load_balancer_inbound_nat_pools,
+ application_gateway_backend_address_pools=application_gateway_backend_address_pools
+ )
+ ],
+ enable_accelerated_networking=self.enable_accelerated_networking,
+ network_security_group=self.security_group
+ )
+ ]
+ )
+ ),
+ zones=self.zones
+ )
+
+ if self.scale_in_policy:
+ vmss_resource.scale_in_policy = self.gen_scale_in_policy()
+
+ if self.terminate_event_timeout_minutes:
+ vmss_resource.virtual_machine_profile.scheduled_events_profile = self.gen_scheduled_event_profile()
+
+ if self.admin_password:
+ vmss_resource.virtual_machine_profile.os_profile.admin_password = self.admin_password
+
+ if self.os_type == 'Linux' and os_profile:
+ vmss_resource.virtual_machine_profile.os_profile.linux_configuration = self.compute_models.LinuxConfiguration(
+ disable_password_authentication=disable_ssh_password
+ )
+
+ if self.ssh_public_keys:
+ ssh_config = self.compute_models.SshConfiguration()
+ ssh_config.public_keys = \
+ [self.compute_models.SshPublicKey(path=key['path'], key_data=key['key_data']) for key in self.ssh_public_keys]
+ vmss_resource.virtual_machine_profile.os_profile.linux_configuration.ssh = ssh_config
+
+ if self.data_disks:
+ data_disks = []
+
+ for data_disk in self.data_disks:
+ data_disk_managed_disk = self.compute_models.VirtualMachineScaleSetManagedDiskParameters(
+ storage_account_type=data_disk.get('managed_disk_type', None)
+ )
+
+ data_disk['caching'] = data_disk.get(
+ 'caching',
+ self.compute_models.CachingTypes.read_only
+ )
+
+ data_disks.append(self.compute_models.VirtualMachineScaleSetDataDisk(
+ lun=data_disk.get('lun', None),
+ caching=data_disk.get('caching', None),
+ create_option=data_disk.get('create_option', self.compute_models.DiskCreateOptionTypes.empty),
+ disk_size_gb=data_disk.get('disk_size_gb', None),
+ managed_disk=data_disk_managed_disk,
+ ))
+
+ vmss_resource.virtual_machine_profile.storage_profile.data_disks = data_disks
+
+ if self.plan:
+ try:
+ plan_name = self.plan.get('name')
+ plan_product = self.plan.get('product')
+ plan_publisher = self.plan.get('publisher')
+ term = self.marketplace_client.marketplace_agreements.get(
+ publisher_id=plan_publisher, offer_id=plan_product, plan_id=plan_name)
+ term.accepted = True
+ self.marketplace_client.marketplace_agreements.create(
+ publisher_id=plan_publisher, offer_id=plan_product, plan_id=plan_name, parameters=term)
+ except Exception as exc:
+ self.fail(("Error accepting terms for virtual machine {0} with plan {1}. " +
+ "Only service admin/account admin users can purchase images " +
+ "from the marketplace. - {2}").format(self.name, self.plan, str(exc)))
+
+ self.log("Create virtual machine with parameters:")
+ self.create_or_update_vmss(vmss_resource)
+
+ elif self.differences and len(self.differences) > 0:
+ self.log("Update virtual machine scale set {0}".format(self.name))
+ self.results['actions'].append('Updated VMSS {0}'.format(self.name))
+
+ vmss_resource = self.get_vmss()
+ vmss_resource.virtual_machine_profile.storage_profile.os_disk.caching = self.os_disk_caching
+ vmss_resource.sku.capacity = self.capacity
+ vmss_resource.overprovision = self.overprovision
+ vmss_resource.single_placement_group = self.single_placement_group
+
+ if support_lb_change:
+ if self.load_balancer:
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].load_balancer_backend_address_pools = load_balancer_backend_address_pools
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].application_gateway_backend_address_pools = None
+ elif self.application_gateway:
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].application_gateway_backend_address_pools = application_gateway_backend_address_pools
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].load_balancer_backend_address_pools = None
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].load_balancer_inbound_nat_pools = None
+
+ if self.data_disks is not None:
+ data_disks = []
+ for data_disk in self.data_disks:
+ data_disks.append(self.compute_models.VirtualMachineScaleSetDataDisk(
+ lun=data_disk['lun'],
+ caching=data_disk['caching'],
+ create_option=data_disk.get('create_option', self.compute_models.DiskCreateOptionTypes.empty),
+ disk_size_gb=data_disk['disk_size_gb'],
+ managed_disk=self.compute_models.VirtualMachineScaleSetManagedDiskParameters(
+ storage_account_type=data_disk.get('managed_disk_type', None)
+ ),
+ ))
+ vmss_resource.virtual_machine_profile.storage_profile.data_disks = data_disks
+
+ if self.scale_in_policy:
+ vmss_resource.scale_in_policy = self.gen_scale_in_policy()
+
+ if self.terminate_event_timeout_minutes:
+ vmss_resource.virtual_machine_profile.scheduled_events_profile = self.gen_scheduled_event_profile()
+
+ if image_reference is not None:
+ vmss_resource.virtual_machine_profile.storage_profile.image_reference = image_reference
+ self.log("Update virtual machine with parameters:")
+ self.create_or_update_vmss(vmss_resource)
+
+ self.results['ansible_facts']['azure_vmss'] = self.serialize_vmss(self.get_vmss())
+
+ elif self.state == 'absent':
+ # delete the VM
+ self.log("Delete virtual machine scale set {0}".format(self.name))
+ self.results['ansible_facts']['azure_vmss'] = None
+ self.delete_vmss(vmss)
+
+ # until we sort out how we want to do this globally
+ del self.results['actions']
+
+ return self.results
+
+ def get_vmss(self):
+ '''
+ Get the VMSS
+
+ :return: VirtualMachineScaleSet object
+ '''
+ try:
+ vmss = self.compute_client.virtual_machine_scale_sets.get(self.resource_group, self.name)
+ return vmss
+ except CloudError as exc:
+ self.fail("Error getting virtual machine scale set {0} - {1}".format(self.name, str(exc)))
+
+ def get_virtual_network(self, name):
+ try:
+ vnet = self.network_client.virtual_networks.get(self.virtual_network_resource_group, name)
+ return vnet
+ except CloudError as exc:
+ self.fail("Error fetching virtual network {0} - {1}".format(name, str(exc)))
+
+ def get_subnet(self, vnet_name, subnet_name):
+ self.log("Fetching subnet {0} in virtual network {1}".format(subnet_name, vnet_name))
+ try:
+ subnet = self.network_client.subnets.get(self.virtual_network_resource_group, vnet_name, subnet_name)
+ except CloudError as exc:
+ self.fail("Error: fetching subnet {0} in virtual network {1} - {2}".format(
+ subnet_name,
+ vnet_name,
+ str(exc)))
+ return subnet
+
+ def get_load_balancer(self, id):
+ id_dict = parse_resource_id(id)
+ try:
+ return self.network_client.load_balancers.get(id_dict.get('resource_group', self.resource_group), id_dict.get('name'))
+ except CloudError as exc:
+ self.fail("Error fetching load balancer {0} - {1}".format(id, str(exc)))
+
+ def get_application_gateway(self, id):
+ id_dict = parse_resource_id(id)
+ try:
+ return self.network_client.application_gateways.get(id_dict.get('resource_group', self.resource_group), id_dict.get('name'))
+ except CloudError as exc:
+ self.fail("Error fetching application_gateway {0} - {1}".format(id, str(exc)))
+
+ def serialize_vmss(self, vmss):
+ '''
+ Convert a VirtualMachineScaleSet object to dict.
+
+ :param vm: VirtualMachineScaleSet object
+ :return: dict
+ '''
+
+ result = self.serialize_obj(vmss, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES)
+ result['id'] = vmss.id
+ result['name'] = vmss.name
+ result['type'] = vmss.type
+ result['location'] = vmss.location
+ result['tags'] = vmss.tags
+
+ return result
+
+ def delete_vmss(self, vmss):
+ self.log("Deleting virtual machine scale set {0}".format(self.name))
+ self.results['actions'].append("Deleted virtual machine scale set {0}".format(self.name))
+ try:
+ poller = self.compute_client.virtual_machine_scale_sets.delete(self.resource_group, self.name)
+ # wait for the poller to finish
+ self.get_poller_result(poller)
+ except CloudError as exc:
+ self.fail("Error deleting virtual machine scale set {0} - {1}".format(self.name, str(exc)))
+
+ return True
+
+ def get_marketplace_image_version(self):
+ try:
+ versions = self.compute_client.virtual_machine_images.list(self.location,
+ self.image['publisher'],
+ self.image['offer'],
+ self.image['sku'])
+ except CloudError as exc:
+ self.fail("Error fetching image {0} {1} {2} - {3}".format(self.image['publisher'],
+ self.image['offer'],
+ self.image['sku'],
+ str(exc)))
+ if versions and len(versions) > 0:
+ if self.image['version'] == 'latest':
+ return versions[len(versions) - 1]
+ for version in versions:
+ if version.name == self.image['version']:
+ return version
+
+ self.fail("Error could not find image {0} {1} {2} {3}".format(self.image['publisher'],
+ self.image['offer'],
+ self.image['sku'],
+ self.image['version']))
+
+ def get_custom_image_reference(self, name, resource_group=None):
+ try:
+ if resource_group:
+ vm_images = self.compute_client.images.list_by_resource_group(resource_group)
+ else:
+ vm_images = self.compute_client.images.list()
+ except Exception as exc:
+ self.fail("Error fetching custom images from subscription - {0}".format(str(exc)))
+
+ for vm_image in vm_images:
+ if vm_image.name == name:
+ self.log("Using custom image id {0}".format(vm_image.id))
+ return self.compute_models.ImageReference(id=vm_image.id)
+
+ self.fail("Error could not find image with name {0}".format(name))
+
+ def create_or_update_vmss(self, params):
+ try:
+ poller = self.compute_client.virtual_machine_scale_sets.create_or_update(self.resource_group, self.name, params)
+ self.get_poller_result(poller)
+ except CloudError as exc:
+ self.fail("Error creating or updating virtual machine {0} - {1}".format(self.name, str(exc)))
+
+ def vm_size_is_valid(self):
+ '''
+ Validate self.vm_size against the list of virtual machine sizes available for the account and location.
+
+ :return: boolean
+ '''
+ try:
+ sizes = self.compute_client.virtual_machine_sizes.list(self.location)
+ except CloudError as exc:
+ self.fail("Error retrieving available machine sizes - {0}".format(str(exc)))
+ for size in sizes:
+ if size.name == self.vm_size:
+ return True
+ return False
+
+ def parse_nsg(self):
+ nsg = self.security_group
+ resource_group = self.resource_group
+ if isinstance(self.security_group, dict):
+ nsg = self.security_group.get('name')
+ resource_group = self.security_group.get('resource_group', self.resource_group)
+ id = format_resource_id(val=nsg,
+ subscription_id=self.subscription_id,
+ namespace='Microsoft.Network',
+ types='networkSecurityGroups',
+ resource_group=resource_group)
+ name = azure_id_to_dict(id).get('name')
+ return dict(id=id, name=name)
+
+ def gen_scheduled_event_profile(self):
+ if self.terminate_event_timeout_minutes is None:
+ return None
+
+ scheduledEventProfile = self.compute_models.ScheduledEventsProfile()
+ terminationProfile = self.compute_models.TerminateNotificationProfile()
+ terminationProfile.not_before_timeout = "PT" + str(self.terminate_event_timeout_minutes) + "M"
+ terminationProfile.enable = True
+ scheduledEventProfile.terminate_notification_profile = terminationProfile
+ return scheduledEventProfile
+
+ def gen_scale_in_policy(self):
+ if self.scale_in_policy is None:
+ return None
+
+ return self.compute_models.ScaleInPolicy(rules=[self.scale_in_policy])
+
+
+def main():
+ AzureRMVirtualMachineScaleSet()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_scaleset_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_scaleset_facts.py
new file mode 100644
index 00000000..9146bee7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachine_scaleset_facts.py
@@ -0,0 +1,436 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2017, Sertac Ozercan <seozerca@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachinescaleset_info
+
+
+short_description: Get Virtual Machine Scale Set facts
+
+description:
+ - Get facts for a virtual machine scale set.
+ - Note that this module was called M(community.azure.azure_rm_virtualmachine_scaleset_facts) before Ansible 2.8. The usage did not change.
+
+options:
+ name:
+ description:
+ - Limit results to a specific virtual machine scale set.
+ resource_group:
+ description:
+ - The resource group to search for the desired virtual machine scale set.
+ tags:
+ description:
+ - List of tags to be matched.
+ format:
+ description:
+ - Format of the data returned.
+ - If C(raw) is selected information will be returned in raw format from Azure Python SDK.
+ - If C(curated) is selected the structure will be identical to input parameters of M(community.azure.azure_rm_virtualmachinescaleset) module.
+ - In Ansible 2.5 and lower facts are always returned in raw format.
+ - Please note that this option will be deprecated in 2.10 when curated format will become the only supported format.
+ default: 'raw'
+ choices:
+ - 'curated'
+ - 'raw'
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Sertac Ozercan (@sozercan)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for a virtual machine scale set
+ community.azure.azure_rm_virtualmachinescaleset_info:
+ resource_group: myResourceGroup
+ name: testvmss001
+ format: curated
+
+ - name: Get facts for all virtual networks
+ community.azure.azure_rm_virtualmachinescaleset_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by tags
+ community.azure.azure_rm_virtualmachinescaleset_info:
+ resource_group: myResourceGroup
+ tags:
+ - testing
+'''
+
+RETURN = '''
+vmss:
+ description:
+ - List of virtual machine scale sets.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/scalesets/myscaleset
+ admin_username:
+ description:
+ - Admin username used to access the host after it is created.
+ returned: always
+ type: str
+ sample: adminuser
+ capacity:
+ description:
+ - Capacity of VMSS.
+ returned: always
+ type: int
+ sample: 2
+ data_disks:
+ description:
+ - List of attached data disks.
+ returned: always
+ type: complex
+ contains:
+ caching:
+ description:
+ - Type of data disk caching.
+ returned: always
+ type: str
+ sample: ReadOnly
+ disk_size_gb:
+ description:
+ - The initial disk size in GB for blank data disks.
+ returned: always
+ type: int
+ sample: 64
+ lun:
+ description:
+ - The logical unit number for data disk.
+ returned: always
+ type: int
+ sample: 0
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ returned: always
+ type: str
+ sample: Standard_LRS
+ image:
+ description:
+ - Image specification.
+ returned: always
+ type: complex
+ contains:
+ offer:
+ description:
+ - The offer of the platform image or marketplace image used to create the virtual machine.
+ returned: always
+ type: str
+ sample: RHEL
+ publisher:
+ description:
+ - Publisher name.
+ returned: always
+ type: str
+ sample: RedHat
+ sku:
+ description:
+ - SKU name.
+ returned: always
+ type: str
+ sample: 7-RAW
+ version:
+ description:
+ - Image version.
+ returned: always
+ type: str
+ sample: 7.5.2018050901
+ load_balancer:
+ description:
+ - Load balancer name.
+ returned: always
+ type: str
+ sample: testlb
+ location:
+ description:
+ - Resource location.
+ type: str
+ returned: always
+ sample: japaneast
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ type: str
+ returned: always
+ sample: Standard_LRS
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myvmss
+ os_disk_caching:
+ description:
+ - Type of OS disk caching.
+ type: str
+ returned: always
+ sample: ReadOnly
+ os_type:
+ description:
+ - Base type of operating system.
+ type: str
+ returned: always
+ sample: Linux
+ overprovision:
+ description:
+ - Specifies whether the Virtual Machine Scale Set should be overprovisioned.
+ type: bool
+ sample: true
+ resource_group:
+ description:
+ - Resource group.
+ type: str
+ returned: always
+ sample: myResourceGroup
+ ssh_password_enabled:
+ description:
+ - Is SSH password authentication enabled. Valid only for Linux.
+ type: bool
+ returned: always
+ sample: true
+ subnet_name:
+ description:
+ - Subnet name.
+ type: str
+ returned: always
+ sample: testsubnet
+ tier:
+ description:
+ - SKU Tier.
+ type: str
+ returned: always
+ sample: Basic
+ upgrade_policy:
+ description:
+ - Upgrade policy.
+ type: str
+ returned: always
+ sample: Manual
+ virtual_network_name:
+ description:
+ - Associated virtual network name.
+ type: str
+ returned: always
+ sample: testvn
+ vm_size:
+ description:
+ - Virtual machine size.
+ type: str
+ returned: always
+ sample: Standard_D4
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ returned: always
+ type: dict
+ sample: { "tag1": "abc" }
+''' # NOQA
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+import re
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'VirtualMachineScaleSet'
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMVirtualMachineScaleSetInfo(AzureRMModuleBase):
+ """Utility class to get virtual machine scale set facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ format=dict(
+ type='str',
+ choices=['curated',
+ 'raw'],
+ default='raw'
+ )
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.format = None
+ self.tags = None
+
+ super(AzureRMVirtualMachineScaleSetInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachinescaleset_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachinescaleset_facts' module has been renamed to 'azure_rm_virtualmachinescaleset_info'",
+ version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ result = self.get_item()
+ else:
+ result = self.list_items()
+
+ if self.format == 'curated':
+ for index in range(len(result)):
+ vmss = result[index]
+ subnet_name = None
+ load_balancer_name = None
+ virtual_network_name = None
+ ssh_password_enabled = False
+
+ try:
+ subnet_id = (vmss['properties']['virtualMachineProfile']['networkProfile']['networkInterfaceConfigurations'][0]
+ ['properties']['ipConfigurations'][0]['properties']['subnet']['id'])
+ subnet_name = re.sub('.*subnets\\/', '', subnet_id)
+ except Exception:
+ self.log('Could not extract subnet name')
+
+ try:
+ backend_address_pool_id = (vmss['properties']['virtualMachineProfile']['networkProfile']['networkInterfaceConfigurations'][0]
+ ['properties']['ipConfigurations'][0]['properties']['loadBalancerBackendAddressPools'][0]['id'])
+ load_balancer_name = re.sub('\\/backendAddressPools.*', '', re.sub('.*loadBalancers\\/', '', backend_address_pool_id))
+ virtual_network_name = re.sub('.*virtualNetworks\\/', '', re.sub('\\/subnets.*', '', subnet_id))
+ except Exception:
+ self.log('Could not extract load balancer / virtual network name')
+
+ try:
+ ssh_password_enabled = (not vmss['properties']['virtualMachineProfile']['osProfile']
+ ['linuxConfiguration']['disablePasswordAuthentication'])
+ except Exception:
+ self.log('Could not extract SSH password enabled')
+
+ data_disks = vmss['properties']['virtualMachineProfile']['storageProfile'].get('dataDisks', [])
+
+ for disk_index in range(len(data_disks)):
+ old_disk = data_disks[disk_index]
+ new_disk = {
+ 'lun': old_disk['lun'],
+ 'disk_size_gb': old_disk['diskSizeGB'],
+ 'managed_disk_type': old_disk['managedDisk']['storageAccountType'],
+ 'caching': old_disk['caching']
+ }
+ data_disks[disk_index] = new_disk
+
+ updated = {
+ 'id': vmss['id'],
+ 'resource_group': self.resource_group,
+ 'name': vmss['name'],
+ 'state': 'present',
+ 'location': vmss['location'],
+ 'vm_size': vmss['sku']['name'],
+ 'capacity': vmss['sku']['capacity'],
+ 'tier': vmss['sku']['tier'],
+ 'upgrade_policy': vmss['properties']['upgradePolicy']['mode'],
+ 'admin_username': vmss['properties']['virtualMachineProfile']['osProfile']['adminUsername'],
+ 'admin_password': vmss['properties']['virtualMachineProfile']['osProfile'].get('adminPassword'),
+ 'ssh_password_enabled': ssh_password_enabled,
+ 'image': vmss['properties']['virtualMachineProfile']['storageProfile']['imageReference'],
+ 'os_disk_caching': vmss['properties']['virtualMachineProfile']['storageProfile']['osDisk']['caching'],
+ 'os_type': 'Linux' if (vmss['properties']['virtualMachineProfile']['osProfile'].get('linuxConfiguration') is not None) else 'Windows',
+ 'overprovision': vmss['properties']['overprovision'],
+ 'managed_disk_type': vmss['properties']['virtualMachineProfile']['storageProfile']['osDisk']['managedDisk']['storageAccountType'],
+ 'data_disks': data_disks,
+ 'virtual_network_name': virtual_network_name,
+ 'subnet_name': subnet_name,
+ 'load_balancer': load_balancer_name,
+ 'tags': vmss.get('tags')
+ }
+
+ result[index] = updated
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_vmss': result
+ }
+ if self.format == 'curated':
+ # proper result format we want to support in the future
+ # dropping 'ansible_facts' and shorter name 'vmss'
+ self.results['vmss'] = result
+ else:
+ self.results['vmss'] = result
+
+ return self.results
+
+ def get_item(self):
+ """Get a single virtual machine scale set"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ results = []
+
+ try:
+ item = self.compute_client.virtual_machine_scale_sets.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ results = [self.serialize_obj(item, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES)]
+
+ return results
+
+ def list_items(self):
+ """Get all virtual machine scale sets"""
+
+ self.log('List all virtual machine scale sets')
+
+ try:
+ response = self.compute_client.virtual_machine_scale_sets.list(self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_obj(item, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES))
+
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMVirtualMachineScaleSetInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension.py
new file mode 100644
index 00000000..a2dff8cd
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension.py
@@ -0,0 +1,339 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2017 Sertac Ozercan <seozerca@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachineextension
+
+
+short_description: Managed Azure Virtual Machine extension
+
+description:
+ - Create, update and delete Azure Virtual Machine Extension.
+ - Note that this module was called M(community.azure.azure_rm_virtualmachine_extension) before Ansible 2.8. The usage did not change.
+
+options:
+ resource_group:
+ description:
+ - Name of a resource group where the vm extension exists or will be created.
+ required: true
+ name:
+ description:
+ - Name of the vm extension.
+ required: true
+ state:
+ description:
+ - State of the vm extension. Use C(present) to create or update a vm extension and C(absent) to delete a vm extension.
+ default: present
+ choices:
+ - absent
+ - present
+ location:
+ description:
+ - Valid Azure location. Defaults to location of the resource group.
+ virtual_machine_name:
+ description:
+ - The name of the virtual machine where the extension should be create or updated.
+ publisher:
+ description:
+ - The name of the extension handler publisher.
+ virtual_machine_extension_type:
+ description:
+ - The type of the extension handler.
+ type_handler_version:
+ description:
+ - The type version of the extension handler.
+ settings:
+ description:
+ - Json formatted public settings for the extension.
+ protected_settings:
+ description:
+ - Json formatted protected settings for the extension.
+ auto_upgrade_minor_version:
+ description:
+ - Whether the extension handler should be automatically upgraded across minor versions.
+ type: bool
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Sertac Ozercan (@sozercan)
+ - Julien Stroheker (@julienstroheker)
+'''
+
+EXAMPLES = '''
+ - name: Create VM Extension
+ community.azure.azure_rm_virtualmachineextension:
+ name: myvmextension
+ location: eastus
+ resource_group: myResourceGroup
+ virtual_machine_name: myvm
+ publisher: Microsoft.Azure.Extensions
+ virtual_machine_extension_type: CustomScript
+ type_handler_version: 2.0
+ settings: '{"commandToExecute": "hostname"}'
+ auto_upgrade_minor_version: true
+
+ - name: Delete VM Extension
+ community.azure.azure_rm_virtualmachineextension:
+ name: myvmextension
+ location: eastus
+ resource_group: myResourceGroup
+ virtual_machine_name: myvm
+ state: absent
+'''
+
+RETURN = '''
+state:
+ description:
+ - Current state of the vm extension.
+ returned: always
+ type: dict
+ sample: { "state":"Deleted" }
+
+changed:
+ description:
+ - Whether or not the resource has changed.
+ returned: always
+ type: bool
+ sample: true
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+def vmextension_to_dict(extension):
+ '''
+ Serializing the VM Extension from the API to Dict
+ :return: dict
+ '''
+ return dict(
+ id=extension.id,
+ name=extension.name,
+ location=extension.location,
+ publisher=extension.publisher,
+ virtual_machine_extension_type=extension.virtual_machine_extension_type,
+ type_handler_version=extension.type_handler_version,
+ auto_upgrade_minor_version=extension.auto_upgrade_minor_version,
+ settings=extension.settings,
+ protected_settings=extension.protected_settings,
+ )
+
+
+class AzureRMVMExtension(AzureRMModuleBase):
+ """Configuration class for an Azure RM VM Extension resource"""
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str',
+ required=True
+ ),
+ state=dict(
+ type='str',
+ default='present',
+ choices=['present', 'absent']
+ ),
+ location=dict(
+ type='str'
+ ),
+ virtual_machine_name=dict(
+ type='str'
+ ),
+ publisher=dict(
+ type='str'
+ ),
+ virtual_machine_extension_type=dict(
+ type='str'
+ ),
+ type_handler_version=dict(
+ type='str'
+ ),
+ auto_upgrade_minor_version=dict(
+ type='bool'
+ ),
+ settings=dict(
+ type='dict'
+ ),
+ protected_settings=dict(
+ type='dict'
+ )
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.location = None
+ self.publisher = None
+ self.virtual_machine_extension_type = None
+ self.type_handler_version = None
+ self.auto_upgrade_minor_version = None
+ self.settings = None
+ self.protected_settings = None
+ self.state = None
+
+ required_if = [
+ ('state', 'present', [
+ 'publisher', 'virtual_machine_extension_type', 'type_handler_version'])
+ ]
+
+ self.results = dict(changed=False, state=dict())
+
+ super(AzureRMVMExtension, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_check_mode=False,
+ supports_tags=False,
+ required_if=required_if)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+
+ for key in list(self.module_arg_spec.keys()):
+ setattr(self, key, kwargs[key])
+
+ if self.module._name == 'azure_rm_virtualmachine_extension':
+ self.module.deprecate("The 'azure_rm_virtualmachine_extension' module has been renamed to 'azure_rm_virtualmachineextension'", version='2.12')
+
+ resource_group = None
+ response = None
+ to_be_updated = False
+
+ resource_group = self.get_resource_group(self.resource_group)
+ if not self.location:
+ self.location = resource_group.location
+
+ if self.state == 'present':
+ response = self.get_vmextension()
+ if not response:
+ to_be_updated = True
+ else:
+ if self.settings is not None:
+ if response['settings'] != self.settings:
+ response['settings'] = self.settings
+ to_be_updated = True
+ else:
+ self.settings = response['settings']
+
+ if self.protected_settings is not None:
+ if response['protected_settings'] != self.protected_settings:
+ response['protected_settings'] = self.protected_settings
+ to_be_updated = True
+ else:
+ self.protected_settings = response['protected_settings']
+
+ if response['location'] != self.location:
+ self.location = response['location']
+ self.module.warn("Property 'location' cannot be changed")
+
+ if response['publisher'] != self.publisher:
+ self.publisher = response['publisher']
+ self.module.warn("Property 'publisher' cannot be changed")
+
+ if response['virtual_machine_extension_type'] != self.virtual_machine_extension_type:
+ self.virtual_machine_extension_type = response['virtual_machine_extension_type']
+ self.module.warn("Property 'virtual_machine_extension_type' cannot be changed")
+
+ if response['type_handler_version'] != self.type_handler_version:
+ response['type_handler_version'] = self.type_handler_version
+ to_be_updated = True
+
+ if self.auto_upgrade_minor_version is not None:
+ if response['auto_upgrade_minor_version'] != self.auto_upgrade_minor_version:
+ response['auto_upgrade_minor_version'] = self.auto_upgrade_minor_version
+ to_be_updated = True
+ else:
+ self.auto_upgrade_minor_version = response['auto_upgrade_minor_version']
+
+ if to_be_updated:
+ self.results['changed'] = True
+ self.results['state'] = self.create_or_update_vmextension()
+ elif self.state == 'absent':
+ self.delete_vmextension()
+ self.results['changed'] = True
+
+ return self.results
+
+ def create_or_update_vmextension(self):
+ '''
+ Method calling the Azure SDK to create or update the VM extension.
+ :return: void
+ '''
+ self.log("Creating VM extension {0}".format(self.name))
+ try:
+ params = self.compute_models.VirtualMachineExtension(
+ location=self.location,
+ publisher=self.publisher,
+ virtual_machine_extension_type=self.virtual_machine_extension_type,
+ type_handler_version=self.type_handler_version,
+ auto_upgrade_minor_version=self.auto_upgrade_minor_version,
+ settings=self.settings,
+ protected_settings=self.protected_settings
+ )
+ poller = self.compute_client.virtual_machine_extensions.create_or_update(self.resource_group, self.virtual_machine_name, self.name, params)
+ response = self.get_poller_result(poller)
+ return vmextension_to_dict(response)
+
+ except CloudError as e:
+ self.log('Error attempting to create the VM extension.')
+ self.fail("Error creating the VM extension: {0}".format(str(e)))
+
+ def delete_vmextension(self):
+ '''
+ Method calling the Azure SDK to delete the VM Extension.
+ :return: void
+ '''
+ self.log("Deleting vmextension {0}".format(self.name))
+ try:
+ poller = self.compute_client.virtual_machine_extensions.delete(self.resource_group, self.virtual_machine_name, self.name)
+ self.get_poller_result(poller)
+ except CloudError as e:
+ self.log('Error attempting to delete the vmextension.')
+ self.fail("Error deleting the vmextension: {0}".format(str(e)))
+
+ def get_vmextension(self):
+ '''
+ Method calling the Azure SDK to get a VM Extension.
+ :return: void
+ '''
+ self.log("Checking if the vm extension {0} is present".format(self.name))
+ found = False
+ try:
+ response = self.compute_client.virtual_machine_extensions.get(self.resource_group, self.virtual_machine_name, self.name)
+ found = True
+ except CloudError as e:
+ self.log('Did not find vm extension')
+ if found:
+ return vmextension_to_dict(response)
+ else:
+ return False
+
+
+def main():
+ """Main execution"""
+ AzureRMVMExtension()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension_facts.py
new file mode 100644
index 00000000..f65edeaa
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension_facts.py
@@ -0,0 +1,248 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachineextension_info
+short_description: Get Azure Virtual Machine Extension facts
+description:
+ - Get facts of Azure Virtual Machine Extension.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ virtual_machine_name:
+ description:
+ - The name of the virtual machine containing the extension.
+ required: True
+ name:
+ description:
+ - The name of the virtual machine extension.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get information on specific Virtual Machine Extension
+ community.azure.azure_rm_virtualmachineextension_info:
+ resource_group: myResourceGroup
+ virtual_machine_name: myvm
+ name: myextension
+
+ - name: List installed Virtual Machine Extensions
+ community.azure.azure_rm_virtualmachineextension_info:
+ resource_group: myResourceGroup
+ virtual_machine_name: myvm
+'''
+
+RETURN = '''
+extensions:
+ description:
+ - A list of dictionaries containing facts for Virtual Machine Extension.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myvm/testVM/extens
+ ions/myextension"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ virtual_machine_name:
+ description:
+ - Virtual machine name.
+ returned: always
+ type: str
+ sample: myvm
+ name:
+ description:
+ - Virtual machine name.
+ returned: always
+ type: str
+ sample: myextension
+ location:
+ description:
+ - The resource location.
+ returned: always
+ type: str
+ sample: eastus
+ publisher:
+ description:
+ - Extension publisher.
+ returned: always
+ type: str
+ sample: Microsoft.Azure.Extensions
+ type:
+ description:
+ - Extension type.
+ returned: always
+ type: str
+ sample: CustomScript
+ settings:
+ description:
+ - Extension specific settings dictionary.
+ returned: always
+ type: dict
+ sample: { 'commandToExecute':'hostname' }
+ auto_upgrade_minor_version:
+ description:
+ - Autoupgrade minor version flag.
+ returned: always
+ type: bool
+ sample: true
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { "mytag":"abc" }
+ provisioning_state:
+ description:
+ - Provisioning state of the extension.
+ returned: always
+ type: str
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMVirtualMachineExtensionInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ virtual_machine_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.virtual_machine_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMVirtualMachineExtensionInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachineextension_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachineextension_facts' module has been renamed to 'azure_rm_virtualmachineextension_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ self.results['extensions'] = self.get_extensions()
+ else:
+ self.results['extensions'] = self.list_extensions()
+
+ return self.results
+
+ def get_extensions(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_extensions.get(resource_group_name=self.resource_group,
+ vm_name=self.virtual_machine_name,
+ vm_extension_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Extension.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list_extensions(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_extensions.list(resource_group_name=self.resource_group,
+ vm_name=self.virtual_machine_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Extension.')
+
+ if response is not None and response.value is not None:
+ for item in response.value:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id', None),
+ 'resource_group': self.resource_group,
+ 'virtual_machine_name': self.virtual_machine_name,
+ 'location': d.get('location'),
+ 'name': d.get('name'),
+ 'publisher': d.get('publisher'),
+ 'type': d.get('virtual_machine_extension_type'),
+ 'settings': d.get('settings'),
+ 'auto_upgrade_minor_version': d.get('auto_upgrade_minor_version'),
+ 'tags': d.get('tags', None),
+ 'provisioning_state': d.get('provisioning_state')
+ }
+ return d
+
+
+def main():
+ AzureRMVirtualMachineExtensionInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension_info.py
new file mode 100644
index 00000000..f65edeaa
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineextension_info.py
@@ -0,0 +1,248 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachineextension_info
+short_description: Get Azure Virtual Machine Extension facts
+description:
+ - Get facts of Azure Virtual Machine Extension.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ virtual_machine_name:
+ description:
+ - The name of the virtual machine containing the extension.
+ required: True
+ name:
+ description:
+ - The name of the virtual machine extension.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get information on specific Virtual Machine Extension
+ community.azure.azure_rm_virtualmachineextension_info:
+ resource_group: myResourceGroup
+ virtual_machine_name: myvm
+ name: myextension
+
+ - name: List installed Virtual Machine Extensions
+ community.azure.azure_rm_virtualmachineextension_info:
+ resource_group: myResourceGroup
+ virtual_machine_name: myvm
+'''
+
+RETURN = '''
+extensions:
+ description:
+ - A list of dictionaries containing facts for Virtual Machine Extension.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/myvm/testVM/extens
+ ions/myextension"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ virtual_machine_name:
+ description:
+ - Virtual machine name.
+ returned: always
+ type: str
+ sample: myvm
+ name:
+ description:
+ - Virtual machine name.
+ returned: always
+ type: str
+ sample: myextension
+ location:
+ description:
+ - The resource location.
+ returned: always
+ type: str
+ sample: eastus
+ publisher:
+ description:
+ - Extension publisher.
+ returned: always
+ type: str
+ sample: Microsoft.Azure.Extensions
+ type:
+ description:
+ - Extension type.
+ returned: always
+ type: str
+ sample: CustomScript
+ settings:
+ description:
+ - Extension specific settings dictionary.
+ returned: always
+ type: dict
+ sample: { 'commandToExecute':'hostname' }
+ auto_upgrade_minor_version:
+ description:
+ - Autoupgrade minor version flag.
+ returned: always
+ type: bool
+ sample: true
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { "mytag":"abc" }
+ provisioning_state:
+ description:
+ - Provisioning state of the extension.
+ returned: always
+ type: str
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMVirtualMachineExtensionInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ virtual_machine_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.virtual_machine_name = None
+ self.name = None
+ self.tags = None
+ super(AzureRMVirtualMachineExtensionInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachineextension_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachineextension_facts' module has been renamed to 'azure_rm_virtualmachineextension_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ self.results['extensions'] = self.get_extensions()
+ else:
+ self.results['extensions'] = self.list_extensions()
+
+ return self.results
+
+ def get_extensions(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_extensions.get(resource_group_name=self.resource_group,
+ vm_name=self.virtual_machine_name,
+ vm_extension_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Extension.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list_extensions(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_extensions.list(resource_group_name=self.resource_group,
+ vm_name=self.virtual_machine_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Extension.')
+
+ if response is not None and response.value is not None:
+ for item in response.value:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+ d = {
+ 'id': d.get('id', None),
+ 'resource_group': self.resource_group,
+ 'virtual_machine_name': self.virtual_machine_name,
+ 'location': d.get('location'),
+ 'name': d.get('name'),
+ 'publisher': d.get('publisher'),
+ 'type': d.get('virtual_machine_extension_type'),
+ 'settings': d.get('settings'),
+ 'auto_upgrade_minor_version': d.get('auto_upgrade_minor_version'),
+ 'tags': d.get('tags', None),
+ 'provisioning_state': d.get('provisioning_state')
+ }
+ return d
+
+
+def main():
+ AzureRMVirtualMachineExtensionInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineimage_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineimage_facts.py
new file mode 100644
index 00000000..fe5f0fcf
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineimage_facts.py
@@ -0,0 +1,258 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachineimage_info
+
+
+short_description: Get virtual machine image facts
+
+description:
+ - Get facts for virtual machine images.
+
+options:
+ location:
+ description:
+ - Azure location value, for example C(westus), C(eastus), C(eastus2), C(northcentralus), etc.
+ - Supplying only a location value will yield a list of available publishers for the location.
+ required: true
+ publisher:
+ description:
+ - Name of an image publisher. List image offerings associated with a particular publisher.
+ offer:
+ description:
+ - Name of an image offering. Combine with SKU to see a list of available image versions.
+ sku:
+ description:
+ - Image offering SKU. Combine with offer to see a list of available versions.
+ version:
+ description:
+ - Specific version number of an image.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for a specific image
+ community.azure.azure_rm_virtualmachineimage_info:
+ location: eastus
+ publisher: OpenLogic
+ offer: CentOS
+ sku: '7.1'
+ version: '7.1.20160308'
+
+ - name: List available versions
+ community.azure.azure_rm_virtualmachineimage_info:
+ location: eastus
+ publisher: OpenLogic
+ offer: CentOS
+ sku: '7.1'
+
+ - name: List available offers
+ community.azure.azure_rm_virtualmachineimage_info:
+ location: eastus
+ publisher: OpenLogic
+
+ - name: List available publishers
+ community.azure.azure_rm_virtualmachineimage_info:
+ location: eastus
+
+'''
+
+RETURN = '''
+azure_vmimages:
+ description:
+ - List of image dicts.
+ returned: always
+ type: list
+ example: [ {
+ "id": "/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/
+ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20150410",
+ "location": "eastus",
+ "name": "7.1.20150410"
+ },
+ {
+ "id": "/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/
+ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20150605",
+ "location": "eastus",
+ "name": "7.1.20150605"
+ },
+ {
+ "id": "/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/
+ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20150731",
+ "location": "eastus",
+ "name": "7.1.20150731"
+ },
+ {
+ "id": "/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/
+ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20160308",
+ "location": "eastus",
+ "name": "7.1.20160308"
+ }
+ ]
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMVirtualMachineImageInfo(AzureRMModuleBase):
+
+ def __init__(self, **kwargs):
+
+ self.module_arg_spec = dict(
+ location=dict(type='str', required=True),
+ publisher=dict(type='str'),
+ offer=dict(type='str'),
+ sku=dict(type='str'),
+ version=dict(type='str')
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.location = None
+ self.publisher = None
+ self.offer = None
+ self.sku = None
+ self.version = None
+
+ super(AzureRMVirtualMachineImageInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachineimage_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachineimage_facts' module has been renamed to 'azure_rm_virtualmachineimage_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if is_old_facts:
+ self.results['ansible_facts'] = dict()
+ if self.location and self.publisher and self.offer and self.sku and self.version:
+ self.results['ansible_facts']['azure_vmimages'] = self.get_item()
+ elif self.location and self.publisher and self.offer and self.sku:
+ self.results['ansible_facts']['azure_vmimages'] = self.list_images()
+ elif self.location and self.publisher:
+ self.results['ansible_facts']['azure_vmimages'] = self.list_offers()
+ elif self.location:
+ self.results['ansible_facts']['azure_vmimages'] = self.list_publishers()
+ else:
+ if self.location and self.publisher and self.offer and self.sku and self.version:
+ self.results['vmimages'] = self.get_item()
+ elif self.location and self.publisher and self.offer and self.sku:
+ self.results['vmimages'] = self.list_images()
+ elif self.location and self.publisher:
+ self.results['vmimages'] = self.list_offers()
+ elif self.location:
+ self.results['vmimages'] = self.list_publishers()
+
+ return self.results
+
+ def get_item(self):
+ item = None
+ result = []
+
+ try:
+ item = self.compute_client.virtual_machine_images.get(self.location,
+ self.publisher,
+ self.offer,
+ self.sku,
+ self.version)
+ except CloudError:
+ pass
+
+ if item:
+ result = [self.serialize_obj(item, 'VirtualMachineImage', enum_modules=AZURE_ENUM_MODULES)]
+
+ return result
+
+ def list_images(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_images.list(self.location,
+ self.publisher,
+ self.offer,
+ self.sku,)
+ except CloudError:
+ pass
+ except Exception as exc:
+ self.fail("Failed to list images: {0}".format(str(exc)))
+
+ if response:
+ for item in response:
+ results.append(self.serialize_obj(item, 'VirtualMachineImageResource',
+ enum_modules=AZURE_ENUM_MODULES))
+ return results
+
+ def list_offers(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_images.list_offers(self.location,
+ self.publisher)
+ except CloudError:
+ pass
+ except Exception as exc:
+ self.fail("Failed to list offers: {0}".format(str(exc)))
+
+ if response:
+ for item in response:
+ results.append(self.serialize_obj(item, 'VirtualMachineImageResource',
+ enum_modules=AZURE_ENUM_MODULES))
+ return results
+
+ def list_publishers(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_images.list_publishers(self.location)
+ except CloudError:
+ pass
+ except Exception as exc:
+ self.fail("Failed to list publishers: {0}".format(str(exc)))
+
+ if response:
+ for item in response:
+ results.append(self.serialize_obj(item, 'VirtualMachineImageResource',
+ enum_modules=AZURE_ENUM_MODULES))
+ return results
+
+
+def main():
+ AzureRMVirtualMachineImageInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineimage_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineimage_info.py
new file mode 100644
index 00000000..fe5f0fcf
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachineimage_info.py
@@ -0,0 +1,258 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachineimage_info
+
+
+short_description: Get virtual machine image facts
+
+description:
+ - Get facts for virtual machine images.
+
+options:
+ location:
+ description:
+ - Azure location value, for example C(westus), C(eastus), C(eastus2), C(northcentralus), etc.
+ - Supplying only a location value will yield a list of available publishers for the location.
+ required: true
+ publisher:
+ description:
+ - Name of an image publisher. List image offerings associated with a particular publisher.
+ offer:
+ description:
+ - Name of an image offering. Combine with SKU to see a list of available image versions.
+ sku:
+ description:
+ - Image offering SKU. Combine with offer to see a list of available versions.
+ version:
+ description:
+ - Specific version number of an image.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for a specific image
+ community.azure.azure_rm_virtualmachineimage_info:
+ location: eastus
+ publisher: OpenLogic
+ offer: CentOS
+ sku: '7.1'
+ version: '7.1.20160308'
+
+ - name: List available versions
+ community.azure.azure_rm_virtualmachineimage_info:
+ location: eastus
+ publisher: OpenLogic
+ offer: CentOS
+ sku: '7.1'
+
+ - name: List available offers
+ community.azure.azure_rm_virtualmachineimage_info:
+ location: eastus
+ publisher: OpenLogic
+
+ - name: List available publishers
+ community.azure.azure_rm_virtualmachineimage_info:
+ location: eastus
+
+'''
+
+RETURN = '''
+azure_vmimages:
+ description:
+ - List of image dicts.
+ returned: always
+ type: list
+ example: [ {
+ "id": "/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/
+ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20150410",
+ "location": "eastus",
+ "name": "7.1.20150410"
+ },
+ {
+ "id": "/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/
+ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20150605",
+ "location": "eastus",
+ "name": "7.1.20150605"
+ },
+ {
+ "id": "/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/
+ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20150731",
+ "location": "eastus",
+ "name": "7.1.20150731"
+ },
+ {
+ "id": "/Subscriptions/xxx...xxx/Providers/Microsoft.Compute/Locations/eastus/
+ Publishers/OpenLogic/ArtifactTypes/VMImage/Offers/CentOS/Skus/7.1/Versions/7.1.20160308",
+ "location": "eastus",
+ "name": "7.1.20160308"
+ }
+ ]
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMVirtualMachineImageInfo(AzureRMModuleBase):
+
+ def __init__(self, **kwargs):
+
+ self.module_arg_spec = dict(
+ location=dict(type='str', required=True),
+ publisher=dict(type='str'),
+ offer=dict(type='str'),
+ sku=dict(type='str'),
+ version=dict(type='str')
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.location = None
+ self.publisher = None
+ self.offer = None
+ self.sku = None
+ self.version = None
+
+ super(AzureRMVirtualMachineImageInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachineimage_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachineimage_facts' module has been renamed to 'azure_rm_virtualmachineimage_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if is_old_facts:
+ self.results['ansible_facts'] = dict()
+ if self.location and self.publisher and self.offer and self.sku and self.version:
+ self.results['ansible_facts']['azure_vmimages'] = self.get_item()
+ elif self.location and self.publisher and self.offer and self.sku:
+ self.results['ansible_facts']['azure_vmimages'] = self.list_images()
+ elif self.location and self.publisher:
+ self.results['ansible_facts']['azure_vmimages'] = self.list_offers()
+ elif self.location:
+ self.results['ansible_facts']['azure_vmimages'] = self.list_publishers()
+ else:
+ if self.location and self.publisher and self.offer and self.sku and self.version:
+ self.results['vmimages'] = self.get_item()
+ elif self.location and self.publisher and self.offer and self.sku:
+ self.results['vmimages'] = self.list_images()
+ elif self.location and self.publisher:
+ self.results['vmimages'] = self.list_offers()
+ elif self.location:
+ self.results['vmimages'] = self.list_publishers()
+
+ return self.results
+
+ def get_item(self):
+ item = None
+ result = []
+
+ try:
+ item = self.compute_client.virtual_machine_images.get(self.location,
+ self.publisher,
+ self.offer,
+ self.sku,
+ self.version)
+ except CloudError:
+ pass
+
+ if item:
+ result = [self.serialize_obj(item, 'VirtualMachineImage', enum_modules=AZURE_ENUM_MODULES)]
+
+ return result
+
+ def list_images(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_images.list(self.location,
+ self.publisher,
+ self.offer,
+ self.sku,)
+ except CloudError:
+ pass
+ except Exception as exc:
+ self.fail("Failed to list images: {0}".format(str(exc)))
+
+ if response:
+ for item in response:
+ results.append(self.serialize_obj(item, 'VirtualMachineImageResource',
+ enum_modules=AZURE_ENUM_MODULES))
+ return results
+
+ def list_offers(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_images.list_offers(self.location,
+ self.publisher)
+ except CloudError:
+ pass
+ except Exception as exc:
+ self.fail("Failed to list offers: {0}".format(str(exc)))
+
+ if response:
+ for item in response:
+ results.append(self.serialize_obj(item, 'VirtualMachineImageResource',
+ enum_modules=AZURE_ENUM_MODULES))
+ return results
+
+ def list_publishers(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_images.list_publishers(self.location)
+ except CloudError:
+ pass
+ except Exception as exc:
+ self.fail("Failed to list publishers: {0}".format(str(exc)))
+
+ if response:
+ for item in response:
+ results.append(self.serialize_obj(item, 'VirtualMachineImageResource',
+ enum_modules=AZURE_ENUM_MODULES))
+ return results
+
+
+def main():
+ AzureRMVirtualMachineImageInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset.py
new file mode 100644
index 00000000..c0e4f606
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset.py
@@ -0,0 +1,1235 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Sertac Ozercan, <seozerca@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachinescaleset
+
+
+short_description: Manage Azure virtual machine scale sets
+
+description:
+ - Create and update a virtual machine scale set.
+ - Note that this module was called M(community.azure.azure_rm_virtualmachine_scaleset) before Ansible 2.8. The usage did not change.
+
+options:
+ resource_group:
+ description:
+ - Name of the resource group containing the virtual machine scale set.
+ required: true
+ name:
+ description:
+ - Name of the virtual machine.
+ required: true
+ state:
+ description:
+ - Assert the state of the virtual machine scale set.
+ - State C(present) will check that the machine exists with the requested configuration. If the configuration
+ of the existing machine does not match, the machine will be updated.
+ - State C(absent) will remove the virtual machine scale set.
+ default: present
+ choices:
+ - absent
+ - present
+ location:
+ description:
+ - Valid Azure location. Defaults to location of the resource group.
+ short_hostname:
+ description:
+ - Short host name.
+ vm_size:
+ description:
+ - A valid Azure VM size value. For example, C(Standard_D4).
+ - The list of choices varies depending on the subscription and location. Check your subscription for available choices.
+ capacity:
+ description:
+ - Capacity of VMSS.
+ default: 1
+ tier:
+ description:
+ - SKU Tier.
+ choices:
+ - Basic
+ - Standard
+ upgrade_policy:
+ description:
+ - Upgrade policy.
+ - Required when creating the Azure virtual machine scale sets.
+ choices:
+ - Manual
+ - Automatic
+ admin_username:
+ description:
+ - Admin username used to access the host after it is created. Required when creating a VM.
+ admin_password:
+ description:
+ - Password for the admin username.
+ - Not required if the os_type is Linux and SSH password authentication is disabled by setting I(ssh_password_enabled=false).
+ ssh_password_enabled:
+ description:
+ - When the os_type is Linux, setting I(ssh_password_enabled=false) will disable SSH password authentication and require use of SSH keys.
+ type: bool
+ default: true
+ ssh_public_keys:
+ description:
+ - For I(os_type=Linux) provide a list of SSH keys.
+ - Each item in the list should be a dictionary where the dictionary contains two keys, C(path) and C(key_data).
+ - Set the C(path) to the default location of the authorized_keys files.
+ - On an Enterprise Linux host, for example, the I(path=/home/<admin username>/.ssh/authorized_keys).
+ Set C(key_data) to the actual value of the public key.
+ image:
+ description:
+ - Specifies the image used to build the VM.
+ - If a string, the image is sourced from a custom image based on the name.
+ - If a dict with the keys I(publisher), I(offer), I(sku), and I(version), the image is sourced from a Marketplace image.
+ Note that set I(version=latest) to get the most recent version of a given image.
+ - If a dict with the keys I(name) and I(resource_group), the image is sourced from a custom image based on the I(name) and I(resource_group) set.
+ Note that the key I(resource_group) is optional and if omitted, all images in the subscription will be searched for by I(name).
+ - Custom image support was added in Ansible 2.5.
+ required: true
+ os_disk_caching:
+ description:
+ - Type of OS disk caching.
+ choices:
+ - ReadOnly
+ - ReadWrite
+ default: ReadOnly
+ aliases:
+ - disk_caching
+ os_type:
+ description:
+ - Base type of operating system.
+ choices:
+ - Windows
+ - Linux
+ default: Linux
+ managed_disk_type:
+ description:
+ - Managed disk type.
+ choices:
+ - Standard_LRS
+ - Premium_LRS
+ data_disks:
+ description:
+ - Describes list of data disks.
+ suboptions:
+ lun:
+ description:
+ - The logical unit number for data disk.
+ default: 0
+ disk_size_gb:
+ description:
+ - The initial disk size in GB for blank data disks.
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ choices:
+ - Standard_LRS
+ - Premium_LRS
+ caching:
+ description:
+ - Type of data disk caching.
+ choices:
+ - ReadOnly
+ - ReadWrite
+ default: ReadOnly
+ create_option:
+ description:
+ - Specify whether disk should be created Empty or FromImage. This is required to allow custom
+ images with data disks to be used.
+ choices:
+ - Empty
+ - FromImage
+ virtual_network_resource_group:
+ description:
+ - When creating a virtual machine, if a specific virtual network from another resource group should be
+ used.
+ - Use this parameter to specify the resource group to use.
+ virtual_network_name:
+ description:
+ - Virtual Network name.
+ aliases:
+ - virtual_network
+ subnet_name:
+ description:
+ - Subnet name.
+ aliases:
+ - subnet
+ load_balancer:
+ description:
+ - Load balancer name.
+ application_gateway:
+ description:
+ - Application gateway name.
+ remove_on_absent:
+ description:
+ - When removing a VM using I(state=absent), also remove associated resources.
+ - It can be C(all) or a list with any of the following ['network_interfaces', 'virtual_storage', 'public_ips'].
+ - Any other input will be ignored.
+ default: ['all']
+ enable_accelerated_networking:
+ description:
+ - Indicates whether user wants to allow accelerated networking for virtual machines in scaleset being created.
+ type: bool
+ security_group:
+ description:
+ - Existing security group with which to associate the subnet.
+ - It can be the security group name which is in the same resource group.
+ - It can be the resource ID.
+ - It can be a dict which contains I(name) and I(resource_group) of the security group.
+ aliases:
+ - security_group_name
+ overprovision:
+ description:
+ - Specifies whether the Virtual Machine Scale Set should be overprovisioned.
+ type: bool
+ default: True
+ single_placement_group:
+ description:
+ - When true this limits the scale set to a single placement group, of max size 100 virtual machines.
+ type: bool
+ default: True
+ plan:
+ description:
+ - Third-party billing plan for the VM.
+ type: dict
+ suboptions:
+ name:
+ description:
+ - Billing plan name.
+ required: true
+ product:
+ description:
+ - Product name.
+ required: true
+ publisher:
+ description:
+ - Publisher offering the plan.
+ required: true
+ promotion_code:
+ description:
+ - Optional promotion code.
+ zones:
+ description:
+ - A list of Availability Zones for your virtual machine scale set.
+ type: list
+ custom_data:
+ description:
+ - Data which is made available to the virtual machine and used by e.g., C(cloud-init).
+ - Many images in the marketplace are not cloud-init ready. Thus, data sent to I(custom_data) would be ignored.
+ - If the image you are attempting to use is not listed in
+ U(https://docs.microsoft.com/en-us/azure/virtual-machines/linux/using-cloud-init#cloud-init-overview),
+ follow these steps U(https://docs.microsoft.com/en-us/azure/virtual-machines/linux/cloudinit-prepare-custom-image).
+ scale_in_policy:
+ description:
+ - define the order in which vmss instances are scaled-in
+ choices:
+ - Default
+ - NewestVM
+ - OldestVM
+ terminate_event_timeout_minutes:
+ description:
+ - timeout time for termination notification event
+ - in range between 5 and 15
+ priority:
+ description:
+ - If you want to request low-priority VMs for the VMSS, set this to "Low". The default is "Regular"
+ default: Regular
+ choices:
+ - Regular
+ - Low
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+- azure.azcollection.azure_tags
+
+
+author:
+ - Sertac Ozercan (@sozercan)
+
+'''
+EXAMPLES = '''
+
+- name: Create VMSS
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 2
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ terminate_event_timeout_minutes: 10
+ scale_in_policy: NewestVM
+ admin_username: adminUser
+ ssh_password_enabled: false
+ ssh_public_keys:
+ - path: /home/adminUser/.ssh/authorized_keys
+ key_data: < insert yor ssh public key here... >
+ managed_disk_type: Standard_LRS
+ image:
+ offer: CoreOS
+ publisher: CoreOS
+ sku: Stable
+ version: latest
+ data_disks:
+ - lun: 0
+ disk_size_gb: 64
+ caching: ReadWrite
+ managed_disk_type: Standard_LRS
+
+- name: Create VMSS with an image that requires plan information
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 3
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ ssh_password_enabled: false
+ ssh_public_keys:
+ - path: /home/adminUser/.ssh/authorized_keys
+ key_data: < insert yor ssh public key here... >
+ managed_disk_type: Standard_LRS
+ image:
+ offer: cis-ubuntu-linux-1804-l1
+ publisher: center-for-internet-security-inc
+ sku: Stable
+ version: latest
+ plan:
+ name: cis-ubuntu-linux-1804-l1
+ product: cis-ubuntu-linux-1804-l1
+ publisher: center-for-internet-security-inc
+ data_disks:
+ - lun: 0
+ disk_size_gb: 64
+ caching: ReadWrite
+ managed_disk_type: Standard_LRS
+
+- name: Create a VMSS with a custom image
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 2
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ admin_password: password01
+ managed_disk_type: Standard_LRS
+ image: customimage001
+
+- name: Create a VMSS with a custom image and override data disk
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 2
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ admin_password: password01
+ managed_disk_type: Standard_LRS
+ image: customimage001
+ data_disks:
+ - lun: 0
+ disk_size_gb: 64
+ caching: ReadWrite
+ managed_disk_type: Standard_LRS
+ create_option: FromImage
+
+- name: Create a VMSS with over 100 instances
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 120
+ single_placement_group: False
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ admin_password: password01
+ managed_disk_type: Standard_LRS
+ image: customimage001
+
+- name: Create a VMSS with a custom image from a particular resource group
+ community.azure.azure_rm_virtualmachinescaleset:
+ resource_group: myResourceGroup
+ name: testvmss
+ vm_size: Standard_DS1_v2
+ capacity: 2
+ virtual_network_name: testvnet
+ upgrade_policy: Manual
+ subnet_name: testsubnet
+ admin_username: adminUser
+ admin_password: password01
+ managed_disk_type: Standard_LRS
+ image:
+ name: customimage001
+ resource_group: myResourceGroup
+'''
+
+RETURN = '''
+azure_vmss:
+ description:
+ - Facts about the current state of the object.
+ - Note that facts are not part of the registered output but available directly.
+ returned: always
+ type: dict
+ sample: {
+ "properties": {
+ "overprovision": true,
+ "scaleInPolicy": {
+ "rules": [
+ "NewestVM"
+ ]
+ },
+ "singlePlacementGroup": true,
+ "upgradePolicy": {
+ "mode": "Manual"
+ },
+ "virtualMachineProfile": {
+ "networkProfile": {
+ "networkInterfaceConfigurations": [
+ {
+ "name": "testvmss",
+ "properties": {
+ "dnsSettings": {
+ "dnsServers": []
+ },
+ "enableAcceleratedNetworking": false,
+ "ipConfigurations": [
+ {
+ "name": "default",
+ "properties": {
+ "privateIPAddressVersion": "IPv4",
+ "subnet": {
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"
+ }
+ }
+ }
+ ],
+ "primary": true
+ }
+ }
+ ]
+ },
+ "osProfile": {
+ "adminUsername": "testuser",
+ "computerNamePrefix": "testvmss",
+ "linuxConfiguration": {
+ "disablePasswordAuthentication": true,
+ "ssh": {
+ "publicKeys": [
+ {
+ "keyData": "",
+ "path": "/home/testuser/.ssh/authorized_keys"
+ }
+ ]
+ }
+ },
+ "secrets": []
+ },
+ "scheduledEventsProfile": {
+ "terminateNotificationProfile": {
+ "enable": true,
+ "notBeforeTimeout": "PT10M"
+ }
+ },
+ "storageProfile": {
+ "dataDisks": [
+ {
+ "caching": "ReadWrite",
+ "createOption": "empty",
+ "diskSizeGB": 64,
+ "lun": 0,
+ "managedDisk": {
+ "storageAccountType": "Standard_LRS"
+ }
+ }
+ ],
+ "imageReference": {
+ "offer": "CoreOS",
+ "publisher": "CoreOS",
+ "sku": "Stable",
+ "version": "899.17.0"
+ },
+ "osDisk": {
+ "caching": "ReadWrite",
+ "createOption": "fromImage",
+ "managedDisk": {
+ "storageAccountType": "Standard_LRS"
+ }
+ }
+ }
+ }
+ },
+ "sku": {
+ "capacity": 2,
+ "name": "Standard_DS1_v2",
+ "tier": "Standard"
+ },
+ "tags": null,
+ "type": "Microsoft.Compute/virtualMachineScaleSets"
+ }
+''' # NOQA
+
+import base64
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrestazure.tools import parse_resource_id
+
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict, format_resource_id
+from ansible.module_utils.basic import to_native, to_bytes
+
+
+AZURE_OBJECT_CLASS = 'VirtualMachineScaleSet'
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str', required=True),
+ name=dict(type='str', required=True),
+ state=dict(choices=['present', 'absent'], default='present', type='str'),
+ location=dict(type='str'),
+ short_hostname=dict(type='str'),
+ vm_size=dict(type='str'),
+ tier=dict(type='str', choices=['Basic', 'Standard']),
+ capacity=dict(type='int', default=1),
+ upgrade_policy=dict(type='str', choices=['Automatic', 'Manual']),
+ admin_username=dict(type='str'),
+ admin_password=dict(type='str', no_log=True),
+ ssh_password_enabled=dict(type='bool', default=True),
+ ssh_public_keys=dict(type='list'),
+ image=dict(type='raw'),
+ os_disk_caching=dict(type='str', aliases=['disk_caching'], choices=['ReadOnly', 'ReadWrite'],
+ default='ReadOnly'),
+ os_type=dict(type='str', choices=['Linux', 'Windows'], default='Linux'),
+ managed_disk_type=dict(type='str', choices=['Standard_LRS', 'Premium_LRS']),
+ data_disks=dict(type='list'),
+ subnet_name=dict(type='str', aliases=['subnet']),
+ load_balancer=dict(type='str'),
+ application_gateway=dict(type='str'),
+ virtual_network_resource_group=dict(type='str'),
+ virtual_network_name=dict(type='str', aliases=['virtual_network']),
+ remove_on_absent=dict(type='list', default=['all']),
+ enable_accelerated_networking=dict(type='bool'),
+ security_group=dict(type='raw', aliases=['security_group_name']),
+ overprovision=dict(type='bool', default=True),
+ single_placement_group=dict(type='bool', default=True),
+ zones=dict(type='list'),
+ custom_data=dict(type='str'),
+ plan=dict(type='dict', options=dict(publisher=dict(type='str', required=True),
+ product=dict(type='str', required=True), name=dict(type='str', required=True),
+ promotion_code=dict(type='str'))),
+ scale_in_policy=dict(type='str', choices=['Default', 'OldestVM', 'NewestVM']),
+ terminate_event_timeout_minutes=dict(type='int'),
+ priority=dict(type='str', choices=['Regular', 'Low'], default='Regular')
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.state = None
+ self.location = None
+ self.short_hostname = None
+ self.vm_size = None
+ self.capacity = None
+ self.tier = None
+ self.upgrade_policy = None
+ self.admin_username = None
+ self.admin_password = None
+ self.ssh_password_enabled = None
+ self.ssh_public_keys = None
+ self.image = None
+ self.os_disk_caching = None
+ self.managed_disk_type = None
+ self.data_disks = None
+ self.os_type = None
+ self.subnet_name = None
+ self.virtual_network_resource_group = None
+ self.virtual_network_name = None
+ self.tags = None
+ self.differences = None
+ self.load_balancer = None
+ self.application_gateway = None
+ self.enable_accelerated_networking = None
+ self.security_group = None
+ self.overprovision = None
+ self.single_placement_group = None
+ self.zones = None
+ self.custom_data = None
+ self.plan = None
+ self.scale_in_policy = None
+ self.terminate_event_timeout_minutes = None
+ self.priority = None
+
+ mutually_exclusive = [('load_balancer', 'application_gateway')]
+ self.results = dict(
+ changed=False,
+ actions=[],
+ ansible_facts=dict(azure_vmss=None)
+ )
+
+ super(AzureRMVirtualMachineScaleSet, self).__init__(
+ derived_arg_spec=self.module_arg_spec,
+ supports_check_mode=True,
+ mutually_exclusive=mutually_exclusive)
+
+ def exec_module(self, **kwargs):
+
+ for key in list(self.module_arg_spec.keys()) + ['tags']:
+ setattr(self, key, kwargs[key])
+
+ if self.module._name == 'azure_rm_virtualmachine_scaleset':
+ self.module.deprecate("The 'azure_rm_virtualmachine_scaleset' module has been renamed to 'azure_rm_virtualmachinescaleset'", version='2.12')
+
+ # make sure options are lower case
+ self.remove_on_absent = set([resource.lower() for resource in self.remove_on_absent])
+
+ # convert elements to ints
+ self.zones = [int(i) for i in self.zones] if self.zones else None
+
+ # default virtual_network_resource_group to resource_group
+ if not self.virtual_network_resource_group:
+ self.virtual_network_resource_group = self.resource_group
+
+ changed = False
+ results = dict()
+ vmss = None
+ disable_ssh_password = None
+ subnet = None
+ image_reference = None
+ load_balancer_backend_address_pools = None
+ load_balancer_inbound_nat_pools = None
+ load_balancer = None
+ application_gateway = None
+ application_gateway_backend_address_pools = None
+ support_lb_change = True
+
+ resource_group = self.get_resource_group(self.resource_group)
+ if not self.location:
+ # Set default location
+ self.location = resource_group.location
+
+ if self.custom_data:
+ self.custom_data = to_native(base64.b64encode(to_bytes(self.custom_data)))
+
+ if self.state == 'present':
+ # Verify parameters and resolve any defaults
+
+ if self.vm_size and not self.vm_size_is_valid():
+ self.fail("Parameter error: vm_size {0} is not valid for your subscription and location.".format(
+ self.vm_size
+ ))
+
+ # if self.virtual_network_name:
+ # virtual_network = self.get_virtual_network(self.virtual_network_name)
+
+ if self.ssh_public_keys:
+ msg = "Parameter error: expecting ssh_public_keys to be a list of type dict where " \
+ "each dict contains keys: path, key_data."
+ for key in self.ssh_public_keys:
+ if not isinstance(key, dict):
+ self.fail(msg)
+ if not key.get('path') or not key.get('key_data'):
+ self.fail(msg)
+
+ if self.image and isinstance(self.image, dict):
+ if all(key in self.image for key in ('publisher', 'offer', 'sku', 'version')):
+ marketplace_image = self.get_marketplace_image_version()
+ if self.image['version'] == 'latest':
+ self.image['version'] = marketplace_image.name
+ self.log("Using image version {0}".format(self.image['version']))
+
+ image_reference = self.compute_models.ImageReference(
+ publisher=self.image['publisher'],
+ offer=self.image['offer'],
+ sku=self.image['sku'],
+ version=self.image['version']
+ )
+ elif self.image.get('name'):
+ custom_image = True
+ image_reference = self.get_custom_image_reference(
+ self.image.get('name'),
+ self.image.get('resource_group'))
+ elif self.image.get('id'):
+ try:
+ image_reference = self.compute_models.ImageReference(id=self.image['id'])
+ except Exception as exc:
+ self.fail("id Error: Cannot get image from the reference id - {0}".format(self.image['id']))
+ else:
+ self.fail("parameter error: expecting image to contain [publisher, offer, sku, version], [name, resource_group] or [id]")
+ elif self.image and isinstance(self.image, str):
+ custom_image = True
+ image_reference = self.get_custom_image_reference(self.image)
+ elif self.image:
+ self.fail("parameter error: expecting image to be a string or dict not {0}".format(type(self.image).__name__))
+
+ disable_ssh_password = not self.ssh_password_enabled
+
+ if self.load_balancer:
+ load_balancer = self.get_load_balancer(self.load_balancer)
+ load_balancer_backend_address_pools = ([self.compute_models.SubResource(id=resource.id)
+ for resource in load_balancer.backend_address_pools]
+ if load_balancer.backend_address_pools else None)
+ load_balancer_inbound_nat_pools = ([self.compute_models.SubResource(id=resource.id)
+ for resource in load_balancer.inbound_nat_pools]
+ if load_balancer.inbound_nat_pools else None)
+
+ if self.application_gateway:
+ application_gateway = self.get_application_gateway(self.application_gateway)
+ application_gateway_backend_address_pools = ([self.compute_models.SubResource(id=resource.id)
+ for resource in application_gateway.backend_address_pools]
+ if application_gateway.backend_address_pools else None)
+
+ try:
+ self.log("Fetching virtual machine scale set {0}".format(self.name))
+ vmss = self.compute_client.virtual_machine_scale_sets.get(self.resource_group, self.name)
+ self.check_provisioning_state(vmss, self.state)
+ vmss_dict = self.serialize_vmss(vmss)
+
+ if self.state == 'present':
+ differences = []
+ results = vmss_dict
+
+ if self.os_disk_caching and \
+ self.os_disk_caching != vmss_dict['properties']['virtualMachineProfile']['storageProfile']['osDisk']['caching']:
+ self.log('CHANGED: virtual machine scale set {0} - OS disk caching'.format(self.name))
+ differences.append('OS Disk caching')
+ changed = True
+ vmss_dict['properties']['virtualMachineProfile']['storageProfile']['osDisk']['caching'] = self.os_disk_caching
+
+ if self.capacity and \
+ self.capacity != vmss_dict['sku']['capacity']:
+ self.log('CHANGED: virtual machine scale set {0} - Capacity'.format(self.name))
+ differences.append('Capacity')
+ changed = True
+ vmss_dict['sku']['capacity'] = self.capacity
+
+ if self.data_disks and \
+ len(self.data_disks) != len(vmss_dict['properties']['virtualMachineProfile']['storageProfile'].get('dataDisks', [])):
+ self.log('CHANGED: virtual machine scale set {0} - Data Disks'.format(self.name))
+ differences.append('Data Disks')
+ changed = True
+
+ if self.upgrade_policy and \
+ self.upgrade_policy != vmss_dict['properties']['upgradePolicy']['mode']:
+ self.log('CHANGED: virtual machine scale set {0} - Upgrade Policy'.format(self.name))
+ differences.append('Upgrade Policy')
+ changed = True
+ vmss_dict['properties']['upgradePolicy']['mode'] = self.upgrade_policy
+
+ if image_reference and \
+ image_reference.as_dict() != vmss_dict['properties']['virtualMachineProfile']['storageProfile']['imageReference']:
+ self.log('CHANGED: virtual machine scale set {0} - Image'.format(self.name))
+ differences.append('Image')
+ changed = True
+ vmss_dict['properties']['virtualMachineProfile']['storageProfile']['imageReference'] = image_reference.as_dict()
+
+ update_tags, vmss_dict['tags'] = self.update_tags(vmss_dict.get('tags', dict()))
+ if update_tags:
+ differences.append('Tags')
+ changed = True
+
+ if bool(self.overprovision) != bool(vmss_dict['properties']['overprovision']):
+ differences.append('overprovision')
+ changed = True
+
+ if bool(self.single_placement_group) != bool(vmss_dict['properties']['singlePlacementGroup']):
+ differences.append('single_placement_group')
+ changed = True
+
+ vmss_dict['zones'] = [int(i) for i in vmss_dict['zones']] if 'zones' in vmss_dict and vmss_dict['zones'] else None
+ if self.zones != vmss_dict['zones']:
+ self.log("CHANGED: virtual machine scale sets {0} zones".format(self.name))
+ differences.append('Zones')
+ changed = True
+ vmss_dict['zones'] = self.zones
+
+ if self.terminate_event_timeout_minutes:
+ timeout = self.terminate_event_timeout_minutes
+ if timeout < 5 or timeout > 15:
+ self.fail("terminate_event_timeout_minutes should >= 5 and <= 15")
+ iso_8601_format = "PT" + str(timeout) + "M"
+ old = vmss_dict['properties']['virtualMachineProfile'].get('scheduledEventsProfile', {}).\
+ get('terminateNotificationProfile', {}).get('notBeforeTimeout', "")
+ if old != iso_8601_format:
+ differences.append('terminateNotification')
+ changed = True
+ vmss_dict['properties']['virtualMachineProfile'].setdefault('scheduledEventsProfile', {})['terminateNotificationProfile'] = {
+ 'notBeforeTimeout': iso_8601_format,
+ "enable": 'true'
+ }
+
+ if self.scale_in_policy and self.scale_in_policy != vmss_dict['properties'].get('scaleInPolicy', {}).get('rules', [""])[0]:
+ self.log("CHANGED: virtual machine sale sets {0} scale in policy".format(self.name))
+ differences.append('scaleInPolicy')
+ changed = True
+ vmss_dict['properties'].setdefault('scaleInPolicy', {})['rules'] = [self.scale_in_policy]
+
+ nicConfigs = vmss_dict['properties']['virtualMachineProfile']['networkProfile']['networkInterfaceConfigurations']
+
+ backend_address_pool = nicConfigs[0]['properties']['ipConfigurations'][0]['properties'].get('loadBalancerBackendAddressPools', [])
+ backend_address_pool += nicConfigs[0]['properties']['ipConfigurations'][0]['properties'].get('applicationGatewayBackendAddressPools', [])
+ lb_or_ag_id = None
+ if (len(nicConfigs) != 1 or len(backend_address_pool) != 1):
+ support_lb_change = False # Currently not support for the vmss contains more than one loadbalancer
+ self.module.warn('Updating more than one load balancer on VMSS is currently not supported')
+ else:
+ if load_balancer:
+ lb_or_ag_id = "{0}/".format(load_balancer.id)
+ elif application_gateway:
+ lb_or_ag_id = "{0}/".format(application_gateway.id)
+
+ backend_address_pool_id = backend_address_pool[0].get('id')
+ if lb_or_ag_id is not None and (bool(lb_or_ag_id) != bool(backend_address_pool_id) or not backend_address_pool_id.startswith(lb_or_ag_id)):
+ differences.append('load_balancer')
+ changed = True
+
+ if self.custom_data:
+ if self.custom_data != vmss_dict['properties']['virtualMachineProfile']['osProfile'].get('customData'):
+ differences.append('custom_data')
+ changed = True
+ vmss_dict['properties']['virtualMachineProfile']['osProfile']['customData'] = self.custom_data
+
+ self.differences = differences
+
+ elif self.state == 'absent':
+ self.log("CHANGED: virtual machine scale set {0} exists and requested state is 'absent'".format(self.name))
+ results = dict()
+ changed = True
+
+ except CloudError:
+ self.log('Virtual machine scale set {0} does not exist'.format(self.name))
+ if self.state == 'present':
+ self.log("CHANGED: virtual machine scale set {0} does not exist but state is 'present'.".format(self.name))
+ changed = True
+
+ self.results['changed'] = changed
+ self.results['ansible_facts']['azure_vmss'] = results
+
+ if self.check_mode:
+ return self.results
+
+ if changed:
+ if self.state == 'present':
+ if not vmss:
+ # Create the VMSS
+ if self.vm_size is None:
+ self.fail("vm size must be set")
+
+ self.log("Create virtual machine scale set {0}".format(self.name))
+ self.results['actions'].append('Created VMSS {0}'.format(self.name))
+
+ if self.os_type == 'Linux':
+ if disable_ssh_password and not self.ssh_public_keys:
+ self.fail("Parameter error: ssh_public_keys required when disabling SSH password.")
+
+ if not self.virtual_network_name:
+ self.fail("virtual network name is required")
+
+ if self.subnet_name:
+ subnet = self.get_subnet(self.virtual_network_name, self.subnet_name)
+
+ if not self.short_hostname:
+ self.short_hostname = self.name
+
+ if not image_reference:
+ self.fail("Parameter error: an image is required when creating a virtual machine.")
+
+ managed_disk = self.compute_models.VirtualMachineScaleSetManagedDiskParameters(storage_account_type=self.managed_disk_type)
+
+ if self.security_group:
+ nsg = self.parse_nsg()
+ if nsg:
+ self.security_group = self.network_models.NetworkSecurityGroup(id=nsg.get('id'))
+
+ plan = None
+ if self.plan:
+ plan = self.compute_models.Plan(name=self.plan.get('name'), product=self.plan.get('product'),
+ publisher=self.plan.get('publisher'),
+ promotion_code=self.plan.get('promotion_code'))
+
+ os_profile = None
+ if self.admin_username or self.custom_data or self.ssh_public_keys:
+ os_profile = self.compute_models.VirtualMachineScaleSetOSProfile(
+ admin_username=self.admin_username,
+ computer_name_prefix=self.short_hostname,
+ custom_data=self.custom_data
+ )
+
+ vmss_resource = self.compute_models.VirtualMachineScaleSet(
+ location=self.location,
+ overprovision=self.overprovision,
+ single_placement_group=self.single_placement_group,
+ tags=self.tags,
+ upgrade_policy=self.compute_models.UpgradePolicy(
+ mode=self.upgrade_policy
+ ),
+ sku=self.compute_models.Sku(
+ name=self.vm_size,
+ capacity=self.capacity,
+ tier=self.tier,
+ ),
+ plan=plan,
+ virtual_machine_profile=self.compute_models.VirtualMachineScaleSetVMProfile(
+ priority=self.priority,
+ os_profile=os_profile,
+ storage_profile=self.compute_models.VirtualMachineScaleSetStorageProfile(
+ os_disk=self.compute_models.VirtualMachineScaleSetOSDisk(
+ managed_disk=managed_disk,
+ create_option=self.compute_models.DiskCreateOptionTypes.from_image,
+ caching=self.os_disk_caching,
+ ),
+ image_reference=image_reference,
+ ),
+ network_profile=self.compute_models.VirtualMachineScaleSetNetworkProfile(
+ network_interface_configurations=[
+ self.compute_models.VirtualMachineScaleSetNetworkConfiguration(
+ name=self.name,
+ primary=True,
+ ip_configurations=[
+ self.compute_models.VirtualMachineScaleSetIPConfiguration(
+ name='default',
+ subnet=self.compute_models.ApiEntityReference(
+ id=subnet.id
+ ),
+ primary=True,
+ load_balancer_backend_address_pools=load_balancer_backend_address_pools,
+ load_balancer_inbound_nat_pools=load_balancer_inbound_nat_pools,
+ application_gateway_backend_address_pools=application_gateway_backend_address_pools
+ )
+ ],
+ enable_accelerated_networking=self.enable_accelerated_networking,
+ network_security_group=self.security_group
+ )
+ ]
+ )
+ ),
+ zones=self.zones
+ )
+
+ if self.scale_in_policy:
+ vmss_resource.scale_in_policy = self.gen_scale_in_policy()
+
+ if self.terminate_event_timeout_minutes:
+ vmss_resource.virtual_machine_profile.scheduled_events_profile = self.gen_scheduled_event_profile()
+
+ if self.admin_password:
+ vmss_resource.virtual_machine_profile.os_profile.admin_password = self.admin_password
+
+ if self.os_type == 'Linux' and os_profile:
+ vmss_resource.virtual_machine_profile.os_profile.linux_configuration = self.compute_models.LinuxConfiguration(
+ disable_password_authentication=disable_ssh_password
+ )
+
+ if self.ssh_public_keys:
+ ssh_config = self.compute_models.SshConfiguration()
+ ssh_config.public_keys = \
+ [self.compute_models.SshPublicKey(path=key['path'], key_data=key['key_data']) for key in self.ssh_public_keys]
+ vmss_resource.virtual_machine_profile.os_profile.linux_configuration.ssh = ssh_config
+
+ if self.data_disks:
+ data_disks = []
+
+ for data_disk in self.data_disks:
+ data_disk_managed_disk = self.compute_models.VirtualMachineScaleSetManagedDiskParameters(
+ storage_account_type=data_disk.get('managed_disk_type', None)
+ )
+
+ data_disk['caching'] = data_disk.get(
+ 'caching',
+ self.compute_models.CachingTypes.read_only
+ )
+
+ data_disks.append(self.compute_models.VirtualMachineScaleSetDataDisk(
+ lun=data_disk.get('lun', None),
+ caching=data_disk.get('caching', None),
+ create_option=data_disk.get('create_option', self.compute_models.DiskCreateOptionTypes.empty),
+ disk_size_gb=data_disk.get('disk_size_gb', None),
+ managed_disk=data_disk_managed_disk,
+ ))
+
+ vmss_resource.virtual_machine_profile.storage_profile.data_disks = data_disks
+
+ if self.plan:
+ try:
+ plan_name = self.plan.get('name')
+ plan_product = self.plan.get('product')
+ plan_publisher = self.plan.get('publisher')
+ term = self.marketplace_client.marketplace_agreements.get(
+ publisher_id=plan_publisher, offer_id=plan_product, plan_id=plan_name)
+ term.accepted = True
+ self.marketplace_client.marketplace_agreements.create(
+ publisher_id=plan_publisher, offer_id=plan_product, plan_id=plan_name, parameters=term)
+ except Exception as exc:
+ self.fail(("Error accepting terms for virtual machine {0} with plan {1}. " +
+ "Only service admin/account admin users can purchase images " +
+ "from the marketplace. - {2}").format(self.name, self.plan, str(exc)))
+
+ self.log("Create virtual machine with parameters:")
+ self.create_or_update_vmss(vmss_resource)
+
+ elif self.differences and len(self.differences) > 0:
+ self.log("Update virtual machine scale set {0}".format(self.name))
+ self.results['actions'].append('Updated VMSS {0}'.format(self.name))
+
+ vmss_resource = self.get_vmss()
+ vmss_resource.virtual_machine_profile.storage_profile.os_disk.caching = self.os_disk_caching
+ vmss_resource.sku.capacity = self.capacity
+ vmss_resource.overprovision = self.overprovision
+ vmss_resource.single_placement_group = self.single_placement_group
+
+ if support_lb_change:
+ if self.load_balancer:
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].load_balancer_backend_address_pools = load_balancer_backend_address_pools
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].application_gateway_backend_address_pools = None
+ elif self.application_gateway:
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].application_gateway_backend_address_pools = application_gateway_backend_address_pools
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].load_balancer_backend_address_pools = None
+ vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+ .ip_configurations[0].load_balancer_inbound_nat_pools = None
+
+ if self.data_disks is not None:
+ data_disks = []
+ for data_disk in self.data_disks:
+ data_disks.append(self.compute_models.VirtualMachineScaleSetDataDisk(
+ lun=data_disk['lun'],
+ caching=data_disk['caching'],
+ create_option=data_disk.get('create_option', self.compute_models.DiskCreateOptionTypes.empty),
+ disk_size_gb=data_disk['disk_size_gb'],
+ managed_disk=self.compute_models.VirtualMachineScaleSetManagedDiskParameters(
+ storage_account_type=data_disk.get('managed_disk_type', None)
+ ),
+ ))
+ vmss_resource.virtual_machine_profile.storage_profile.data_disks = data_disks
+
+ if self.scale_in_policy:
+ vmss_resource.scale_in_policy = self.gen_scale_in_policy()
+
+ if self.terminate_event_timeout_minutes:
+ vmss_resource.virtual_machine_profile.scheduled_events_profile = self.gen_scheduled_event_profile()
+
+ if image_reference is not None:
+ vmss_resource.virtual_machine_profile.storage_profile.image_reference = image_reference
+ self.log("Update virtual machine with parameters:")
+ self.create_or_update_vmss(vmss_resource)
+
+ self.results['ansible_facts']['azure_vmss'] = self.serialize_vmss(self.get_vmss())
+
+ elif self.state == 'absent':
+ # delete the VM
+ self.log("Delete virtual machine scale set {0}".format(self.name))
+ self.results['ansible_facts']['azure_vmss'] = None
+ self.delete_vmss(vmss)
+
+ # until we sort out how we want to do this globally
+ del self.results['actions']
+
+ return self.results
+
+ def get_vmss(self):
+ '''
+ Get the VMSS
+
+ :return: VirtualMachineScaleSet object
+ '''
+ try:
+ vmss = self.compute_client.virtual_machine_scale_sets.get(self.resource_group, self.name)
+ return vmss
+ except CloudError as exc:
+ self.fail("Error getting virtual machine scale set {0} - {1}".format(self.name, str(exc)))
+
+ def get_virtual_network(self, name):
+ try:
+ vnet = self.network_client.virtual_networks.get(self.virtual_network_resource_group, name)
+ return vnet
+ except CloudError as exc:
+ self.fail("Error fetching virtual network {0} - {1}".format(name, str(exc)))
+
+ def get_subnet(self, vnet_name, subnet_name):
+ self.log("Fetching subnet {0} in virtual network {1}".format(subnet_name, vnet_name))
+ try:
+ subnet = self.network_client.subnets.get(self.virtual_network_resource_group, vnet_name, subnet_name)
+ except CloudError as exc:
+ self.fail("Error: fetching subnet {0} in virtual network {1} - {2}".format(
+ subnet_name,
+ vnet_name,
+ str(exc)))
+ return subnet
+
+ def get_load_balancer(self, id):
+ id_dict = parse_resource_id(id)
+ try:
+ return self.network_client.load_balancers.get(id_dict.get('resource_group', self.resource_group), id_dict.get('name'))
+ except CloudError as exc:
+ self.fail("Error fetching load balancer {0} - {1}".format(id, str(exc)))
+
+ def get_application_gateway(self, id):
+ id_dict = parse_resource_id(id)
+ try:
+ return self.network_client.application_gateways.get(id_dict.get('resource_group', self.resource_group), id_dict.get('name'))
+ except CloudError as exc:
+ self.fail("Error fetching application_gateway {0} - {1}".format(id, str(exc)))
+
+ def serialize_vmss(self, vmss):
+ '''
+ Convert a VirtualMachineScaleSet object to dict.
+
+ :param vm: VirtualMachineScaleSet object
+ :return: dict
+ '''
+
+ result = self.serialize_obj(vmss, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES)
+ result['id'] = vmss.id
+ result['name'] = vmss.name
+ result['type'] = vmss.type
+ result['location'] = vmss.location
+ result['tags'] = vmss.tags
+
+ return result
+
+ def delete_vmss(self, vmss):
+ self.log("Deleting virtual machine scale set {0}".format(self.name))
+ self.results['actions'].append("Deleted virtual machine scale set {0}".format(self.name))
+ try:
+ poller = self.compute_client.virtual_machine_scale_sets.delete(self.resource_group, self.name)
+ # wait for the poller to finish
+ self.get_poller_result(poller)
+ except CloudError as exc:
+ self.fail("Error deleting virtual machine scale set {0} - {1}".format(self.name, str(exc)))
+
+ return True
+
+ def get_marketplace_image_version(self):
+ try:
+ versions = self.compute_client.virtual_machine_images.list(self.location,
+ self.image['publisher'],
+ self.image['offer'],
+ self.image['sku'])
+ except CloudError as exc:
+ self.fail("Error fetching image {0} {1} {2} - {3}".format(self.image['publisher'],
+ self.image['offer'],
+ self.image['sku'],
+ str(exc)))
+ if versions and len(versions) > 0:
+ if self.image['version'] == 'latest':
+ return versions[len(versions) - 1]
+ for version in versions:
+ if version.name == self.image['version']:
+ return version
+
+ self.fail("Error could not find image {0} {1} {2} {3}".format(self.image['publisher'],
+ self.image['offer'],
+ self.image['sku'],
+ self.image['version']))
+
+ def get_custom_image_reference(self, name, resource_group=None):
+ try:
+ if resource_group:
+ vm_images = self.compute_client.images.list_by_resource_group(resource_group)
+ else:
+ vm_images = self.compute_client.images.list()
+ except Exception as exc:
+ self.fail("Error fetching custom images from subscription - {0}".format(str(exc)))
+
+ for vm_image in vm_images:
+ if vm_image.name == name:
+ self.log("Using custom image id {0}".format(vm_image.id))
+ return self.compute_models.ImageReference(id=vm_image.id)
+
+ self.fail("Error could not find image with name {0}".format(name))
+
+ def create_or_update_vmss(self, params):
+ try:
+ poller = self.compute_client.virtual_machine_scale_sets.create_or_update(self.resource_group, self.name, params)
+ self.get_poller_result(poller)
+ except CloudError as exc:
+ self.fail("Error creating or updating virtual machine {0} - {1}".format(self.name, str(exc)))
+
+ def vm_size_is_valid(self):
+ '''
+ Validate self.vm_size against the list of virtual machine sizes available for the account and location.
+
+ :return: boolean
+ '''
+ try:
+ sizes = self.compute_client.virtual_machine_sizes.list(self.location)
+ except CloudError as exc:
+ self.fail("Error retrieving available machine sizes - {0}".format(str(exc)))
+ for size in sizes:
+ if size.name == self.vm_size:
+ return True
+ return False
+
+ def parse_nsg(self):
+ nsg = self.security_group
+ resource_group = self.resource_group
+ if isinstance(self.security_group, dict):
+ nsg = self.security_group.get('name')
+ resource_group = self.security_group.get('resource_group', self.resource_group)
+ id = format_resource_id(val=nsg,
+ subscription_id=self.subscription_id,
+ namespace='Microsoft.Network',
+ types='networkSecurityGroups',
+ resource_group=resource_group)
+ name = azure_id_to_dict(id).get('name')
+ return dict(id=id, name=name)
+
+ def gen_scheduled_event_profile(self):
+ if self.terminate_event_timeout_minutes is None:
+ return None
+
+ scheduledEventProfile = self.compute_models.ScheduledEventsProfile()
+ terminationProfile = self.compute_models.TerminateNotificationProfile()
+ terminationProfile.not_before_timeout = "PT" + str(self.terminate_event_timeout_minutes) + "M"
+ terminationProfile.enable = True
+ scheduledEventProfile.terminate_notification_profile = terminationProfile
+ return scheduledEventProfile
+
+ def gen_scale_in_policy(self):
+ if self.scale_in_policy is None:
+ return None
+
+ return self.compute_models.ScaleInPolicy(rules=[self.scale_in_policy])
+
+
+def main():
+ AzureRMVirtualMachineScaleSet()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset_facts.py
new file mode 100644
index 00000000..9146bee7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset_facts.py
@@ -0,0 +1,436 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2017, Sertac Ozercan <seozerca@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachinescaleset_info
+
+
+short_description: Get Virtual Machine Scale Set facts
+
+description:
+ - Get facts for a virtual machine scale set.
+ - Note that this module was called M(community.azure.azure_rm_virtualmachine_scaleset_facts) before Ansible 2.8. The usage did not change.
+
+options:
+ name:
+ description:
+ - Limit results to a specific virtual machine scale set.
+ resource_group:
+ description:
+ - The resource group to search for the desired virtual machine scale set.
+ tags:
+ description:
+ - List of tags to be matched.
+ format:
+ description:
+ - Format of the data returned.
+ - If C(raw) is selected information will be returned in raw format from Azure Python SDK.
+ - If C(curated) is selected the structure will be identical to input parameters of M(community.azure.azure_rm_virtualmachinescaleset) module.
+ - In Ansible 2.5 and lower facts are always returned in raw format.
+ - Please note that this option will be deprecated in 2.10 when curated format will become the only supported format.
+ default: 'raw'
+ choices:
+ - 'curated'
+ - 'raw'
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Sertac Ozercan (@sozercan)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for a virtual machine scale set
+ community.azure.azure_rm_virtualmachinescaleset_info:
+ resource_group: myResourceGroup
+ name: testvmss001
+ format: curated
+
+ - name: Get facts for all virtual networks
+ community.azure.azure_rm_virtualmachinescaleset_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by tags
+ community.azure.azure_rm_virtualmachinescaleset_info:
+ resource_group: myResourceGroup
+ tags:
+ - testing
+'''
+
+RETURN = '''
+vmss:
+ description:
+ - List of virtual machine scale sets.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/scalesets/myscaleset
+ admin_username:
+ description:
+ - Admin username used to access the host after it is created.
+ returned: always
+ type: str
+ sample: adminuser
+ capacity:
+ description:
+ - Capacity of VMSS.
+ returned: always
+ type: int
+ sample: 2
+ data_disks:
+ description:
+ - List of attached data disks.
+ returned: always
+ type: complex
+ contains:
+ caching:
+ description:
+ - Type of data disk caching.
+ returned: always
+ type: str
+ sample: ReadOnly
+ disk_size_gb:
+ description:
+ - The initial disk size in GB for blank data disks.
+ returned: always
+ type: int
+ sample: 64
+ lun:
+ description:
+ - The logical unit number for data disk.
+ returned: always
+ type: int
+ sample: 0
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ returned: always
+ type: str
+ sample: Standard_LRS
+ image:
+ description:
+ - Image specification.
+ returned: always
+ type: complex
+ contains:
+ offer:
+ description:
+ - The offer of the platform image or marketplace image used to create the virtual machine.
+ returned: always
+ type: str
+ sample: RHEL
+ publisher:
+ description:
+ - Publisher name.
+ returned: always
+ type: str
+ sample: RedHat
+ sku:
+ description:
+ - SKU name.
+ returned: always
+ type: str
+ sample: 7-RAW
+ version:
+ description:
+ - Image version.
+ returned: always
+ type: str
+ sample: 7.5.2018050901
+ load_balancer:
+ description:
+ - Load balancer name.
+ returned: always
+ type: str
+ sample: testlb
+ location:
+ description:
+ - Resource location.
+ type: str
+ returned: always
+ sample: japaneast
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ type: str
+ returned: always
+ sample: Standard_LRS
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myvmss
+ os_disk_caching:
+ description:
+ - Type of OS disk caching.
+ type: str
+ returned: always
+ sample: ReadOnly
+ os_type:
+ description:
+ - Base type of operating system.
+ type: str
+ returned: always
+ sample: Linux
+ overprovision:
+ description:
+ - Specifies whether the Virtual Machine Scale Set should be overprovisioned.
+ type: bool
+ sample: true
+ resource_group:
+ description:
+ - Resource group.
+ type: str
+ returned: always
+ sample: myResourceGroup
+ ssh_password_enabled:
+ description:
+ - Is SSH password authentication enabled. Valid only for Linux.
+ type: bool
+ returned: always
+ sample: true
+ subnet_name:
+ description:
+ - Subnet name.
+ type: str
+ returned: always
+ sample: testsubnet
+ tier:
+ description:
+ - SKU Tier.
+ type: str
+ returned: always
+ sample: Basic
+ upgrade_policy:
+ description:
+ - Upgrade policy.
+ type: str
+ returned: always
+ sample: Manual
+ virtual_network_name:
+ description:
+ - Associated virtual network name.
+ type: str
+ returned: always
+ sample: testvn
+ vm_size:
+ description:
+ - Virtual machine size.
+ type: str
+ returned: always
+ sample: Standard_D4
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ returned: always
+ type: dict
+ sample: { "tag1": "abc" }
+''' # NOQA
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+import re
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'VirtualMachineScaleSet'
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMVirtualMachineScaleSetInfo(AzureRMModuleBase):
+ """Utility class to get virtual machine scale set facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ format=dict(
+ type='str',
+ choices=['curated',
+ 'raw'],
+ default='raw'
+ )
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.format = None
+ self.tags = None
+
+ super(AzureRMVirtualMachineScaleSetInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachinescaleset_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachinescaleset_facts' module has been renamed to 'azure_rm_virtualmachinescaleset_info'",
+ version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ result = self.get_item()
+ else:
+ result = self.list_items()
+
+ if self.format == 'curated':
+ for index in range(len(result)):
+ vmss = result[index]
+ subnet_name = None
+ load_balancer_name = None
+ virtual_network_name = None
+ ssh_password_enabled = False
+
+ try:
+ subnet_id = (vmss['properties']['virtualMachineProfile']['networkProfile']['networkInterfaceConfigurations'][0]
+ ['properties']['ipConfigurations'][0]['properties']['subnet']['id'])
+ subnet_name = re.sub('.*subnets\\/', '', subnet_id)
+ except Exception:
+ self.log('Could not extract subnet name')
+
+ try:
+ backend_address_pool_id = (vmss['properties']['virtualMachineProfile']['networkProfile']['networkInterfaceConfigurations'][0]
+ ['properties']['ipConfigurations'][0]['properties']['loadBalancerBackendAddressPools'][0]['id'])
+ load_balancer_name = re.sub('\\/backendAddressPools.*', '', re.sub('.*loadBalancers\\/', '', backend_address_pool_id))
+ virtual_network_name = re.sub('.*virtualNetworks\\/', '', re.sub('\\/subnets.*', '', subnet_id))
+ except Exception:
+ self.log('Could not extract load balancer / virtual network name')
+
+ try:
+ ssh_password_enabled = (not vmss['properties']['virtualMachineProfile']['osProfile']
+ ['linuxConfiguration']['disablePasswordAuthentication'])
+ except Exception:
+ self.log('Could not extract SSH password enabled')
+
+ data_disks = vmss['properties']['virtualMachineProfile']['storageProfile'].get('dataDisks', [])
+
+ for disk_index in range(len(data_disks)):
+ old_disk = data_disks[disk_index]
+ new_disk = {
+ 'lun': old_disk['lun'],
+ 'disk_size_gb': old_disk['diskSizeGB'],
+ 'managed_disk_type': old_disk['managedDisk']['storageAccountType'],
+ 'caching': old_disk['caching']
+ }
+ data_disks[disk_index] = new_disk
+
+ updated = {
+ 'id': vmss['id'],
+ 'resource_group': self.resource_group,
+ 'name': vmss['name'],
+ 'state': 'present',
+ 'location': vmss['location'],
+ 'vm_size': vmss['sku']['name'],
+ 'capacity': vmss['sku']['capacity'],
+ 'tier': vmss['sku']['tier'],
+ 'upgrade_policy': vmss['properties']['upgradePolicy']['mode'],
+ 'admin_username': vmss['properties']['virtualMachineProfile']['osProfile']['adminUsername'],
+ 'admin_password': vmss['properties']['virtualMachineProfile']['osProfile'].get('adminPassword'),
+ 'ssh_password_enabled': ssh_password_enabled,
+ 'image': vmss['properties']['virtualMachineProfile']['storageProfile']['imageReference'],
+ 'os_disk_caching': vmss['properties']['virtualMachineProfile']['storageProfile']['osDisk']['caching'],
+ 'os_type': 'Linux' if (vmss['properties']['virtualMachineProfile']['osProfile'].get('linuxConfiguration') is not None) else 'Windows',
+ 'overprovision': vmss['properties']['overprovision'],
+ 'managed_disk_type': vmss['properties']['virtualMachineProfile']['storageProfile']['osDisk']['managedDisk']['storageAccountType'],
+ 'data_disks': data_disks,
+ 'virtual_network_name': virtual_network_name,
+ 'subnet_name': subnet_name,
+ 'load_balancer': load_balancer_name,
+ 'tags': vmss.get('tags')
+ }
+
+ result[index] = updated
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_vmss': result
+ }
+ if self.format == 'curated':
+ # proper result format we want to support in the future
+ # dropping 'ansible_facts' and shorter name 'vmss'
+ self.results['vmss'] = result
+ else:
+ self.results['vmss'] = result
+
+ return self.results
+
+ def get_item(self):
+ """Get a single virtual machine scale set"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ results = []
+
+ try:
+ item = self.compute_client.virtual_machine_scale_sets.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ results = [self.serialize_obj(item, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES)]
+
+ return results
+
+ def list_items(self):
+ """Get all virtual machine scale sets"""
+
+ self.log('List all virtual machine scale sets')
+
+ try:
+ response = self.compute_client.virtual_machine_scale_sets.list(self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_obj(item, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES))
+
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMVirtualMachineScaleSetInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset_info.py
new file mode 100644
index 00000000..9146bee7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescaleset_info.py
@@ -0,0 +1,436 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2017, Sertac Ozercan <seozerca@microsoft.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachinescaleset_info
+
+
+short_description: Get Virtual Machine Scale Set facts
+
+description:
+ - Get facts for a virtual machine scale set.
+ - Note that this module was called M(community.azure.azure_rm_virtualmachine_scaleset_facts) before Ansible 2.8. The usage did not change.
+
+options:
+ name:
+ description:
+ - Limit results to a specific virtual machine scale set.
+ resource_group:
+ description:
+ - The resource group to search for the desired virtual machine scale set.
+ tags:
+ description:
+ - List of tags to be matched.
+ format:
+ description:
+ - Format of the data returned.
+ - If C(raw) is selected information will be returned in raw format from Azure Python SDK.
+ - If C(curated) is selected the structure will be identical to input parameters of M(community.azure.azure_rm_virtualmachinescaleset) module.
+ - In Ansible 2.5 and lower facts are always returned in raw format.
+ - Please note that this option will be deprecated in 2.10 when curated format will become the only supported format.
+ default: 'raw'
+ choices:
+ - 'curated'
+ - 'raw'
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Sertac Ozercan (@sozercan)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for a virtual machine scale set
+ community.azure.azure_rm_virtualmachinescaleset_info:
+ resource_group: myResourceGroup
+ name: testvmss001
+ format: curated
+
+ - name: Get facts for all virtual networks
+ community.azure.azure_rm_virtualmachinescaleset_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by tags
+ community.azure.azure_rm_virtualmachinescaleset_info:
+ resource_group: myResourceGroup
+ tags:
+ - testing
+'''
+
+RETURN = '''
+vmss:
+ description:
+ - List of virtual machine scale sets.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/scalesets/myscaleset
+ admin_username:
+ description:
+ - Admin username used to access the host after it is created.
+ returned: always
+ type: str
+ sample: adminuser
+ capacity:
+ description:
+ - Capacity of VMSS.
+ returned: always
+ type: int
+ sample: 2
+ data_disks:
+ description:
+ - List of attached data disks.
+ returned: always
+ type: complex
+ contains:
+ caching:
+ description:
+ - Type of data disk caching.
+ returned: always
+ type: str
+ sample: ReadOnly
+ disk_size_gb:
+ description:
+ - The initial disk size in GB for blank data disks.
+ returned: always
+ type: int
+ sample: 64
+ lun:
+ description:
+ - The logical unit number for data disk.
+ returned: always
+ type: int
+ sample: 0
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ returned: always
+ type: str
+ sample: Standard_LRS
+ image:
+ description:
+ - Image specification.
+ returned: always
+ type: complex
+ contains:
+ offer:
+ description:
+ - The offer of the platform image or marketplace image used to create the virtual machine.
+ returned: always
+ type: str
+ sample: RHEL
+ publisher:
+ description:
+ - Publisher name.
+ returned: always
+ type: str
+ sample: RedHat
+ sku:
+ description:
+ - SKU name.
+ returned: always
+ type: str
+ sample: 7-RAW
+ version:
+ description:
+ - Image version.
+ returned: always
+ type: str
+ sample: 7.5.2018050901
+ load_balancer:
+ description:
+ - Load balancer name.
+ returned: always
+ type: str
+ sample: testlb
+ location:
+ description:
+ - Resource location.
+ type: str
+ returned: always
+ sample: japaneast
+ managed_disk_type:
+ description:
+ - Managed data disk type.
+ type: str
+ returned: always
+ sample: Standard_LRS
+ name:
+ description:
+ - Resource name.
+ returned: always
+ type: str
+ sample: myvmss
+ os_disk_caching:
+ description:
+ - Type of OS disk caching.
+ type: str
+ returned: always
+ sample: ReadOnly
+ os_type:
+ description:
+ - Base type of operating system.
+ type: str
+ returned: always
+ sample: Linux
+ overprovision:
+ description:
+ - Specifies whether the Virtual Machine Scale Set should be overprovisioned.
+ type: bool
+ sample: true
+ resource_group:
+ description:
+ - Resource group.
+ type: str
+ returned: always
+ sample: myResourceGroup
+ ssh_password_enabled:
+ description:
+ - Is SSH password authentication enabled. Valid only for Linux.
+ type: bool
+ returned: always
+ sample: true
+ subnet_name:
+ description:
+ - Subnet name.
+ type: str
+ returned: always
+ sample: testsubnet
+ tier:
+ description:
+ - SKU Tier.
+ type: str
+ returned: always
+ sample: Basic
+ upgrade_policy:
+ description:
+ - Upgrade policy.
+ type: str
+ returned: always
+ sample: Manual
+ virtual_network_name:
+ description:
+ - Associated virtual network name.
+ type: str
+ returned: always
+ sample: testvn
+ vm_size:
+ description:
+ - Virtual machine size.
+ type: str
+ returned: always
+ sample: Standard_D4
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ returned: always
+ type: dict
+ sample: { "tag1": "abc" }
+''' # NOQA
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+import re
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # handled in azure_rm_common
+ pass
+
+AZURE_OBJECT_CLASS = 'VirtualMachineScaleSet'
+
+AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
+
+
+class AzureRMVirtualMachineScaleSetInfo(AzureRMModuleBase):
+ """Utility class to get virtual machine scale set facts"""
+
+ def __init__(self):
+
+ self.module_args = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ format=dict(
+ type='str',
+ choices=['curated',
+ 'raw'],
+ default='raw'
+ )
+ )
+
+ self.results = dict(
+ changed=False,
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.format = None
+ self.tags = None
+
+ super(AzureRMVirtualMachineScaleSetInfo, self).__init__(
+ derived_arg_spec=self.module_args,
+ supports_tags=False,
+ facts_module=True
+ )
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachinescaleset_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachinescaleset_facts' module has been renamed to 'azure_rm_virtualmachinescaleset_info'",
+ version='2.13')
+
+ for key in self.module_args:
+ setattr(self, key, kwargs[key])
+
+ if self.name and not self.resource_group:
+ self.fail("Parameter error: resource group required when filtering by name.")
+
+ if self.name:
+ result = self.get_item()
+ else:
+ result = self.list_items()
+
+ if self.format == 'curated':
+ for index in range(len(result)):
+ vmss = result[index]
+ subnet_name = None
+ load_balancer_name = None
+ virtual_network_name = None
+ ssh_password_enabled = False
+
+ try:
+ subnet_id = (vmss['properties']['virtualMachineProfile']['networkProfile']['networkInterfaceConfigurations'][0]
+ ['properties']['ipConfigurations'][0]['properties']['subnet']['id'])
+ subnet_name = re.sub('.*subnets\\/', '', subnet_id)
+ except Exception:
+ self.log('Could not extract subnet name')
+
+ try:
+ backend_address_pool_id = (vmss['properties']['virtualMachineProfile']['networkProfile']['networkInterfaceConfigurations'][0]
+ ['properties']['ipConfigurations'][0]['properties']['loadBalancerBackendAddressPools'][0]['id'])
+ load_balancer_name = re.sub('\\/backendAddressPools.*', '', re.sub('.*loadBalancers\\/', '', backend_address_pool_id))
+ virtual_network_name = re.sub('.*virtualNetworks\\/', '', re.sub('\\/subnets.*', '', subnet_id))
+ except Exception:
+ self.log('Could not extract load balancer / virtual network name')
+
+ try:
+ ssh_password_enabled = (not vmss['properties']['virtualMachineProfile']['osProfile']
+ ['linuxConfiguration']['disablePasswordAuthentication'])
+ except Exception:
+ self.log('Could not extract SSH password enabled')
+
+ data_disks = vmss['properties']['virtualMachineProfile']['storageProfile'].get('dataDisks', [])
+
+ for disk_index in range(len(data_disks)):
+ old_disk = data_disks[disk_index]
+ new_disk = {
+ 'lun': old_disk['lun'],
+ 'disk_size_gb': old_disk['diskSizeGB'],
+ 'managed_disk_type': old_disk['managedDisk']['storageAccountType'],
+ 'caching': old_disk['caching']
+ }
+ data_disks[disk_index] = new_disk
+
+ updated = {
+ 'id': vmss['id'],
+ 'resource_group': self.resource_group,
+ 'name': vmss['name'],
+ 'state': 'present',
+ 'location': vmss['location'],
+ 'vm_size': vmss['sku']['name'],
+ 'capacity': vmss['sku']['capacity'],
+ 'tier': vmss['sku']['tier'],
+ 'upgrade_policy': vmss['properties']['upgradePolicy']['mode'],
+ 'admin_username': vmss['properties']['virtualMachineProfile']['osProfile']['adminUsername'],
+ 'admin_password': vmss['properties']['virtualMachineProfile']['osProfile'].get('adminPassword'),
+ 'ssh_password_enabled': ssh_password_enabled,
+ 'image': vmss['properties']['virtualMachineProfile']['storageProfile']['imageReference'],
+ 'os_disk_caching': vmss['properties']['virtualMachineProfile']['storageProfile']['osDisk']['caching'],
+ 'os_type': 'Linux' if (vmss['properties']['virtualMachineProfile']['osProfile'].get('linuxConfiguration') is not None) else 'Windows',
+ 'overprovision': vmss['properties']['overprovision'],
+ 'managed_disk_type': vmss['properties']['virtualMachineProfile']['storageProfile']['osDisk']['managedDisk']['storageAccountType'],
+ 'data_disks': data_disks,
+ 'virtual_network_name': virtual_network_name,
+ 'subnet_name': subnet_name,
+ 'load_balancer': load_balancer_name,
+ 'tags': vmss.get('tags')
+ }
+
+ result[index] = updated
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_vmss': result
+ }
+ if self.format == 'curated':
+ # proper result format we want to support in the future
+ # dropping 'ansible_facts' and shorter name 'vmss'
+ self.results['vmss'] = result
+ else:
+ self.results['vmss'] = result
+
+ return self.results
+
+ def get_item(self):
+ """Get a single virtual machine scale set"""
+
+ self.log('Get properties for {0}'.format(self.name))
+
+ item = None
+ results = []
+
+ try:
+ item = self.compute_client.virtual_machine_scale_sets.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ results = [self.serialize_obj(item, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES)]
+
+ return results
+
+ def list_items(self):
+ """Get all virtual machine scale sets"""
+
+ self.log('List all virtual machine scale sets')
+
+ try:
+ response = self.compute_client.virtual_machine_scale_sets.list(self.resource_group)
+ except CloudError as exc:
+ self.fail('Failed to list all items - {0}'.format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.serialize_obj(item, AZURE_OBJECT_CLASS, enum_modules=AZURE_ENUM_MODULES))
+
+ return results
+
+
+def main():
+ """Main module execution code path"""
+
+ AzureRMVirtualMachineScaleSetInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetextension_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetextension_facts.py
new file mode 100644
index 00000000..2bb6597a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetextension_facts.py
@@ -0,0 +1,228 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachinescalesetextension_info
+short_description: Get Azure Virtual Machine Scale Set Extension facts
+description:
+ - Get facts of Azure Virtual Machine Scale Set Extension.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ vmss_name:
+ description:
+ - The name of VMSS containing the extension.
+ required: True
+ name:
+ description:
+ - The name of the virtual machine extension.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get information on specific Virtual Machine Scale Set Extension
+ azure_rm_virtualmachineextension_info:
+ resource_group: myResourceGroup
+ vmss_name: myvmss
+ name: myextension
+
+ - name: List installed Virtual Machine Scale Set Extensions
+ azure_rm_virtualmachineextension_info:
+ resource_group: myrg
+ vmss_name: myvmss
+'''
+
+RETURN = '''
+extensions:
+ description:
+ - A list of dictionaries containing facts for Virtual Machine Extension.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/
+ myvmss/extensions/myextension"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myrg
+ vmss_name:
+ description:
+ - Virtual machine scale set name.
+ returned: always
+ type: str
+ sample: myvmss
+ name:
+ description:
+ - Virtual machine extension name.
+ returned: always
+ type: str
+ sample: myextension
+ publisher:
+ description:
+ - Extension publisher.
+ returned: always
+ type: str
+ sample: Microsoft.Azure.Extensions
+ type:
+ description:
+ - Extension type.
+ returned: always
+ type: str
+ sample: CustomScript
+ settings:
+ description:
+ - Extension specific settings dictionary.
+ returned: always
+ type: dict
+ sample: { 'commandToExecute':'hostname' }
+ auto_upgrade_minor_version:
+ description:
+ - Autoupgrade minor version flag.
+ returned: always
+ type: bool
+ sample: true
+ provisioning_state:
+ description:
+ - Provisioning state of the extension.
+ returned: always
+ type: str
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMVirtualMachineScaleSetExtensionInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ vmss_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.vmss_name = None
+ self.name = None
+ super(AzureRMVirtualMachineScaleSetExtensionInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachinescalesetextension_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachinescalesetextension_facts' module has been renamed to" +
+ " 'azure_rm_virtualmachinescalesetextension_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ self.results['extensions'] = self.get_extensions()
+ else:
+ self.results['extensions'] = self.list_extensions()
+
+ return self.results
+
+ def get_extensions(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_scale_set_extensions.get(resource_group_name=self.resource_group,
+ vm_scale_set_name=self.vmss_name,
+ vmss_extension_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Extension.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def list_extensions(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_scale_set_extensions.list(resource_group_name=self.resource_group,
+ vm_scale_set_name=self.vmss_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Extension.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ id_template = "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualMachineScaleSets/{2}/extensions/{3}"
+ d = item.as_dict()
+ d = {
+ 'id': id_template.format(self.subscription_id, self.resource_group, self.vmss_name, d.get('name')),
+ 'resource_group': self.resource_group,
+ 'vmss_name': self.vmss_name,
+ 'name': d.get('name'),
+ 'publisher': d.get('publisher'),
+ 'type': d.get('type'),
+ 'settings': d.get('settings'),
+ 'auto_upgrade_minor_version': d.get('auto_upgrade_minor_version'),
+ 'provisioning_state': d.get('provisioning_state')
+ }
+ return d
+
+
+def main():
+ AzureRMVirtualMachineScaleSetExtensionInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetextension_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetextension_info.py
new file mode 100644
index 00000000..2bb6597a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetextension_info.py
@@ -0,0 +1,228 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Zim Kalinowski, (@zikalino)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachinescalesetextension_info
+short_description: Get Azure Virtual Machine Scale Set Extension facts
+description:
+ - Get facts of Azure Virtual Machine Scale Set Extension.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ vmss_name:
+ description:
+ - The name of VMSS containing the extension.
+ required: True
+ name:
+ description:
+ - The name of the virtual machine extension.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: Get information on specific Virtual Machine Scale Set Extension
+ azure_rm_virtualmachineextension_info:
+ resource_group: myResourceGroup
+ vmss_name: myvmss
+ name: myextension
+
+ - name: List installed Virtual Machine Scale Set Extensions
+ azure_rm_virtualmachineextension_info:
+ resource_group: myrg
+ vmss_name: myvmss
+'''
+
+RETURN = '''
+extensions:
+ description:
+ - A list of dictionaries containing facts for Virtual Machine Extension.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/
+ myvmss/extensions/myextension"
+ resource_group:
+ description:
+ - Resource group name.
+ returned: always
+ type: str
+ sample: myrg
+ vmss_name:
+ description:
+ - Virtual machine scale set name.
+ returned: always
+ type: str
+ sample: myvmss
+ name:
+ description:
+ - Virtual machine extension name.
+ returned: always
+ type: str
+ sample: myextension
+ publisher:
+ description:
+ - Extension publisher.
+ returned: always
+ type: str
+ sample: Microsoft.Azure.Extensions
+ type:
+ description:
+ - Extension type.
+ returned: always
+ type: str
+ sample: CustomScript
+ settings:
+ description:
+ - Extension specific settings dictionary.
+ returned: always
+ type: dict
+ sample: { 'commandToExecute':'hostname' }
+ auto_upgrade_minor_version:
+ description:
+ - Autoupgrade minor version flag.
+ returned: always
+ type: bool
+ sample: true
+ provisioning_state:
+ description:
+ - Provisioning state of the extension.
+ returned: always
+ type: str
+ sample: Succeeded
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMVirtualMachineScaleSetExtensionInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ vmss_name=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.resource_group = None
+ self.vmss_name = None
+ self.name = None
+ super(AzureRMVirtualMachineScaleSetExtensionInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachinescalesetextension_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachinescalesetextension_facts' module has been renamed to" +
+ " 'azure_rm_virtualmachinescalesetextension_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ self.results['extensions'] = self.get_extensions()
+ else:
+ self.results['extensions'] = self.list_extensions()
+
+ return self.results
+
+ def get_extensions(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_scale_set_extensions.get(resource_group_name=self.resource_group,
+ vm_scale_set_name=self.vmss_name,
+ vmss_extension_name=self.name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Extension.')
+
+ if response:
+ results.append(self.format_response(response))
+
+ return results
+
+ def list_extensions(self):
+ response = None
+ results = []
+ try:
+ response = self.compute_client.virtual_machine_scale_set_extensions.list(resource_group_name=self.resource_group,
+ vm_scale_set_name=self.vmss_name)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Extension.')
+
+ if response is not None:
+ for item in response:
+ results.append(self.format_response(item))
+
+ return results
+
+ def format_response(self, item):
+ id_template = "/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualMachineScaleSets/{2}/extensions/{3}"
+ d = item.as_dict()
+ d = {
+ 'id': id_template.format(self.subscription_id, self.resource_group, self.vmss_name, d.get('name')),
+ 'resource_group': self.resource_group,
+ 'vmss_name': self.vmss_name,
+ 'name': d.get('name'),
+ 'publisher': d.get('publisher'),
+ 'type': d.get('type'),
+ 'settings': d.get('settings'),
+ 'auto_upgrade_minor_version': d.get('auto_upgrade_minor_version'),
+ 'provisioning_state': d.get('provisioning_state')
+ }
+ return d
+
+
+def main():
+ AzureRMVirtualMachineScaleSetExtensionInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetinstance_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetinstance_facts.py
new file mode 100644
index 00000000..c263cfc1
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetinstance_facts.py
@@ -0,0 +1,243 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachinescalesetinstance_info
+short_description: Get Azure Virtual Machine Scale Set Instance facts
+description:
+ - Get facts of Azure Virtual Machine Scale Set VMs.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ vmss_name:
+ description:
+ - The name of the VM scale set.
+ required: True
+ instance_id:
+ description:
+ - The instance ID of the virtual machine.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: List VM instances in Virtual Machine ScaleSet
+ community.azure.azure_rm_virtualmachinescalesetinstance_info:
+ resource_group: myResourceGroup
+ vmss_name: myVMSS
+'''
+
+RETURN = '''
+instances:
+ description:
+ - A list of dictionaries containing facts for Virtual Machine Scale Set VM.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/my
+ VMSS/virtualMachines/2"
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { 'tag1': 'abc' }
+ instance_id:
+ description:
+ - Virtual Machine instance ID.
+ returned: always
+ type: str
+ sample: 0
+ name:
+ description:
+ - Virtual Machine name.
+ returned: always
+ type: str
+ sample: myVMSS_2
+ latest_model:
+ description:
+ - Whether applied latest model.
+ returned: always
+ type: bool
+ sample: True
+ provisioning_state:
+ description:
+ - Provisioning state of the Virtual Machine.
+ returned: always
+ type: str
+ sample: Succeeded
+ power_state:
+ description:
+ - Provisioning state of the Virtual Machine's power.
+ returned: always
+ type: str
+ sample: running
+ vm_id:
+ description:
+ - Virtual Machine ID
+ returned: always
+ type: str
+ sample: 94a141a9-4530-46ac-b151-2c7ff09aa823
+ image_reference:
+ description:
+ - Image reference
+ returned: always
+ type: dict
+ sample: { "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myGroup/providers/Microsoft.Compute/galleries/
+ myGallery/images/myImage/versions/10.1.3"}
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.compute import ComputeManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMVirtualMachineScaleSetVMInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ vmss_name=dict(
+ type='str',
+ required=True
+ ),
+ instance_id=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.vmss_name = None
+ self.instance_id = None
+ self.tags = None
+ super(AzureRMVirtualMachineScaleSetVMInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachinescalesetinstance_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachinescalesetinstance_facts' module has been renamed to" +
+ " 'azure_rm_virtualmachinescalesetinstance_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(ComputeManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if (self.instance_id is None):
+ self.results['instances'] = self.list()
+ else:
+ self.results['instances'] = self.get()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_machine_scale_set_vms.get(resource_group_name=self.resource_group,
+ vm_scale_set_name=self.vmss_name,
+ instance_id=self.instance_id)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Scale Set VM.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ items = None
+ try:
+ items = self.mgmt_client.virtual_machine_scale_set_vms.list(resource_group_name=self.resource_group,
+ virtual_machine_scale_set_name=self.vmss_name)
+ self.log("Response : {0}".format(items))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine ScaleSet VM.')
+
+ results = []
+ for item in items:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+
+ iv = self.mgmt_client.virtual_machine_scale_set_vms.get_instance_view(resource_group_name=self.resource_group,
+ vm_scale_set_name=self.vmss_name,
+ instance_id=d.get('instance_id', None)).as_dict()
+ power_state = ""
+ for index in range(len(iv['statuses'])):
+ code = iv['statuses'][index]['code'].split('/')
+ if code[0] == 'PowerState':
+ power_state = code[1]
+ break
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d.get('id', None),
+ 'tags': d.get('tags', None),
+ 'instance_id': d.get('instance_id', None),
+ 'latest_model': d.get('latest_model_applied', None),
+ 'name': d.get('name', None),
+ 'provisioning_state': d.get('provisioning_state', None),
+ 'power_state': power_state,
+ 'vm_id': d.get('vm_id', None),
+ 'image_reference': d.get('storage_profile').get('image_reference', None),
+ 'computer_name': d.get('os_profile').get('computer_name', None)
+ }
+ return d
+
+
+def main():
+ AzureRMVirtualMachineScaleSetVMInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetinstance_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetinstance_info.py
new file mode 100644
index 00000000..c263cfc1
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualmachinescalesetinstance_info.py
@@ -0,0 +1,243 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Zim Kalinowski, <zikalino@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualmachinescalesetinstance_info
+short_description: Get Azure Virtual Machine Scale Set Instance facts
+description:
+ - Get facts of Azure Virtual Machine Scale Set VMs.
+
+options:
+ resource_group:
+ description:
+ - The name of the resource group.
+ required: True
+ vmss_name:
+ description:
+ - The name of the VM scale set.
+ required: True
+ instance_id:
+ description:
+ - The instance ID of the virtual machine.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Zim Kalinowski (@zikalino)
+
+'''
+
+EXAMPLES = '''
+ - name: List VM instances in Virtual Machine ScaleSet
+ community.azure.azure_rm_virtualmachinescalesetinstance_info:
+ resource_group: myResourceGroup
+ vmss_name: myVMSS
+'''
+
+RETURN = '''
+instances:
+ description:
+ - A list of dictionaries containing facts for Virtual Machine Scale Set VM.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID.
+ returned: always
+ type: str
+ sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/my
+ VMSS/virtualMachines/2"
+ tags:
+ description:
+ - Resource tags.
+ returned: always
+ type: dict
+ sample: { 'tag1': 'abc' }
+ instance_id:
+ description:
+ - Virtual Machine instance ID.
+ returned: always
+ type: str
+ sample: 0
+ name:
+ description:
+ - Virtual Machine name.
+ returned: always
+ type: str
+ sample: myVMSS_2
+ latest_model:
+ description:
+ - Whether applied latest model.
+ returned: always
+ type: bool
+ sample: True
+ provisioning_state:
+ description:
+ - Provisioning state of the Virtual Machine.
+ returned: always
+ type: str
+ sample: Succeeded
+ power_state:
+ description:
+ - Provisioning state of the Virtual Machine's power.
+ returned: always
+ type: str
+ sample: running
+ vm_id:
+ description:
+ - Virtual Machine ID
+ returned: always
+ type: str
+ sample: 94a141a9-4530-46ac-b151-2c7ff09aa823
+ image_reference:
+ description:
+ - Image reference
+ returned: always
+ type: dict
+ sample: { "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myGroup/providers/Microsoft.Compute/galleries/
+ myGallery/images/myImage/versions/10.1.3"}
+'''
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.mgmt.compute import ComputeManagementClient
+ from msrest.serialization import Model
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+
+class AzureRMVirtualMachineScaleSetVMInfo(AzureRMModuleBase):
+ def __init__(self):
+ # define user inputs into argument
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ vmss_name=dict(
+ type='str',
+ required=True
+ ),
+ instance_id=dict(
+ type='str'
+ ),
+ tags=dict(
+ type='list'
+ )
+ )
+ # store the results of the module operation
+ self.results = dict(
+ changed=False
+ )
+ self.mgmt_client = None
+ self.resource_group = None
+ self.vmss_name = None
+ self.instance_id = None
+ self.tags = None
+ super(AzureRMVirtualMachineScaleSetVMInfo, self).__init__(self.module_arg_spec, supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualmachinescalesetinstance_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualmachinescalesetinstance_facts' module has been renamed to" +
+ " 'azure_rm_virtualmachinescalesetinstance_info'",
+ version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+ self.mgmt_client = self.get_mgmt_svc_client(ComputeManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager)
+
+ if (self.instance_id is None):
+ self.results['instances'] = self.list()
+ else:
+ self.results['instances'] = self.get()
+ return self.results
+
+ def get(self):
+ response = None
+ results = []
+ try:
+ response = self.mgmt_client.virtual_machine_scale_set_vms.get(resource_group_name=self.resource_group,
+ vm_scale_set_name=self.vmss_name,
+ instance_id=self.instance_id)
+ self.log("Response : {0}".format(response))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine Scale Set VM.')
+
+ if response and self.has_tags(response.tags, self.tags):
+ results.append(self.format_response(response))
+
+ return results
+
+ def list(self):
+ items = None
+ try:
+ items = self.mgmt_client.virtual_machine_scale_set_vms.list(resource_group_name=self.resource_group,
+ virtual_machine_scale_set_name=self.vmss_name)
+ self.log("Response : {0}".format(items))
+ except CloudError as e:
+ self.log('Could not get facts for Virtual Machine ScaleSet VM.')
+
+ results = []
+ for item in items:
+ if self.has_tags(item.tags, self.tags):
+ results.append(self.format_response(item))
+ return results
+
+ def format_response(self, item):
+ d = item.as_dict()
+
+ iv = self.mgmt_client.virtual_machine_scale_set_vms.get_instance_view(resource_group_name=self.resource_group,
+ vm_scale_set_name=self.vmss_name,
+ instance_id=d.get('instance_id', None)).as_dict()
+ power_state = ""
+ for index in range(len(iv['statuses'])):
+ code = iv['statuses'][index]['code'].split('/')
+ if code[0] == 'PowerState':
+ power_state = code[1]
+ break
+ d = {
+ 'resource_group': self.resource_group,
+ 'id': d.get('id', None),
+ 'tags': d.get('tags', None),
+ 'instance_id': d.get('instance_id', None),
+ 'latest_model': d.get('latest_model_applied', None),
+ 'name': d.get('name', None),
+ 'provisioning_state': d.get('provisioning_state', None),
+ 'power_state': power_state,
+ 'vm_id': d.get('vm_id', None),
+ 'image_reference': d.get('storage_profile').get('image_reference', None),
+ 'computer_name': d.get('os_profile').get('computer_name', None)
+ }
+ return d
+
+
+def main():
+ AzureRMVirtualMachineScaleSetVMInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetwork_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetwork_facts.py
new file mode 100644
index 00000000..4328708a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetwork_facts.py
@@ -0,0 +1,338 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualnetwork_info
+
+
+short_description: Get virtual network facts
+
+description:
+ - Get facts for a specific virtual network or all virtual networks within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific security group.
+ resource_group:
+ description:
+ - Limit results by resource group. Required when filtering by name.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one virtual network
+ community.azure.azure_rm_virtualnetwork_info:
+ resource_group: myResourceGroup
+ name: secgroup001
+
+ - name: Get facts for all virtual networks
+ community.azure.azure_rm_virtualnetwork_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by tags
+ community.azure.azure_rm_virtualnetwork_info:
+ tags:
+ - testing
+'''
+RETURN = '''
+azure_virtualnetworks:
+ description:
+ - List of virtual network dicts.
+ returned: always
+ type: list
+ example: [{
+ "etag": 'W/"532ba1be-ae71-40f2-9232-3b1d9cf5e37e"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet2001",
+ "location": "eastus2",
+ "name": "vnet2001",
+ "properties": {
+ "addressSpace": {
+ "addressPrefixes": [
+ "10.10.0.0/16"
+ ]
+ },
+ "provisioningState": "Succeeded",
+ "resourceGuid": "a7ba285f-f7e7-4e17-992a-de4d39f28612",
+ "subnets": []
+ },
+ "type": "Microsoft.Network/virtualNetworks"
+ }]
+virtualnetworks:
+ description:
+ - List of virtual network dicts with same format as M(community.azure.azure_rm_virtualnetwork) module parameters.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID of the virtual network.
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet2001
+ returned: always
+ type: str
+ address_prefixes:
+ description:
+ - List of IPv4 address ranges where each is formatted using CIDR notation.
+ sample: ["10.10.0.0/16"]
+ returned: always
+ type: list
+ dns_servers:
+ description:
+ - Custom list of DNS servers.
+ returned: always
+ type: list
+ sample: ["www.azure.com"]
+ location:
+ description:
+ - Valid Azure location.
+ returned: always
+ type: str
+ sample: eastus
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ returned: always
+ type: dict
+ sample: { "tag1": "abc" }
+ provisioning_state:
+ description:
+ - Provisioning state of the resource.
+ returned: always
+ sample: Succeeded
+ type: str
+ name:
+ description:
+ - Name of the virtual network.
+ returned: always
+ type: str
+ sample: foo
+ subnets:
+ description:
+ - Subnets associated with the virtual network.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - Resource ID of the subnet.
+ returned: always
+ type: str
+ sample: "/subscriptions/f64d4ee8-be94-457d-ba26-3fa6b6506cef/resourceGroups/v-xisuRG/providers/
+ Microsoft.Network/virtualNetworks/vnetb57dc95232/subnets/vnetb57dc95232"
+ name:
+ description:
+ - Name of the subnet.
+ returned: always
+ type: str
+ sample: vnetb57dc95232
+ provisioning_state:
+ description:
+ - Provisioning state of the subnet.
+ returned: always
+ type: str
+ sample: Succeeded
+ address_prefix:
+ description:
+ - The address prefix for the subnet.
+ returned: always
+ type: str
+ sample: '10.1.0.0/16'
+ network_security_group:
+ description:
+ - Existing security group ID with which to associate the subnet.
+ returned: always
+ type: str
+ sample: null
+ route_table:
+ description:
+ - The reference of the RouteTable resource.
+ returned: always
+ type: str
+ sample: null
+ service_endpoints:
+ description:
+ - An array of service endpoints.
+ returned: always
+ type: list
+ sample: [
+ {
+ "locations": [
+ "southeastasia",
+ "eastasia"
+ ],
+ "service": "Microsoft.Storage"
+ }
+ ]
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_OBJECT_CLASS = 'VirtualNetwork'
+
+
+class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ )
+
+ self.results = dict(
+ changed=False,
+ virtualnetworks=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMNetworkInterfaceInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualnetwork_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualnetwork_facts' module has been renamed to 'azure_rm_virtualnetwork_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ results = self.get_item()
+ elif self.resource_group is not None:
+ results = self.list_resource_group()
+ else:
+ results = self.list_items()
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_virtualnetworks': self.serialize(results)
+ }
+ self.results['virtualnetworks'] = self.curated(results)
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ results = []
+
+ try:
+ item = self.network_client.virtual_networks.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ results = [item]
+ return results
+
+ def list_resource_group(self):
+ self.log('List items for resource group')
+ try:
+ response = self.network_client.virtual_networks.list(self.resource_group)
+ except CloudError as exc:
+ self.fail("Failed to list for resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item)
+ return results
+
+ def list_items(self):
+ self.log('List all for items')
+ try:
+ response = self.network_client.virtual_networks.list_all()
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item)
+ return results
+
+ def serialize(self, raws):
+ self.log("Serialize all items")
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raws] if raws else []
+
+ def curated(self, raws):
+ self.log("Format all items")
+ return [self.virtualnetwork_to_dict(x) for x in raws] if raws else []
+
+ def virtualnetwork_to_dict(self, vnet):
+ results = dict(
+ id=vnet.id,
+ name=vnet.name,
+ location=vnet.location,
+ tags=vnet.tags,
+ provisioning_state=vnet.provisioning_state
+ )
+ if vnet.dhcp_options and len(vnet.dhcp_options.dns_servers) > 0:
+ results['dns_servers'] = []
+ for server in vnet.dhcp_options.dns_servers:
+ results['dns_servers'].append(server)
+ if vnet.address_space and len(vnet.address_space.address_prefixes) > 0:
+ results['address_prefixes'] = []
+ for space in vnet.address_space.address_prefixes:
+ results['address_prefixes'].append(space)
+ if vnet.subnets and len(vnet.subnets) > 0:
+ results['subnets'] = [self.subnet_to_dict(x) for x in vnet.subnets]
+ return results
+
+ def subnet_to_dict(self, subnet):
+ result = dict(
+ id=subnet.id,
+ name=subnet.name,
+ provisioning_state=subnet.provisioning_state,
+ address_prefix=subnet.address_prefix,
+ network_security_group=subnet.network_security_group.id if subnet.network_security_group else None,
+ route_table=subnet.route_table.id if subnet.route_table else None
+ )
+ if subnet.service_endpoints:
+ result['service_endpoints'] = [{'service': item.service, 'locations': item.locations} for item in subnet.service_endpoints]
+ return result
+
+
+def main():
+ AzureRMNetworkInterfaceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetwork_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetwork_info.py
new file mode 100644
index 00000000..4328708a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetwork_info.py
@@ -0,0 +1,338 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Chris Houseknecht, <house@redhat.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualnetwork_info
+
+
+short_description: Get virtual network facts
+
+description:
+ - Get facts for a specific virtual network or all virtual networks within a resource group.
+
+options:
+ name:
+ description:
+ - Only show results for a specific security group.
+ resource_group:
+ description:
+ - Limit results by resource group. Required when filtering by name.
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Chris Houseknecht (@chouseknecht)
+ - Matt Davis (@nitzmahone)
+
+'''
+
+EXAMPLES = '''
+ - name: Get facts for one virtual network
+ community.azure.azure_rm_virtualnetwork_info:
+ resource_group: myResourceGroup
+ name: secgroup001
+
+ - name: Get facts for all virtual networks
+ community.azure.azure_rm_virtualnetwork_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts by tags
+ community.azure.azure_rm_virtualnetwork_info:
+ tags:
+ - testing
+'''
+RETURN = '''
+azure_virtualnetworks:
+ description:
+ - List of virtual network dicts.
+ returned: always
+ type: list
+ example: [{
+ "etag": 'W/"532ba1be-ae71-40f2-9232-3b1d9cf5e37e"',
+ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroup/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet2001",
+ "location": "eastus2",
+ "name": "vnet2001",
+ "properties": {
+ "addressSpace": {
+ "addressPrefixes": [
+ "10.10.0.0/16"
+ ]
+ },
+ "provisioningState": "Succeeded",
+ "resourceGuid": "a7ba285f-f7e7-4e17-992a-de4d39f28612",
+ "subnets": []
+ },
+ "type": "Microsoft.Network/virtualNetworks"
+ }]
+virtualnetworks:
+ description:
+ - List of virtual network dicts with same format as M(community.azure.azure_rm_virtualnetwork) module parameters.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - Resource ID of the virtual network.
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet2001
+ returned: always
+ type: str
+ address_prefixes:
+ description:
+ - List of IPv4 address ranges where each is formatted using CIDR notation.
+ sample: ["10.10.0.0/16"]
+ returned: always
+ type: list
+ dns_servers:
+ description:
+ - Custom list of DNS servers.
+ returned: always
+ type: list
+ sample: ["www.azure.com"]
+ location:
+ description:
+ - Valid Azure location.
+ returned: always
+ type: str
+ sample: eastus
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ returned: always
+ type: dict
+ sample: { "tag1": "abc" }
+ provisioning_state:
+ description:
+ - Provisioning state of the resource.
+ returned: always
+ sample: Succeeded
+ type: str
+ name:
+ description:
+ - Name of the virtual network.
+ returned: always
+ type: str
+ sample: foo
+ subnets:
+ description:
+ - Subnets associated with the virtual network.
+ returned: always
+ type: list
+ contains:
+ id:
+ description:
+ - Resource ID of the subnet.
+ returned: always
+ type: str
+ sample: "/subscriptions/f64d4ee8-be94-457d-ba26-3fa6b6506cef/resourceGroups/v-xisuRG/providers/
+ Microsoft.Network/virtualNetworks/vnetb57dc95232/subnets/vnetb57dc95232"
+ name:
+ description:
+ - Name of the subnet.
+ returned: always
+ type: str
+ sample: vnetb57dc95232
+ provisioning_state:
+ description:
+ - Provisioning state of the subnet.
+ returned: always
+ type: str
+ sample: Succeeded
+ address_prefix:
+ description:
+ - The address prefix for the subnet.
+ returned: always
+ type: str
+ sample: '10.1.0.0/16'
+ network_security_group:
+ description:
+ - Existing security group ID with which to associate the subnet.
+ returned: always
+ type: str
+ sample: null
+ route_table:
+ description:
+ - The reference of the RouteTable resource.
+ returned: always
+ type: str
+ sample: null
+ service_endpoints:
+ description:
+ - An array of service endpoints.
+ returned: always
+ type: list
+ sample: [
+ {
+ "locations": [
+ "southeastasia",
+ "eastasia"
+ ],
+ "service": "Microsoft.Storage"
+ }
+ ]
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+AZURE_OBJECT_CLASS = 'VirtualNetwork'
+
+
+class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ )
+
+ self.results = dict(
+ changed=False,
+ virtualnetworks=[]
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+
+ super(AzureRMNetworkInterfaceInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_virtualnetwork_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualnetwork_facts' module has been renamed to 'azure_rm_virtualnetwork_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name is not None:
+ results = self.get_item()
+ elif self.resource_group is not None:
+ results = self.list_resource_group()
+ else:
+ results = self.list_items()
+
+ if is_old_facts:
+ self.results['ansible_facts'] = {
+ 'azure_virtualnetworks': self.serialize(results)
+ }
+ self.results['virtualnetworks'] = self.curated(results)
+
+ return self.results
+
+ def get_item(self):
+ self.log('Get properties for {0}'.format(self.name))
+ item = None
+ results = []
+
+ try:
+ item = self.network_client.virtual_networks.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ results = [item]
+ return results
+
+ def list_resource_group(self):
+ self.log('List items for resource group')
+ try:
+ response = self.network_client.virtual_networks.list(self.resource_group)
+ except CloudError as exc:
+ self.fail("Failed to list for resource group {0} - {1}".format(self.resource_group, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item)
+ return results
+
+ def list_items(self):
+ self.log('List all for items')
+ try:
+ response = self.network_client.virtual_networks.list_all()
+ except CloudError as exc:
+ self.fail("Failed to list all items - {0}".format(str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ results.append(item)
+ return results
+
+ def serialize(self, raws):
+ self.log("Serialize all items")
+ return [self.serialize_obj(item, AZURE_OBJECT_CLASS) for item in raws] if raws else []
+
+ def curated(self, raws):
+ self.log("Format all items")
+ return [self.virtualnetwork_to_dict(x) for x in raws] if raws else []
+
+ def virtualnetwork_to_dict(self, vnet):
+ results = dict(
+ id=vnet.id,
+ name=vnet.name,
+ location=vnet.location,
+ tags=vnet.tags,
+ provisioning_state=vnet.provisioning_state
+ )
+ if vnet.dhcp_options and len(vnet.dhcp_options.dns_servers) > 0:
+ results['dns_servers'] = []
+ for server in vnet.dhcp_options.dns_servers:
+ results['dns_servers'].append(server)
+ if vnet.address_space and len(vnet.address_space.address_prefixes) > 0:
+ results['address_prefixes'] = []
+ for space in vnet.address_space.address_prefixes:
+ results['address_prefixes'].append(space)
+ if vnet.subnets and len(vnet.subnets) > 0:
+ results['subnets'] = [self.subnet_to_dict(x) for x in vnet.subnets]
+ return results
+
+ def subnet_to_dict(self, subnet):
+ result = dict(
+ id=subnet.id,
+ name=subnet.name,
+ provisioning_state=subnet.provisioning_state,
+ address_prefix=subnet.address_prefix,
+ network_security_group=subnet.network_security_group.id if subnet.network_security_group else None,
+ route_table=subnet.route_table.id if subnet.route_table else None
+ )
+ if subnet.service_endpoints:
+ result['service_endpoints'] = [{'service': item.service, 'locations': item.locations} for item in subnet.service_endpoints]
+ return result
+
+
+def main():
+ AzureRMNetworkInterfaceInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetworkpeering_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetworkpeering_facts.py
new file mode 100644
index 00000000..e8497cbb
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetworkpeering_facts.py
@@ -0,0 +1,256 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yunge Zhu (@yungezz)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualnetworkpeering_info
+short_description: Get facts of Azure Virtual Network Peering
+description:
+ - Get facts of Azure Virtual Network Peering.
+
+options:
+ resource_group:
+ description:
+ - Name of a resource group where the vnet exists.
+ required: True
+ virtual_network:
+ description:
+ - Name or resource ID of a virtual network.
+ required: True
+ name:
+ description:
+ - Name of the virtual network peering.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get virtual network peering by name
+ community.azure.azure_rm_virtualnetworkpeering_info:
+ resource_group: myResourceGroup
+ virtual_network: myVnet1
+ name: myVnetPeer
+
+ - name: List virtual network peering of virtual network
+ azure_rm_virtualnetworkpeering:
+ resource_group: myResourceGroup
+ virtual_network: myVnet1
+'''
+
+RETURN = '''
+vnetpeerings:
+ description:
+ - A list of Virtual Network Peering facts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description: ID of current Virtual Network peering.
+ returned: always
+ type: str
+ sample:
+ "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/virtualNetworkPeerings/peer1"
+ name:
+ description:
+ - Name of Virtual Network peering.
+ returned: always
+ type: str
+ sample: myPeering
+ remote_virtual_network:
+ description:
+ - ID of remote Virtual Network to be peered to.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet2
+ remote_address_space:
+ description:
+ - The reference of the remote Virtual Network address space.
+ type: complex
+ returned: always
+ contains:
+ address_prefixes:
+ description:
+ - A list of address blocks reserved for this Virtual Network in CIDR notation.
+ returned: always
+ type: list
+ sample: 10.1.0.0/16
+ peering_state:
+ description:
+ - The state of the virtual network peering.
+ returned: always
+ type: str
+ sample: Connected
+ provisioning_state:
+ description:
+ - The provisioning state of the resource.
+ returned: always
+ type: str
+ sample: Succeeded
+ allow_forwarded_traffic:
+ description:
+ - Whether forwarded traffic from the VMs in the remote Virtual Network will be allowed/disallowed.
+ returned: always
+ type: bool
+ sample: False
+ allow_gateway_transit:
+ description:
+ - Whether gateway links can be used in remote Virtual Networking to link to this Virtual Network.
+ returned: always
+ type: bool
+ sample: False
+ allow_virtual_network_access:
+ description:
+ - Whether the VMs in the linked Virtual Network space can access all the VMs in local Virtual Network space.
+ returned: always
+ type: bool
+ sample: False
+ use_remote_gateways:
+ description:
+ - Whether remote gateways can be used on this Virtual Network.
+ returned: always
+ type: bool
+ sample: False
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.polling import LROPoller
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+def vnetpeering_to_dict(vnetpeering):
+ '''
+ Convert a virtual network peering object to a dict.
+ '''
+ results = dict(
+ id=vnetpeering.id,
+ name=vnetpeering.name,
+ remote_virtual_network=vnetpeering.remote_virtual_network.id,
+ remote_address_space=dict(
+ address_prefixes=vnetpeering.remote_address_space.address_prefixes
+ ),
+ peering_state=vnetpeering.peering_state,
+ provisioning_state=vnetpeering.provisioning_state,
+ use_remote_gateways=vnetpeering.use_remote_gateways,
+ allow_gateway_transit=vnetpeering.allow_gateway_transit,
+ allow_forwarded_traffic=vnetpeering.allow_forwarded_traffic,
+ allow_virtual_network_access=vnetpeering.allow_virtual_network_access
+ )
+ return results
+
+
+class AzureRMVirtualNetworkPeeringInfo(AzureRMModuleBase):
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ virtual_network=dict(
+ type='raw',
+ required=True
+ )
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.virtual_network = None
+
+ self.results = dict(changed=False)
+
+ super(AzureRMVirtualNetworkPeeringInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+ is_old_facts = self.module._name == 'azure_rm_virtualnetworkpeering_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualnetworkpeering_facts' module has been renamed to 'azure_rm_virtualnetworkpeering_info'", version='2.13')
+
+ for key in list(self.module_arg_spec.keys()):
+ setattr(self, key, kwargs[key])
+
+ # parse virtual_network
+ self.virtual_network = self.parse_resource_to_dict(self.virtual_network)
+ if self.virtual_network['resource_group'] != self.resource_group:
+ self.fail('Resource group of virtual_network is not same as param resource_group')
+
+ self.results['vnetpeerings'] = []
+ # get vnet peering
+ if self.name:
+ self.results['vnetpeerings'] = self.get_by_name()
+ else:
+ self.results['vnetpeerings'] = self.list_by_vnet()
+
+ return self.results
+
+ def get_by_name(self):
+ '''
+ Gets the Virtual Network Peering.
+
+ :return: List of Virtual Network Peering
+ '''
+ self.log(
+ "Get Virtual Network Peering {0}".format(self.name))
+ results = []
+ try:
+ response = self.network_client.virtual_network_peerings.get(resource_group_name=self.resource_group,
+ virtual_network_name=self.virtual_network['name'],
+ virtual_network_peering_name=self.name)
+ self.log("Response : {0}".format(response))
+ results.append(vnetpeering_to_dict(response))
+ except CloudError:
+ self.log('Did not find the Virtual Network Peering.')
+ return results
+
+ def list_by_vnet(self):
+ '''
+ Lists the Virtual Network Peering in specific Virtual Network.
+
+ :return: List of Virtual Network Peering
+ '''
+ self.log(
+ "List Virtual Network Peering in Virtual Network {0}".format(self.virtual_network['name']))
+ results = []
+ try:
+ response = self.network_client.virtual_network_peerings.list(resource_group_name=self.resource_group,
+ virtual_network_name=self.virtual_network['name'])
+ self.log("Response : {0}".format(response))
+ if response:
+ for p in response:
+ results.append(vnetpeering_to_dict(p))
+ except CloudError:
+ self.log('Did not find the Virtual Network Peering.')
+ return results
+
+
+def main():
+ """Main execution"""
+ AzureRMVirtualNetworkPeeringInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetworkpeering_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetworkpeering_info.py
new file mode 100644
index 00000000..e8497cbb
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_virtualnetworkpeering_info.py
@@ -0,0 +1,256 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2019 Yunge Zhu (@yungezz)
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+DOCUMENTATION = '''
+---
+module: azure_rm_virtualnetworkpeering_info
+short_description: Get facts of Azure Virtual Network Peering
+description:
+ - Get facts of Azure Virtual Network Peering.
+
+options:
+ resource_group:
+ description:
+ - Name of a resource group where the vnet exists.
+ required: True
+ virtual_network:
+ description:
+ - Name or resource ID of a virtual network.
+ required: True
+ name:
+ description:
+ - Name of the virtual network peering.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get virtual network peering by name
+ community.azure.azure_rm_virtualnetworkpeering_info:
+ resource_group: myResourceGroup
+ virtual_network: myVnet1
+ name: myVnetPeer
+
+ - name: List virtual network peering of virtual network
+ azure_rm_virtualnetworkpeering:
+ resource_group: myResourceGroup
+ virtual_network: myVnet1
+'''
+
+RETURN = '''
+vnetpeerings:
+ description:
+ - A list of Virtual Network Peering facts.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description: ID of current Virtual Network peering.
+ returned: always
+ type: str
+ sample:
+ "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/virtualNetworkPeerings/peer1"
+ name:
+ description:
+ - Name of Virtual Network peering.
+ returned: always
+ type: str
+ sample: myPeering
+ remote_virtual_network:
+ description:
+ - ID of remote Virtual Network to be peered to.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet2
+ remote_address_space:
+ description:
+ - The reference of the remote Virtual Network address space.
+ type: complex
+ returned: always
+ contains:
+ address_prefixes:
+ description:
+ - A list of address blocks reserved for this Virtual Network in CIDR notation.
+ returned: always
+ type: list
+ sample: 10.1.0.0/16
+ peering_state:
+ description:
+ - The state of the virtual network peering.
+ returned: always
+ type: str
+ sample: Connected
+ provisioning_state:
+ description:
+ - The provisioning state of the resource.
+ returned: always
+ type: str
+ sample: Succeeded
+ allow_forwarded_traffic:
+ description:
+ - Whether forwarded traffic from the VMs in the remote Virtual Network will be allowed/disallowed.
+ returned: always
+ type: bool
+ sample: False
+ allow_gateway_transit:
+ description:
+ - Whether gateway links can be used in remote Virtual Networking to link to this Virtual Network.
+ returned: always
+ type: bool
+ sample: False
+ allow_virtual_network_access:
+ description:
+ - Whether the VMs in the linked Virtual Network space can access all the VMs in local Virtual Network space.
+ returned: always
+ type: bool
+ sample: False
+ use_remote_gateways:
+ description:
+ - Whether remote gateways can be used on this Virtual Network.
+ returned: always
+ type: bool
+ sample: False
+'''
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.polling import LROPoller
+except ImportError:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+
+def vnetpeering_to_dict(vnetpeering):
+ '''
+ Convert a virtual network peering object to a dict.
+ '''
+ results = dict(
+ id=vnetpeering.id,
+ name=vnetpeering.name,
+ remote_virtual_network=vnetpeering.remote_virtual_network.id,
+ remote_address_space=dict(
+ address_prefixes=vnetpeering.remote_address_space.address_prefixes
+ ),
+ peering_state=vnetpeering.peering_state,
+ provisioning_state=vnetpeering.provisioning_state,
+ use_remote_gateways=vnetpeering.use_remote_gateways,
+ allow_gateway_transit=vnetpeering.allow_gateway_transit,
+ allow_forwarded_traffic=vnetpeering.allow_forwarded_traffic,
+ allow_virtual_network_access=vnetpeering.allow_virtual_network_access
+ )
+ return results
+
+
+class AzureRMVirtualNetworkPeeringInfo(AzureRMModuleBase):
+
+ def __init__(self):
+ self.module_arg_spec = dict(
+ resource_group=dict(
+ type='str',
+ required=True
+ ),
+ name=dict(
+ type='str'
+ ),
+ virtual_network=dict(
+ type='raw',
+ required=True
+ )
+ )
+
+ self.resource_group = None
+ self.name = None
+ self.virtual_network = None
+
+ self.results = dict(changed=False)
+
+ super(AzureRMVirtualNetworkPeeringInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
+ supports_tags=False)
+
+ def exec_module(self, **kwargs):
+ """Main module execution method"""
+ is_old_facts = self.module._name == 'azure_rm_virtualnetworkpeering_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_virtualnetworkpeering_facts' module has been renamed to 'azure_rm_virtualnetworkpeering_info'", version='2.13')
+
+ for key in list(self.module_arg_spec.keys()):
+ setattr(self, key, kwargs[key])
+
+ # parse virtual_network
+ self.virtual_network = self.parse_resource_to_dict(self.virtual_network)
+ if self.virtual_network['resource_group'] != self.resource_group:
+ self.fail('Resource group of virtual_network is not same as param resource_group')
+
+ self.results['vnetpeerings'] = []
+ # get vnet peering
+ if self.name:
+ self.results['vnetpeerings'] = self.get_by_name()
+ else:
+ self.results['vnetpeerings'] = self.list_by_vnet()
+
+ return self.results
+
+ def get_by_name(self):
+ '''
+ Gets the Virtual Network Peering.
+
+ :return: List of Virtual Network Peering
+ '''
+ self.log(
+ "Get Virtual Network Peering {0}".format(self.name))
+ results = []
+ try:
+ response = self.network_client.virtual_network_peerings.get(resource_group_name=self.resource_group,
+ virtual_network_name=self.virtual_network['name'],
+ virtual_network_peering_name=self.name)
+ self.log("Response : {0}".format(response))
+ results.append(vnetpeering_to_dict(response))
+ except CloudError:
+ self.log('Did not find the Virtual Network Peering.')
+ return results
+
+ def list_by_vnet(self):
+ '''
+ Lists the Virtual Network Peering in specific Virtual Network.
+
+ :return: List of Virtual Network Peering
+ '''
+ self.log(
+ "List Virtual Network Peering in Virtual Network {0}".format(self.virtual_network['name']))
+ results = []
+ try:
+ response = self.network_client.virtual_network_peerings.list(resource_group_name=self.resource_group,
+ virtual_network_name=self.virtual_network['name'])
+ self.log("Response : {0}".format(response))
+ if response:
+ for p in response:
+ results.append(vnetpeering_to_dict(p))
+ except CloudError:
+ self.log('Did not find the Virtual Network Peering.')
+ return results
+
+
+def main():
+ """Main execution"""
+ AzureRMVirtualNetworkPeeringInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_webapp_facts.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_webapp_facts.py
new file mode 100644
index 00000000..a20f522a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_webapp_facts.py
@@ -0,0 +1,488 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yunge Zhu, <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_webapp_info
+
+
+short_description: Get Azure web app facts
+
+description:
+ - Get facts for a specific web app or all web app in a resource group, or all web app in current subscription.
+
+options:
+ name:
+ description:
+ - Only show results for a specific web app.
+ resource_group:
+ description:
+ - Limit results by resource group.
+ return_publish_profile:
+ description:
+ - Indicate whether to return publishing profile of the web app.
+ default: False
+ type: bool
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for web app by name
+ community.azure.azure_rm_webapp_info:
+ resource_group: myResourceGroup
+ name: winwebapp1
+
+ - name: Get facts for web apps in resource group
+ community.azure.azure_rm_webapp_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts for web apps with tags
+ community.azure.azure_rm_webapp_info:
+ tags:
+ - testtag
+ - foo:bar
+'''
+
+RETURN = '''
+webapps:
+ description:
+ - List of web apps.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - ID of the web app.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp
+ name:
+ description:
+ - Name of the web app.
+ returned: always
+ type: str
+ sample: winwebapp1
+ resource_group:
+ description:
+ - Resource group of the web app.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ location:
+ description:
+ - Location of the web app.
+ returned: always
+ type: str
+ sample: eastus
+ plan:
+ description:
+ - ID of app service plan used by the web app.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan
+ app_settings:
+ description:
+ - App settings of the application. Only returned when web app has app settings.
+ returned: always
+ type: dict
+ sample: {
+ "testkey": "testvalue",
+ "testkey2": "testvalue2"
+ }
+ frameworks:
+ description:
+ - Frameworks of the application. Only returned when web app has frameworks.
+ returned: always
+ type: list
+ sample: [
+ {
+ "name": "net_framework",
+ "version": "v4.0"
+ },
+ {
+ "name": "java",
+ "settings": {
+ "java_container": "tomcat",
+ "java_container_version": "8.5"
+ },
+ "version": "1.7"
+ },
+ {
+ "name": "php",
+ "version": "5.6"
+ }
+ ]
+ availability_state:
+ description:
+ - Availability of this web app.
+ returned: always
+ type: str
+ sample: Normal
+ default_host_name:
+ description:
+ - Host name of the web app.
+ returned: always
+ type: str
+ sample: vxxisurg397winapp4.azurewebsites.net
+ enabled:
+ description:
+ - Indicates the web app enabled or not.
+ returned: always
+ type: bool
+ sample: true
+ enabled_host_names:
+ description:
+ - Enabled host names of the web app.
+ returned: always
+ type: list
+ sample: [
+ "vxxisurg397winapp4.azurewebsites.net",
+ "vxxisurg397winapp4.scm.azurewebsites.net"
+ ]
+ host_name_ssl_states:
+ description:
+ - SSL state per host names of the web app.
+ returned: always
+ type: list
+ sample: [
+ {
+ "hostType": "Standard",
+ "name": "vxxisurg397winapp4.azurewebsites.net",
+ "sslState": "Disabled"
+ },
+ {
+ "hostType": "Repository",
+ "name": "vxxisurg397winapp4.scm.azurewebsites.net",
+ "sslState": "Disabled"
+ }
+ ]
+ host_names:
+ description:
+ - Host names of the web app.
+ returned: always
+ type: list
+ sample: [
+ "vxxisurg397winapp4.azurewebsites.net"
+ ]
+ outbound_ip_addresses:
+ description:
+ - Outbound IP address of the web app.
+ returned: always
+ type: str
+ sample: "40.71.11.131,40.85.166.200,168.62.166.67,137.135.126.248,137.135.121.45"
+ ftp_publish_url:
+ description:
+ - Publishing URL of the web app when deployment type is FTP.
+ returned: always
+ type: str
+ sample: ftp://xxxx.ftp.azurewebsites.windows.net
+ state:
+ description:
+ - State of the web app.
+ returned: always
+ type: str
+ sample: running
+ publishing_username:
+ description:
+ - Publishing profile user name.
+ returned: only when I(return_publish_profile=True).
+ type: str
+ sample: "$vxxisuRG397winapp4"
+ publishing_password:
+ description:
+ - Publishing profile password.
+ returned: only when I(return_publish_profile=True).
+ type: str
+ sample: "uvANsPQpGjWJmrFfm4Ssd5rpBSqGhjMk11pMSgW2vCsQtNx9tcgZ0xN26s9A"
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ returned: always
+ type: dict
+ sample: { tag1: abc }
+'''
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.polling import LROPoller
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+AZURE_OBJECT_CLASS = 'WebApp'
+
+
+class AzureRMWebAppInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ return_publish_profile=dict(type='bool', default=False),
+ )
+
+ self.results = dict(
+ changed=False,
+ webapps=[],
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.return_publish_profile = False
+
+ self.framework_names = ['net_framework', 'java', 'php', 'node', 'python', 'dotnetcore', 'ruby']
+
+ super(AzureRMWebAppInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_webapp_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_webapp_facts' module has been renamed to 'azure_rm_webapp_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ self.results['webapps'] = self.list_by_name()
+ elif self.resource_group:
+ self.results['webapps'] = self.list_by_resource_group()
+ else:
+ self.results['webapps'] = self.list_all()
+
+ return self.results
+
+ def list_by_name(self):
+ self.log('Get web app {0}'.format(self.name))
+ item = None
+ result = []
+
+ try:
+ item = self.web_client.web_apps.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ curated_result = self.get_curated_webapp(self.resource_group, self.name, item)
+ result = [curated_result]
+
+ return result
+
+ def list_by_resource_group(self):
+ self.log('List web apps in resource groups {0}'.format(self.resource_group))
+ try:
+ response = list(self.web_client.web_apps.list_by_resource_group(self.resource_group))
+ except CloudError as exc:
+ request_id = exc.request_id if exc.request_id else ''
+ self.fail("Error listing web apps in resource groups {0}, request id: {1} - {2}".format(self.resource_group, request_id, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ curated_output = self.get_curated_webapp(self.resource_group, item.name, item)
+ results.append(curated_output)
+ return results
+
+ def list_all(self):
+ self.log('List web apps in current subscription')
+ try:
+ response = list(self.web_client.web_apps.list())
+ except CloudError as exc:
+ request_id = exc.request_id if exc.request_id else ''
+ self.fail("Error listing web apps, request id {0} - {1}".format(request_id, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ curated_output = self.get_curated_webapp(item.resource_group, item.name, item)
+ results.append(curated_output)
+ return results
+
+ def list_webapp_configuration(self, resource_group, name):
+ self.log('Get web app {0} configuration'.format(name))
+
+ response = []
+
+ try:
+ response = self.web_client.web_apps.get_configuration(resource_group_name=resource_group, name=name)
+ except CloudError as ex:
+ request_id = ex.request_id if ex.request_id else ''
+ self.fail('Error getting web app {0} configuration, request id {1} - {2}'.format(name, request_id, str(ex)))
+
+ return response.as_dict()
+
+ def list_webapp_appsettings(self, resource_group, name):
+ self.log('Get web app {0} app settings'.format(name))
+
+ response = []
+
+ try:
+ response = self.web_client.web_apps.list_application_settings(resource_group_name=resource_group, name=name)
+ except CloudError as ex:
+ request_id = ex.request_id if ex.request_id else ''
+ self.fail('Error getting web app {0} app settings, request id {1} - {2}'.format(name, request_id, str(ex)))
+
+ return response.as_dict()
+
+ def get_publish_credentials(self, resource_group, name):
+ self.log('Get web app {0} publish credentials'.format(name))
+ try:
+ poller = self.web_client.web_apps.list_publishing_credentials(resource_group, name)
+ if isinstance(poller, LROPoller):
+ response = self.get_poller_result(poller)
+ except CloudError as ex:
+ request_id = ex.request_id if ex.request_id else ''
+ self.fail('Error getting web app {0} publishing credentials - {1}'.format(request_id, str(ex)))
+ return response
+
+ def get_webapp_ftp_publish_url(self, resource_group, name):
+ import xmltodict
+
+ self.log('Get web app {0} app publish profile'.format(name))
+
+ url = None
+ try:
+ content = self.web_client.web_apps.list_publishing_profile_xml_with_secrets(resource_group_name=resource_group, name=name)
+ if not content:
+ return url
+
+ full_xml = ''
+ for f in content:
+ full_xml += f.decode()
+ profiles = xmltodict.parse(full_xml, xml_attribs=True)['publishData']['publishProfile']
+
+ if not profiles:
+ return url
+
+ for profile in profiles:
+ if profile['@publishMethod'] == 'FTP':
+ url = profile['@publishUrl']
+
+ except CloudError as ex:
+ self.fail('Error getting web app {0} app settings'.format(name))
+
+ return url
+
+ def get_curated_webapp(self, resource_group, name, webapp):
+ pip = self.serialize_obj(webapp, AZURE_OBJECT_CLASS)
+
+ try:
+ site_config = self.list_webapp_configuration(resource_group, name)
+ app_settings = self.list_webapp_appsettings(resource_group, name)
+ publish_cred = self.get_publish_credentials(resource_group, name)
+ ftp_publish_url = self.get_webapp_ftp_publish_url(resource_group, name)
+ except CloudError as ex:
+ pass
+ return self.construct_curated_webapp(webapp=pip,
+ configuration=site_config,
+ app_settings=app_settings,
+ deployment_slot=None,
+ ftp_publish_url=ftp_publish_url,
+ publish_credentials=publish_cred)
+
+ def construct_curated_webapp(self,
+ webapp,
+ configuration=None,
+ app_settings=None,
+ deployment_slot=None,
+ ftp_publish_url=None,
+ publish_credentials=None):
+ curated_output = dict()
+ curated_output['id'] = webapp['id']
+ curated_output['name'] = webapp['name']
+ curated_output['resource_group'] = webapp['properties']['resourceGroup']
+ curated_output['location'] = webapp['location']
+ curated_output['plan'] = webapp['properties']['serverFarmId']
+ curated_output['tags'] = webapp.get('tags', None)
+
+ # important properties from output. not match input arguments.
+ curated_output['app_state'] = webapp['properties']['state']
+ curated_output['availability_state'] = webapp['properties']['availabilityState']
+ curated_output['default_host_name'] = webapp['properties']['defaultHostName']
+ curated_output['host_names'] = webapp['properties']['hostNames']
+ curated_output['enabled'] = webapp['properties']['enabled']
+ curated_output['enabled_host_names'] = webapp['properties']['enabledHostNames']
+ curated_output['host_name_ssl_states'] = webapp['properties']['hostNameSslStates']
+ curated_output['outbound_ip_addresses'] = webapp['properties']['outboundIpAddresses']
+
+ # curated site_config
+ if configuration:
+ curated_output['frameworks'] = []
+ for fx_name in self.framework_names:
+ fx_version = configuration.get(fx_name + '_version', None)
+ if fx_version:
+ fx = {
+ 'name': fx_name,
+ 'version': fx_version
+ }
+ # java container setting
+ if fx_name == 'java':
+ if configuration['java_container'] and configuration['java_container_version']:
+ settings = {
+ 'java_container': configuration['java_container'].lower(),
+ 'java_container_version': configuration['java_container_version']
+ }
+ fx['settings'] = settings
+
+ curated_output['frameworks'].append(fx)
+
+ # linux_fx_version
+ if configuration.get('linux_fx_version', None):
+ tmp = configuration.get('linux_fx_version').split("|")
+ if len(tmp) == 2:
+ curated_output['frameworks'].append({'name': tmp[0].lower(), 'version': tmp[1]})
+
+ # curated app_settings
+ if app_settings and app_settings.get('properties', None):
+ curated_output['app_settings'] = dict()
+ for item in app_settings['properties']:
+ curated_output['app_settings'][item] = app_settings['properties'][item]
+
+ # curated deploymenet_slot
+ if deployment_slot:
+ curated_output['deployment_slot'] = deployment_slot
+
+ # ftp_publish_url
+ if ftp_publish_url:
+ curated_output['ftp_publish_url'] = ftp_publish_url
+
+ # curated publish credentials
+ if publish_credentials and self.return_publish_profile:
+ curated_output['publishing_username'] = publish_credentials.publishing_user_name
+ curated_output['publishing_password'] = publish_credentials.publishing_password
+ return curated_output
+
+
+def main():
+ AzureRMWebAppInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_webapp_info.py b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_webapp_info.py
new file mode 100644
index 00000000..a20f522a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/plugins/modules/azure_rm_webapp_info.py
@@ -0,0 +1,488 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2018 Yunge Zhu, <yungez@microsoft.com>
+#
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+---
+module: azure_rm_webapp_info
+
+
+short_description: Get Azure web app facts
+
+description:
+ - Get facts for a specific web app or all web app in a resource group, or all web app in current subscription.
+
+options:
+ name:
+ description:
+ - Only show results for a specific web app.
+ resource_group:
+ description:
+ - Limit results by resource group.
+ return_publish_profile:
+ description:
+ - Indicate whether to return publishing profile of the web app.
+ default: False
+ type: bool
+ tags:
+ description:
+ - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'.
+
+extends_documentation_fragment:
+- azure.azcollection.azure
+
+
+author:
+ - Yunge Zhu (@yungezz)
+'''
+
+EXAMPLES = '''
+ - name: Get facts for web app by name
+ community.azure.azure_rm_webapp_info:
+ resource_group: myResourceGroup
+ name: winwebapp1
+
+ - name: Get facts for web apps in resource group
+ community.azure.azure_rm_webapp_info:
+ resource_group: myResourceGroup
+
+ - name: Get facts for web apps with tags
+ community.azure.azure_rm_webapp_info:
+ tags:
+ - testtag
+ - foo:bar
+'''
+
+RETURN = '''
+webapps:
+ description:
+ - List of web apps.
+ returned: always
+ type: complex
+ contains:
+ id:
+ description:
+ - ID of the web app.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp
+ name:
+ description:
+ - Name of the web app.
+ returned: always
+ type: str
+ sample: winwebapp1
+ resource_group:
+ description:
+ - Resource group of the web app.
+ returned: always
+ type: str
+ sample: myResourceGroup
+ location:
+ description:
+ - Location of the web app.
+ returned: always
+ type: str
+ sample: eastus
+ plan:
+ description:
+ - ID of app service plan used by the web app.
+ returned: always
+ type: str
+ sample: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Web/serverfarms/myAppServicePlan
+ app_settings:
+ description:
+ - App settings of the application. Only returned when web app has app settings.
+ returned: always
+ type: dict
+ sample: {
+ "testkey": "testvalue",
+ "testkey2": "testvalue2"
+ }
+ frameworks:
+ description:
+ - Frameworks of the application. Only returned when web app has frameworks.
+ returned: always
+ type: list
+ sample: [
+ {
+ "name": "net_framework",
+ "version": "v4.0"
+ },
+ {
+ "name": "java",
+ "settings": {
+ "java_container": "tomcat",
+ "java_container_version": "8.5"
+ },
+ "version": "1.7"
+ },
+ {
+ "name": "php",
+ "version": "5.6"
+ }
+ ]
+ availability_state:
+ description:
+ - Availability of this web app.
+ returned: always
+ type: str
+ sample: Normal
+ default_host_name:
+ description:
+ - Host name of the web app.
+ returned: always
+ type: str
+ sample: vxxisurg397winapp4.azurewebsites.net
+ enabled:
+ description:
+ - Indicates the web app enabled or not.
+ returned: always
+ type: bool
+ sample: true
+ enabled_host_names:
+ description:
+ - Enabled host names of the web app.
+ returned: always
+ type: list
+ sample: [
+ "vxxisurg397winapp4.azurewebsites.net",
+ "vxxisurg397winapp4.scm.azurewebsites.net"
+ ]
+ host_name_ssl_states:
+ description:
+ - SSL state per host names of the web app.
+ returned: always
+ type: list
+ sample: [
+ {
+ "hostType": "Standard",
+ "name": "vxxisurg397winapp4.azurewebsites.net",
+ "sslState": "Disabled"
+ },
+ {
+ "hostType": "Repository",
+ "name": "vxxisurg397winapp4.scm.azurewebsites.net",
+ "sslState": "Disabled"
+ }
+ ]
+ host_names:
+ description:
+ - Host names of the web app.
+ returned: always
+ type: list
+ sample: [
+ "vxxisurg397winapp4.azurewebsites.net"
+ ]
+ outbound_ip_addresses:
+ description:
+ - Outbound IP address of the web app.
+ returned: always
+ type: str
+ sample: "40.71.11.131,40.85.166.200,168.62.166.67,137.135.126.248,137.135.121.45"
+ ftp_publish_url:
+ description:
+ - Publishing URL of the web app when deployment type is FTP.
+ returned: always
+ type: str
+ sample: ftp://xxxx.ftp.azurewebsites.windows.net
+ state:
+ description:
+ - State of the web app.
+ returned: always
+ type: str
+ sample: running
+ publishing_username:
+ description:
+ - Publishing profile user name.
+ returned: only when I(return_publish_profile=True).
+ type: str
+ sample: "$vxxisuRG397winapp4"
+ publishing_password:
+ description:
+ - Publishing profile password.
+ returned: only when I(return_publish_profile=True).
+ type: str
+ sample: "uvANsPQpGjWJmrFfm4Ssd5rpBSqGhjMk11pMSgW2vCsQtNx9tcgZ0xN26s9A"
+ tags:
+ description:
+ - Tags assigned to the resource. Dictionary of string:string pairs.
+ returned: always
+ type: dict
+ sample: { tag1: abc }
+'''
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.polling import LROPoller
+ from azure.common import AzureMissingResourceHttpError, AzureHttpError
+except Exception:
+ # This is handled in azure_rm_common
+ pass
+
+from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+
+AZURE_OBJECT_CLASS = 'WebApp'
+
+
+class AzureRMWebAppInfo(AzureRMModuleBase):
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ name=dict(type='str'),
+ resource_group=dict(type='str'),
+ tags=dict(type='list'),
+ return_publish_profile=dict(type='bool', default=False),
+ )
+
+ self.results = dict(
+ changed=False,
+ webapps=[],
+ )
+
+ self.name = None
+ self.resource_group = None
+ self.tags = None
+ self.return_publish_profile = False
+
+ self.framework_names = ['net_framework', 'java', 'php', 'node', 'python', 'dotnetcore', 'ruby']
+
+ super(AzureRMWebAppInfo, self).__init__(self.module_arg_spec,
+ supports_tags=False,
+ facts_module=True)
+
+ def exec_module(self, **kwargs):
+ is_old_facts = self.module._name == 'azure_rm_webapp_facts'
+ if is_old_facts:
+ self.module.deprecate("The 'azure_rm_webapp_facts' module has been renamed to 'azure_rm_webapp_info'", version='2.13')
+
+ for key in self.module_arg_spec:
+ setattr(self, key, kwargs[key])
+
+ if self.name:
+ self.results['webapps'] = self.list_by_name()
+ elif self.resource_group:
+ self.results['webapps'] = self.list_by_resource_group()
+ else:
+ self.results['webapps'] = self.list_all()
+
+ return self.results
+
+ def list_by_name(self):
+ self.log('Get web app {0}'.format(self.name))
+ item = None
+ result = []
+
+ try:
+ item = self.web_client.web_apps.get(self.resource_group, self.name)
+ except CloudError:
+ pass
+
+ if item and self.has_tags(item.tags, self.tags):
+ curated_result = self.get_curated_webapp(self.resource_group, self.name, item)
+ result = [curated_result]
+
+ return result
+
+ def list_by_resource_group(self):
+ self.log('List web apps in resource groups {0}'.format(self.resource_group))
+ try:
+ response = list(self.web_client.web_apps.list_by_resource_group(self.resource_group))
+ except CloudError as exc:
+ request_id = exc.request_id if exc.request_id else ''
+ self.fail("Error listing web apps in resource groups {0}, request id: {1} - {2}".format(self.resource_group, request_id, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ curated_output = self.get_curated_webapp(self.resource_group, item.name, item)
+ results.append(curated_output)
+ return results
+
+ def list_all(self):
+ self.log('List web apps in current subscription')
+ try:
+ response = list(self.web_client.web_apps.list())
+ except CloudError as exc:
+ request_id = exc.request_id if exc.request_id else ''
+ self.fail("Error listing web apps, request id {0} - {1}".format(request_id, str(exc)))
+
+ results = []
+ for item in response:
+ if self.has_tags(item.tags, self.tags):
+ curated_output = self.get_curated_webapp(item.resource_group, item.name, item)
+ results.append(curated_output)
+ return results
+
+ def list_webapp_configuration(self, resource_group, name):
+ self.log('Get web app {0} configuration'.format(name))
+
+ response = []
+
+ try:
+ response = self.web_client.web_apps.get_configuration(resource_group_name=resource_group, name=name)
+ except CloudError as ex:
+ request_id = ex.request_id if ex.request_id else ''
+ self.fail('Error getting web app {0} configuration, request id {1} - {2}'.format(name, request_id, str(ex)))
+
+ return response.as_dict()
+
+ def list_webapp_appsettings(self, resource_group, name):
+ self.log('Get web app {0} app settings'.format(name))
+
+ response = []
+
+ try:
+ response = self.web_client.web_apps.list_application_settings(resource_group_name=resource_group, name=name)
+ except CloudError as ex:
+ request_id = ex.request_id if ex.request_id else ''
+ self.fail('Error getting web app {0} app settings, request id {1} - {2}'.format(name, request_id, str(ex)))
+
+ return response.as_dict()
+
+ def get_publish_credentials(self, resource_group, name):
+ self.log('Get web app {0} publish credentials'.format(name))
+ try:
+ poller = self.web_client.web_apps.list_publishing_credentials(resource_group, name)
+ if isinstance(poller, LROPoller):
+ response = self.get_poller_result(poller)
+ except CloudError as ex:
+ request_id = ex.request_id if ex.request_id else ''
+ self.fail('Error getting web app {0} publishing credentials - {1}'.format(request_id, str(ex)))
+ return response
+
+ def get_webapp_ftp_publish_url(self, resource_group, name):
+ import xmltodict
+
+ self.log('Get web app {0} app publish profile'.format(name))
+
+ url = None
+ try:
+ content = self.web_client.web_apps.list_publishing_profile_xml_with_secrets(resource_group_name=resource_group, name=name)
+ if not content:
+ return url
+
+ full_xml = ''
+ for f in content:
+ full_xml += f.decode()
+ profiles = xmltodict.parse(full_xml, xml_attribs=True)['publishData']['publishProfile']
+
+ if not profiles:
+ return url
+
+ for profile in profiles:
+ if profile['@publishMethod'] == 'FTP':
+ url = profile['@publishUrl']
+
+ except CloudError as ex:
+ self.fail('Error getting web app {0} app settings'.format(name))
+
+ return url
+
+ def get_curated_webapp(self, resource_group, name, webapp):
+ pip = self.serialize_obj(webapp, AZURE_OBJECT_CLASS)
+
+ try:
+ site_config = self.list_webapp_configuration(resource_group, name)
+ app_settings = self.list_webapp_appsettings(resource_group, name)
+ publish_cred = self.get_publish_credentials(resource_group, name)
+ ftp_publish_url = self.get_webapp_ftp_publish_url(resource_group, name)
+ except CloudError as ex:
+ pass
+ return self.construct_curated_webapp(webapp=pip,
+ configuration=site_config,
+ app_settings=app_settings,
+ deployment_slot=None,
+ ftp_publish_url=ftp_publish_url,
+ publish_credentials=publish_cred)
+
+ def construct_curated_webapp(self,
+ webapp,
+ configuration=None,
+ app_settings=None,
+ deployment_slot=None,
+ ftp_publish_url=None,
+ publish_credentials=None):
+ curated_output = dict()
+ curated_output['id'] = webapp['id']
+ curated_output['name'] = webapp['name']
+ curated_output['resource_group'] = webapp['properties']['resourceGroup']
+ curated_output['location'] = webapp['location']
+ curated_output['plan'] = webapp['properties']['serverFarmId']
+ curated_output['tags'] = webapp.get('tags', None)
+
+ # important properties from output. not match input arguments.
+ curated_output['app_state'] = webapp['properties']['state']
+ curated_output['availability_state'] = webapp['properties']['availabilityState']
+ curated_output['default_host_name'] = webapp['properties']['defaultHostName']
+ curated_output['host_names'] = webapp['properties']['hostNames']
+ curated_output['enabled'] = webapp['properties']['enabled']
+ curated_output['enabled_host_names'] = webapp['properties']['enabledHostNames']
+ curated_output['host_name_ssl_states'] = webapp['properties']['hostNameSslStates']
+ curated_output['outbound_ip_addresses'] = webapp['properties']['outboundIpAddresses']
+
+ # curated site_config
+ if configuration:
+ curated_output['frameworks'] = []
+ for fx_name in self.framework_names:
+ fx_version = configuration.get(fx_name + '_version', None)
+ if fx_version:
+ fx = {
+ 'name': fx_name,
+ 'version': fx_version
+ }
+ # java container setting
+ if fx_name == 'java':
+ if configuration['java_container'] and configuration['java_container_version']:
+ settings = {
+ 'java_container': configuration['java_container'].lower(),
+ 'java_container_version': configuration['java_container_version']
+ }
+ fx['settings'] = settings
+
+ curated_output['frameworks'].append(fx)
+
+ # linux_fx_version
+ if configuration.get('linux_fx_version', None):
+ tmp = configuration.get('linux_fx_version').split("|")
+ if len(tmp) == 2:
+ curated_output['frameworks'].append({'name': tmp[0].lower(), 'version': tmp[1]})
+
+ # curated app_settings
+ if app_settings and app_settings.get('properties', None):
+ curated_output['app_settings'] = dict()
+ for item in app_settings['properties']:
+ curated_output['app_settings'][item] = app_settings['properties'][item]
+
+ # curated deploymenet_slot
+ if deployment_slot:
+ curated_output['deployment_slot'] = deployment_slot
+
+ # ftp_publish_url
+ if ftp_publish_url:
+ curated_output['ftp_publish_url'] = ftp_publish_url
+
+ # curated publish credentials
+ if publish_credentials and self.return_publish_profile:
+ curated_output['publishing_username'] = publish_credentials.publishing_user_name
+ curated_output['publishing_password'] = publish_credentials.publishing_password
+ return curated_output
+
+
+def main():
+ AzureRMWebAppInfo()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/shippable.yml b/collections-debian-merged/ansible_collections/community/azure/shippable.yml
new file mode 100644
index 00000000..2f43c46a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/shippable.yml
@@ -0,0 +1,37 @@
+language: python
+
+env:
+ matrix:
+ - T=none
+
+matrix:
+ exclude:
+ - env: T=none
+ include:
+ - env: T=devel/sanity/1
+ - env: T=devel/sanity/extra
+# - env: T=2.10/sanity
+
+# - env: T=devel/azure/2.7/1
+# - env: T=devel/azure/3.6/1
+# - env: T=2.10/azure/2.7/1
+# - env: T=2.10/azure/3.6/1
+
+
+branches:
+ except:
+ - "*-patch-*"
+ - "revert-*-*"
+
+build:
+ ci:
+ - tests/utils/shippable/timing.sh tests/utils/shippable/shippable.sh $T
+
+integrations:
+ notifications:
+ - integrationName: email
+ type: email
+ on_success: never
+ on_failure: never
+ on_start: never
+ on_pull_request: never
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/.gitignore b/collections-debian-merged/ansible_collections/community/azure/tests/.gitignore
new file mode 100644
index 00000000..ea1472ec
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/.gitignore
@@ -0,0 +1 @@
+output/
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/aliases
new file mode 100644
index 00000000..7bf5a027
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/aliases
@@ -0,0 +1,4 @@
+cloud/azure
+shippable/azure/group1
+destructive
+azure_rm_automationaccount_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/tasks/main.yml
new file mode 100644
index 00000000..025bba9a
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_automationaccount/tasks/main.yml
@@ -0,0 +1,74 @@
+- name: Prepare random number
+ set_fact:
+ rpfx: '{{ resource_group | hash(''md5'') | truncate(7, True, '''') }}{{ 1000 | random }}'
+ name: account{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}
+ run_once: true
+- name: Create automation account
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_automationaccount:
+ name: '{{ name }}'
+ resource_group: '{{ resource_group }}'
+- assert:
+ that:
+ - output.changed
+- name: Create automation account
+ register: output
+ azure.azcollection.azure_rm_automationaccount:
+ name: '{{ name }}'
+ resource_group: '{{ resource_group }}'
+- assert:
+ that:
+ - output.changed
+ - output.id
+- name: Create automation account
+ register: output
+ azure.azcollection.azure_rm_automationaccount:
+ name: '{{ name }}'
+ resource_group: '{{ resource_group }}'
+- assert:
+ that:
+ - not output.changed
+- name: Get automation account
+ azure_rm_automationaccount_facts:
+ name: '{{ name }}'
+ resource_group: '{{ resource_group }}'
+ list_statistics: true
+ list_usages: true
+ list_keys: true
+ register: facts
+- assert:
+ that:
+ - facts.automation_accounts | length == 1
+ - facts.automation_accounts[0].keys
+ - facts.automation_accounts[0].usages
+ - facts.automation_accounts[0].statistics
+ - facts.automation_accounts[0].state == "Ok"
+- name: Delete account
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_automationaccount:
+ name: '{{ name }}'
+ resource_group: '{{ resource_group }}'
+ state: absent
+- assert:
+ that:
+ - output.changed
+- name: Delete account
+ register: output
+ azure.azcollection.azure_rm_automationaccount:
+ name: '{{ name }}'
+ resource_group: '{{ resource_group }}'
+ state: absent
+- assert:
+ that:
+ - output.changed
+- name: Delete account
+ register: output
+ azure.azcollection.azure_rm_automationaccount:
+ name: '{{ name }}'
+ resource_group: '{{ resource_group }}'
+ state: absent
+- assert:
+ that:
+ - not output.changed
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/aliases
new file mode 100644
index 00000000..d8e65689
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/aliases
@@ -0,0 +1,17 @@
+cloud/azure
+destructive
+shippable/azure/group1
+azure_rm_devtestlab_facts
+azure_rm_devtestlabarmtemplate
+azure_rm_devtestlabartifact
+azure_rm_devtestlabartifactsource_facts
+azure_rm_devtestlabartifactsource
+azure_rm_devtestlabcustomimage
+azure_rm_devtestlabpolicy
+azure_rm_devtestlabschedule
+azure_rm_devtestlabvirtualmachine_facts
+azure_rm_devtestlabvirtualmachine_facts
+azure_rm_devtestlabvirtualnetwork_facts
+azure_rm_devtestlabvirtualnetwork
+disabled
+
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/tasks/main.yml
new file mode 100644
index 00000000..45090966
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_devtestlab/tasks/main.yml
@@ -0,0 +1,714 @@
+- name: Prepare random number
+ set_fact:
+ lab_name: lab{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}
+ vn_name: vn{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}
+ vm_name: vn{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}
+ artifacts_name: myartifacts
+ github_token: '{{ lookup(''env'',''GITHUB_ACCESS_TOKEN'') }}'
+ run_once: true
+- name: Create instance of Lab -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_devtestlab:
+ resource_group: '{{ resource_group }}'
+ name: '{{ lab_name }}'
+ location: eastus
+ storage_type: standard
+ premium_data_disks: false
+- name: Check if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+- name: Create instance of Lab
+ register: output_lab
+ azure.azcollection.azure_rm_devtestlab:
+ resource_group: '{{ resource_group }}'
+ name: '{{ lab_name }}'
+ location: eastus
+ storage_type: standard
+ premium_data_disks: false
+- name: Check if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+- name: Create again instance of Lab
+ register: output
+ azure.azcollection.azure_rm_devtestlab:
+ resource_group: '{{ resource_group }}'
+ name: '{{ lab_name }}'
+ location: eastus
+ storage_type: standard
+ premium_data_disks: false
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+- name: Update lab - premium_data_disks
+ register: output
+ azure.azcollection.azure_rm_devtestlab:
+ resource_group: '{{ resource_group }}'
+ name: '{{ lab_name }}'
+ location: eastus
+ storage_type: standard
+ premium_data_disks: true
+- name: Assert the change was registered
+ assert:
+ that:
+ - output.changed
+- name: List DevTest Lab in a resource group
+ azure_rm_devtestlab_facts:
+ resource_group: '{{ resource_group }}'
+ register: output_lab
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output_lab.changed == False
+ - output_lab.labs[0]['id'] != None
+ - output_lab.labs[0]['resource_group'] != None
+ - output_lab.labs[0]['name'] != None
+ - output_lab.labs[0]['location'] != None
+ - output_lab.labs[0]['storage_type'] != None
+ - output_lab.labs[0]['premium_data_disks'] != None
+ - output_lab.labs[0]['provisioning_state'] != None
+ - output_lab.labs[0]['vault_name'] != None
+- name: Get DevTest Lab facts
+ azure_rm_devtestlab_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ lab_name }}'
+ register: output_lab
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output_lab.changed == False
+ - output_lab.labs[0]['id'] != None
+ - output_lab.labs[0]['resource_group'] != None
+ - output_lab.labs[0]['name'] != None
+ - output_lab.labs[0]['location'] != None
+ - output_lab.labs[0]['storage_type'] != None
+ - output_lab.labs[0]['premium_data_disks'] != None
+ - output_lab.labs[0]['provisioning_state'] != None
+ - output_lab.labs[0]['artifacts_storage_account'] != None
+ - output_lab.labs[0]['default_premium_storage_account'] != None
+ - output_lab.labs[0]['default_storage_account'] != None
+ - output_lab.labs[0]['premium_data_disk_storage_account'] != None
+ - output_lab.labs[0]['vault_name'] != None
+- name: Create instance of DevTest Lab Policy
+ register: output
+ azure.azcollection.azure_rm_devtestlabpolicy:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ policy_set_name: default
+ name: myDtlPolicy
+ fact_name: user_owned_lab_vm_count
+ threshold: 5
+- debug:
+ var: output
+- name: Assert if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+- name: Create instance of DevTest Lab Policy -- idempotent
+ register: output
+ azure.azcollection.azure_rm_devtestlabpolicy:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ policy_set_name: default
+ name: myDtlPolicy
+ fact_name: user_owned_lab_vm_count
+ threshold: 5
+- debug:
+ var: output
+- name: Assert if the change was not reported
+ assert:
+ that:
+ - not output.changed
+- name: Create instance of DevTest Lab Policy -- change value
+ register: output
+ azure.azcollection.azure_rm_devtestlabpolicy:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ policy_set_name: default
+ name: myDtlPolicy
+ fact_name: user_owned_lab_vm_count
+ threshold: 6
+- debug:
+ var: output
+- name: Assert if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of DevTest Lab Policy
+ register: output
+ azure.azcollection.azure_rm_devtestlabpolicy:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ policy_set_name: default
+ name: myDtlPolicy
+ state: absent
+- debug:
+ var: output
+- name: Assert if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+- name: Create instance of DevTest Lab Schedule
+ register: output
+ azure.azcollection.azure_rm_devtestlabschedule:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: lab_vms_shutdown
+ time: '1030'
+ time_zone_id: UTC+12
+- debug:
+ var: output
+- name: Assert if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+- name: Update instance of DevTest Lab Schedule -- idempotent
+ register: output
+ azure.azcollection.azure_rm_devtestlabschedule:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: lab_vms_shutdown
+ time: '1030'
+ time_zone_id: UTC+12
+- debug:
+ var: output
+- name: Assert if the change was correctly reported
+ assert:
+ that:
+ - not output.changed
+- name: Update instance of DevTest Lab Schedule -- change time
+ register: output
+ azure.azcollection.azure_rm_devtestlabschedule:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: lab_vms_shutdown
+ time: '1130'
+ time_zone_id: UTC+12
+- debug:
+ var: output
+- name: Assert if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of DevTest Lab Schedule
+ register: output
+ azure.azcollection.azure_rm_devtestlabschedule:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: lab_vms_shutdown
+ state: absent
+- debug:
+ var: output
+- name: Assert if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+- name: Create instance of DevTest Labs virtual network
+ register: output
+ azure.azcollection.azure_rm_devtestlabvirtualnetwork:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ vn_name }}'
+ location: eastus
+ description: My DevTest Lab
+- name: Assert the change was registered
+ assert:
+ that:
+ - output.changed
+- name: Update instance of DevTest Labs virtual network with same parameters
+ register: output
+ azure.azcollection.azure_rm_devtestlabvirtualnetwork:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ vn_name }}'
+ location: eastus
+ description: My DevTest Lab
+- name: Assert that nothing was changed
+ assert:
+ that:
+ - output.changed == false
+- name: Update instance of DevTest Labs virtual network with changed description
+ register: output
+ azure.azcollection.azure_rm_devtestlabvirtualnetwork:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ vn_name }}'
+ location: eastus
+ description: My DevTest Lab Updated
+- name: Assert that nothing was changed
+ assert:
+ that:
+ - output.changed
+- name: Get DevTest Lab Virtual Network facts
+ azure_rm_devtestlabvirtualnetwork_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ vn_name }}'
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.virtualnetworks[0]['id'] != None
+ - output.virtualnetworks[0]['resource_group'] != None
+ - output.virtualnetworks[0]['lab_name'] != None
+ - output.virtualnetworks[0]['name'] != None
+ - output.virtualnetworks[0]['external_provider_resource_id'] != None
+ - output.virtualnetworks[0]['description'] != None
+ - output.virtualnetworks[0]['provisioning_state'] != None
+- name: List all Virtual Networks in DevTest Lab
+ azure_rm_devtestlabvirtualnetwork_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.virtualnetworks[0]['id'] != None
+ - output.virtualnetworks[0]['resource_group'] != None
+ - output.virtualnetworks[0]['lab_name'] != None
+ - output.virtualnetworks[0]['name'] != None
+ - output.virtualnetworks[0]['external_provider_resource_id'] != None
+ - output.virtualnetworks[0]['description'] != None
+ - output.virtualnetworks[0]['provisioning_state'] != None
+- name: Create instance of DevTest Labs artifacts source
+ register: output
+ when: github_token | length > 0
+ azure.azcollection.azure_rm_devtestlabartifactsource:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ artifacts_name }}'
+ uri: https://github.com/Azure/azure_preview_modules.git
+ source_type: github
+ folder_path: /tasks
+ security_token: '{{ github_token }}'
+- name: Assert if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+ when: github_token | length > 0
+- name: Update instance of DevTest Labs artifacts source with same parameters
+ register: output
+ when: github_token | length > 0
+ azure.azcollection.azure_rm_devtestlabartifactsource:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ artifacts_name }}'
+ uri: https://github.com/Azure/azure_preview_modules.git
+ source_type: github
+ folder_path: /tasks
+ security_token: '{{ github_token }}'
+- name: Assert that nothing was changed
+ assert:
+ that:
+ - output.changed == false
+ when: github_token | length > 0
+- name: Update instance of DevTest Labs artifacts source, add display name, change folder
+ register: output
+ when: github_token | length > 0
+ azure.azcollection.azure_rm_devtestlabartifactsource:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ artifacts_name }}'
+ uri: https://github.com/Azure/azure_preview_modules.git
+ source_type: github
+ folder_path: /library
+ security_token: '{{ github_token }}'
+ display_name: My Artifacts Source
+- name: Assert that nothing was changed
+ assert:
+ that:
+ - output.changed
+ when: github_token | length > 0
+- name: null
+ set_fact:
+ artifact_source:
+ - source_name: public repo
+ source_path: /Artifacts/linux-install-mongodb
+ when: github_token | length > 0
+- name: null
+ set_fact:
+ artifact_source: null
+ when: github_token | length == 0
+- name: Create instance of DTL Virtual Machine
+ register: output
+ when: github_token | length > 0
+ azure.azcollection.azure_rm_devtestlabvirtualmachine:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ vm_name }}'
+ notes: Virtual machine notes, just something....
+ os_type: linux
+ vm_size: Standard_A2_v2
+ user_name: dtladmin
+ password: ZSasfovobocu$$21!
+ lab_subnet:
+ virtual_network_name: '{{ vn_name }}'
+ name: '{{ vn_name }}Subnet'
+ disallow_public_ip_address: false
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ os_type: Linux
+ version: latest
+ artifacts: '{{ artifact_source }}'
+ allow_claim: false
+ expiration_date: '2029-02-22T01:49:12.117974Z'
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+ when: github_token | length > 0
+- name: Update instance of DTL Virtual Machine with same parameters
+ register: output
+ when: github_token | length > 0
+ azure.azcollection.azure_rm_devtestlabvirtualmachine:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ vm_name }}'
+ notes: Virtual machine notes, just something....
+ os_type: linux
+ vm_size: Standard_A2_v2
+ user_name: dtladmin
+ password: ZSasfovobocu$$21!
+ lab_subnet:
+ virtual_network_name: '{{ vn_name }}'
+ name: '{{ vn_name }}Subnet'
+ disallow_public_ip_address: false
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ os_type: Linux
+ version: latest
+ artifacts: '{{ artifact_source }}'
+ allow_claim: false
+ expiration_date: '2029-02-22T01:49:12.117974Z'
+- name: Assert that nothing has changed
+ assert:
+ that:
+ - output.changed == false
+ when: github_token | length > 0
+- name: Update instance of DTL Virtual Machine - change notes
+ register: output
+ when: github_token | length > 0
+ azure.azcollection.azure_rm_devtestlabvirtualmachine:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ vm_name }}'
+ notes: Virtual machine notes, just something.... more text
+ os_type: linux
+ vm_size: Standard_A2_v2
+ user_name: dtladmin
+ password: ZSasfovobocu$$21!
+ lab_subnet:
+ virtual_network_name: '{{ vn_name }}'
+ name: '{{ vn_name }}Subnet'
+ disallow_public_ip_address: false
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ os_type: Linux
+ version: latest
+ artifacts: '{{ artifact_source }}'
+ allow_claim: false
+ expiration_date: '2029-02-22T01:49:12.117974Z'
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+ when: github_token | length > 0
+- name: Get Facts of DTL Virtual Machine
+ azure_rm_devtestlabvirtualmachine_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ vm_name }}'
+ register: output_vm
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output_vm.changed == False
+ - output_vm.virtualmachines[0]['id'] != None
+ - output_vm.virtualmachines[0]['resource_group'] != None
+ - output_vm.virtualmachines[0]['lab_name'] != None
+ - output_vm.virtualmachines[0]['name'] != None
+ - output_vm.virtualmachines[0]['compute_vm_id'] != None
+ - output_vm.virtualmachines[0]['compute_vm_resource_group'] != None
+ - output_vm.virtualmachines[0]['compute_vm_name'] != None
+ - output_vm.virtualmachines[0]['disallow_public_ip_address'] != None
+ - output_vm.virtualmachines[0]['expiration_date'] != None
+ - output_vm.virtualmachines[0]['fqdn'] != None
+ - output_vm.virtualmachines[0]['id'] != None
+ - output_vm.virtualmachines[0]['image'] != None
+ - output_vm.virtualmachines[0]['notes'] != None
+ - output_vm.virtualmachines[0]['os_type'] != None
+ - output_vm.virtualmachines[0]['provisioning_state'] != None
+ - output_vm.virtualmachines[0]['storage_type'] != None
+ - output_vm.virtualmachines[0]['user_name'] != None
+ - output_vm.virtualmachines[0]['vm_size'] != None
+ when: github_token | length > 0
+- name: List Facts of DTL Virtual Machine
+ azure_rm_devtestlabvirtualmachine_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ register: output_vm
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output_vm.changed == False
+ - output_vm.virtualmachines[0]['id'] != None
+ - output_vm.virtualmachines[0]['resource_group'] != None
+ - output_vm.virtualmachines[0]['lab_name'] != None
+ - output_vm.virtualmachines[0]['name'] != None
+ - output_vm.virtualmachines[0]['compute_vm_id'] != None
+ - output_vm.virtualmachines[0]['disallow_public_ip_address'] != None
+ - output_vm.virtualmachines[0]['expiration_date'] != None
+ - output_vm.virtualmachines[0]['fqdn'] != None
+ - output_vm.virtualmachines[0]['id'] != None
+ - output_vm.virtualmachines[0]['image'] != None
+ - output_vm.virtualmachines[0]['notes'] != None
+ - output_vm.virtualmachines[0]['os_type'] != None
+ - output_vm.virtualmachines[0]['provisioning_state'] != None
+ - output_vm.virtualmachines[0]['storage_type'] != None
+ - output_vm.virtualmachines[0]['user_name'] != None
+ - output_vm.virtualmachines[0]['vm_size'] != None
+ when: github_token | length > 0
+- name: List all artifact sources
+ azure_rm_devtestlabartifactsource_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.artifactsources[0]['id'] != None
+ - output.artifactsources[0]['resource_group'] != None
+ - output.artifactsources[0]['lab_name'] != None
+ - output.artifactsources[0]['name'] != None
+ - output.artifactsources[0]['display_name'] != None
+ - output.artifactsources[0]['source_type'] != None
+ - output.artifactsources[0]['is_enabled'] != None
+ - output.artifactsources[0]['uri'] != None
+ - output.artifactsources[0]['folder_path'] != None
+ - output.artifactsources[0]['provisioning_state'] != None
+ - output.artifactsources | length >= 2
+- name: Get artifacts source facts
+ azure_rm_devtestlabartifactsource_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: public repo
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.artifactsources[0]['id'] != None
+ - output.artifactsources[0]['resource_group'] != None
+ - output.artifactsources[0]['lab_name'] != None
+ - output.artifactsources[0]['name'] != None
+ - output.artifactsources[0]['display_name'] != None
+ - output.artifactsources[0]['source_type'] != None
+ - output.artifactsources[0]['is_enabled'] != None
+ - output.artifactsources[0]['uri'] != None
+ - output.artifactsources[0]['folder_path'] != None
+ - output.artifactsources[0]['provisioning_state'] != None
+- name: Delete instance of DevTest Labs artifacts source
+ register: output
+ when: github_token | length > 0
+ azure.azcollection.azure_rm_devtestlabartifactsource:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: '{{ artifacts_name }}'
+ state: absent
+- name: Assert that change was correctly registered
+ assert:
+ that:
+ - output.changed
+ when: github_token | length > 0
+- name: List ARM Template facts
+ azure_rm_devtestlabarmtemplate_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ artifact_source_name: public environment repo
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.armtemplates[0]['id'] != None
+ - output.armtemplates[0]['resource_group'] != None
+ - output.armtemplates[0]['lab_name'] != None
+ - output.armtemplates[0]['artifact_source_name'] != None
+ - output.armtemplates[0]['name'] != None
+ - output.armtemplates[0]['display_name'] != None
+ - output.armtemplates[0]['description'] != None
+ - output.armtemplates[0]['publisher'] != None
+ - output.armtemplates | length > 1
+- name: Get ARM Template facts
+ azure_rm_devtestlabarmtemplate_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ artifact_source_name: public environment repo
+ name: ServiceFabric-LabCluster
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.armtemplates[0]['id'] != None
+ - output.armtemplates[0]['resource_group'] != None
+ - output.armtemplates[0]['lab_name'] != None
+ - output.armtemplates[0]['artifact_source_name'] != None
+ - output.armtemplates[0]['name'] != None
+ - output.armtemplates[0]['display_name'] != None
+ - output.armtemplates[0]['description'] != None
+ - output.armtemplates[0]['publisher'] != None
+ - output.armtemplates | length == 1
+- name: Get Artifact facts
+ azure_rm_devtestlabartifact_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ artifact_source_name: public repo
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.artifacts[0]['id'] != None
+ - output.artifacts[0]['resource_group'] != None
+ - output.artifacts[0]['lab_name'] != None
+ - output.artifacts[0]['artifact_source_name'] != None
+ - output.artifacts[0]['name'] != None
+ - output.artifacts[0]['description'] != None
+ - output.artifacts[0]['file_path'] != None
+ - output.artifacts[0]['publisher'] != None
+ - output.artifacts[0]['target_os_type'] != None
+ - output.artifacts[0]['publisher'] != None
+ - output.artifacts | length > 1
+- name: Get Artifact facts
+ azure_rm_devtestlabartifact_facts:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ artifact_source_name: public repo
+ name: windows-webdeploy
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.artifacts[0]['id'] != None
+ - output.artifacts[0]['resource_group'] != None
+ - output.artifacts[0]['lab_name'] != None
+ - output.artifacts[0]['artifact_source_name'] != None
+ - output.artifacts[0]['name'] != None
+ - output.artifacts[0]['description'] != None
+ - output.artifacts[0]['file_path'] != None
+ - output.artifacts[0]['publisher'] != None
+ - output.artifacts[0]['target_os_type'] != None
+ - output.artifacts[0]['publisher'] != None
+ - output.artifacts | length == 1
+- name: Create instance of DevTest Lab Environment
+ register: output
+ azure.azcollection.azure_rm_devtestlabenvironment:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ user_name: '@me'
+ name: myEnvironment
+ location: eastus
+ deployment_template: '{{ output_lab.labs[0].id }}/artifactSources/public environment repo/armTemplates/WebApp'
+- name: Assert if the change was correctly reported
+ assert:
+ that:
+ - output.changed
+ when: github_token | length > 0
+- name: Create instance of DevTest Lab Environment - idempotent
+ register: output
+ azure.azcollection.azure_rm_devtestlabenvironment:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ user_name: '@me'
+ name: myEnvironment
+ location: eastus
+ deployment_template:
+ artifact_source_name: public environment repo
+ name: WebApp
+- name: Assert if the change was not detected
+ assert:
+ that:
+ - not output.changed
+ when: github_token | length > 0
+- name: Delete instance of DevTest Lab Environment
+ register: output
+ azure.azcollection.azure_rm_devtestlabenvironment:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ user_name: '@me'
+ name: myEnvironment
+ state: absent
+- name: Assert that change was detected
+ assert:
+ that:
+ - output.changed
+ when: github_token | length > 0
+- name: Create instance of DevTest Lab Image
+ register: output
+ azure.azcollection.azure_rm_devtestlabcustomimage:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: myImage
+ source_vm: '{{ output_vm.virtualmachines[0][''name''] }}'
+ linux_os_state: non_deprovisioned
+- name: Assert that change was detected
+ assert:
+ that:
+ - output.changed
+ when: github_token | length > 0
+- name: Create instance of DevTest Lab Image -- idempotent
+ register: output
+ azure.azcollection.azure_rm_devtestlabcustomimage:
+ resource_group: '{{ resource_group }}'
+ lab_name: '{{ lab_name }}'
+ name: myImage
+ source_vm: '{{ output_vm.virtualmachines[0][''name''] }}'
+ linux_os_state: non_deprovisioned
+- name: Assert that change was detected
+ assert:
+ that:
+ - not output.changed
+ when: github_token | length > 0
+- name: Delete instance of Lab -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_devtestlab:
+ resource_group: '{{ resource_group }}'
+ state: absent
+ name: '{{ lab_name }}'
+- name: Assert if the change was correctly reported in check mode
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of Lab
+ register: output
+ azure.azcollection.azure_rm_devtestlab:
+ resource_group: '{{ resource_group }}'
+ name: '{{ lab_name }}'
+ state: absent
+- name: Assert the change was correctly reported
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of Lab
+ register: output
+ azure.azcollection.azure_rm_devtestlab:
+ resource_group: '{{ resource_group }}'
+ name: '{{ lab_name }}unexisting'
+ state: absent
+- name: Assert thes state has not changed
+ assert:
+ that:
+ - output.changed == false
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/aliases
new file mode 100644
index 00000000..e0296d74
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/aliases
@@ -0,0 +1,8 @@
+cloud/azure
+destructive
+shippable/azure/group1
+azure_rm_mariadbserver_facts
+azure_rm_mariadbdatabase
+azure_rm_mariadbdatabase_facts
+azure_rm_mariadbfirewallrule
+azure_rm_mariadbfirewallrule_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/tasks/main.yml
new file mode 100644
index 00000000..a0f69078
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mariadbserver/tasks/main.yml
@@ -0,0 +1,581 @@
+- name: Prepare random number
+ set_fact:
+ rpfx: '{{ resource_group | hash(''md5'') | truncate(7, True, '''') }}{{ 1000 | random }}'
+ run_once: true
+- name: Create instance of MariaDB Server -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 10.2
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of MariaDB Server
+ register: output
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 10.2
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+ - output.state == 'Ready'
+- name: Create again instance of MariaDB Server
+ register: output
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 10.2
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+ - output.state == 'Ready'
+- name: Update instance of MariaDB Server, change storage size
+ register: output
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 128000
+ version: 10.2
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed
+ - output.state == 'Ready'
+- debug:
+ var: output
+- name: Gather facts MariaDB Server
+ azure_rm_mariadbserver_facts:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}
+ register: output
+- name: Assert that storage size is correct
+ assert:
+ that:
+ - output.servers[0]['storage_mb'] == 128000
+- name: Create second instance of MariaDB Server
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}second
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 10.2
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+ tags:
+ aaa: bbb
+- name: Create second instance of MariaDB Server
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}second
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 10.2
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+ tags:
+ ccc: ddd
+- name: Gather facts MariaDB Server
+ azure_rm_mariadbserver_facts:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}second
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.servers[0]['id'] != None
+ - output.servers[0]['name'] != None
+ - output.servers[0]['location'] != None
+ - output.servers[0]['sku']['name'] != None
+ - output.servers[0]['sku']['tier'] != None
+ - output.servers[0]['sku']['capacity'] != None
+ - output.servers[0]['version'] != None
+ - output.servers[0]['user_visible_state'] != None
+ - output.servers[0]['fully_qualified_domain_name'] != None
+ - output.servers[0]['tags']['aaa'] == 'bbb'
+ - output.servers[0]['tags']['ccc'] == 'ddd'
+- name: Gather facts MariaDB Server
+ azure_rm_mariadbserver_facts:
+ resource_group: '{{ resource_group }}'
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.servers[0]['id'] != None
+ - output.servers[0]['name'] != None
+ - output.servers[0]['location'] != None
+ - output.servers[0]['sku']['name'] != None
+ - output.servers[0]['sku']['tier'] != None
+ - output.servers[0]['sku']['capacity'] != None
+ - output.servers[0]['version'] != None
+ - output.servers[0]['user_visible_state'] != None
+ - output.servers[0]['fully_qualified_domain_name'] != None
+ - output.servers[1]['id'] != None
+ - output.servers[1]['name'] != None
+ - output.servers[1]['location'] != None
+ - output.servers[1]['sku']['name'] != None
+ - output.servers[1]['sku']['tier'] != None
+ - output.servers[1]['sku']['capacity'] != None
+ - output.servers[1]['version'] != None
+ - output.servers[1]['user_visible_state'] != None
+ - output.servers[1]['fully_qualified_domain_name'] != None
+- name: Create instance of MariaDB Database -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mariadbdatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of MariaDB Database
+ register: output
+ azure.azcollection.azure_rm_mariadbdatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase
+ collation: latin1_swedish_ci
+ charset: latin1
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+ - output.name == 'testdatabase'
+- name: Create again instance of MariaDB Database
+ register: output
+ azure.azcollection.azure_rm_mariadbdatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase
+ collation: latin1_swedish_ci
+ charset: latin1
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+ - output.name == 'testdatabase'
+- name: Try to update database without force_update
+ ignore_errors: true
+ register: output
+ azure.azcollection.azure_rm_mariadbdatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase
+ collation: latin1_czech_ci
+ charset: latin1
+- name: Assert that nothing has changed
+ assert:
+ that:
+ - output.changed == False
+- name: Update instance of database using force_update
+ register: output
+ azure.azcollection.azure_rm_mariadbdatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase
+ collation: latin1_czech_ci
+ charset: latin1
+ force_update: true
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+ - output.name == 'testdatabase'
+- name: Create second instance of MariaDB Database
+ azure.azcollection.azure_rm_mariadbdatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase2
+- name: Gather facts MariaDB Database
+ azure_rm_mariadbdatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.databases[0]['server_name'] != None
+ - output.databases[0]['name'] != None
+ - output.databases[0]['charset'] != None
+ - output.databases[0]['collation'] != None
+- name: Gather facts MariaDB Database
+ azure_rm_mariadbdatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.databases[0]['server_name'] != None
+ - output.databases[0]['name'] != None
+ - output.databases[0]['charset'] != None
+ - output.databases[0]['collation'] != None
+ - output.databases[1]['server_name'] != None
+ - output.databases[1]['name'] != None
+ - output.databases[1]['charset'] != None
+ - output.databases[1]['collation'] != None
+- name: Delete instance of MariaDB Database -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mariadbdatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of MariaDB Database
+ register: output
+ azure.azcollection.azure_rm_mariadbdatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of MariaDB Database
+ register: output
+ azure.azcollection.azure_rm_mariadbdatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: testdatabase
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Create instance of Firewall Rule -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mariadbfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_mariadbfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create again instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_mariadbfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+- name: Delete instance of Firewall Rule -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mariadbfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Create instance of Firewall Rule -- second
+ register: output
+ azure.azcollection.azure_rm_mariadbfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}second
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Gather facts MariaDB Firewall Rule
+ azure_rm_mariadbfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules[0].id != None
+ - output.rules[0].server_name != None
+ - output.rules[0].name != None
+ - output.rules[0].start_ip_address != None
+ - output.rules[0].end_ip_address != None
+ - output.rules | length == 1
+- name: Gather facts MariaDB Firewall Rule
+ azure_rm_mariadbfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules[0].id != None
+ - output.rules[0].server_name != None
+ - output.rules[0].name != None
+ - output.rules[0].start_ip_address != None
+ - output.rules[0].end_ip_address != None
+ - output.rules[1].id != None
+ - output.rules[1].name != None
+ - output.rules[1].start_ip_address != None
+ - output.rules[1].end_ip_address != None
+ - output.rules | length == 2
+- name: Delete instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_mariadbfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_mariadbfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Delete instance of Firewall Rule - second
+ azure.azcollection.azure_rm_mariadbfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}second
+ state: absent
+- name: Gather facts MariaDB Firewall Rule
+ azure_rm_mariadbfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ register: output
+- name: Assert that empty list was returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules | length == 0
+- name: Create instance of Configuration -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mariadbconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: event_scheduler
+ value: 'ON'
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+- name: Try to delete default configuraion
+ azure_rm_mariadbconfiguration_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: event_scheduler
+ register: output
+- name: Get facts of event_scheduler
+ debug:
+ var: output
+- name: Try to delete default configuraion
+ register: output
+ azure.azcollection.azure_rm_mariadbconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: event_scheduler
+ state: absent
+- name: Assert that change was registered
+ assert:
+ that:
+ - not output.changed
+- name: Try to change default configuraion
+ register: output
+ azure.azcollection.azure_rm_mariadbconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: event_scheduler
+ value: 'ON'
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+- name: Try to change default configuration -- idempotent
+ register: output
+ azure.azcollection.azure_rm_mariadbconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: event_scheduler
+ value: 'ON'
+- name: Assert that change was registered
+ assert:
+ that:
+ - not output.changed
+- name: Try to reset configuration
+ register: output
+ azure.azcollection.azure_rm_mariadbconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: event_scheduler
+ state: absent
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+- name: Try to reset configuration -- idempotent
+ register: output
+ azure.azcollection.azure_rm_mariadbconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: event_scheduler
+ state: absent
+- name: Assert that change was registered
+ assert:
+ that:
+ - not output.changed
+- name: Gather facts MariaDB Configuration
+ azure_rm_mariadbconfiguration_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ name: event_scheduler
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.settings[0].id != None
+ - output.settings[0].name != None
+ - output.settings[0].value != None
+ - output.settings[0].description != None
+ - output.settings[0].source != None
+ - output.settings | length == 1
+- name: Gather facts MariaDB Configuration
+ azure_rm_mariadbconfiguration_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mariadbsrv{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.settings[0].id != None
+ - output.settings[0].name != None
+ - output.settings[0].value != None
+ - output.settings[0].description != None
+ - output.settings[0].source != None
+ - output.settings | length > 1
+- name: Delete instance of MariaDB Server -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of MariaDB Server
+ register: output
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of MariaDB Server
+ register: output
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Delete second instance of MariaDB Server
+ async: 400
+ poll: 0
+ azure.azcollection.azure_rm_mariadbserver:
+ resource_group: '{{ resource_group }}'
+ name: mariadbsrv{{ rpfx }}second
+ state: absent
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/aliases
new file mode 100644
index 00000000..0eedad4b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/aliases
@@ -0,0 +1,10 @@
+cloud/azure
+destructive
+shippable/azure/group1
+azure_rm_mysqlserver_facts
+azure_rm_mysqldatabase
+azure_rm_mysqldatabase_facts
+azure_rm_mysqlfirewallrule
+azure_rm_mysqlfirewallrule_facts
+azure_rm_mysqlconfiguration
+azure_rm_mysqlconfiguration_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/tasks/main.yml
new file mode 100644
index 00000000..a31bef15
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_mysqlserver/tasks/main.yml
@@ -0,0 +1,581 @@
+- name: Prepare random number
+ set_fact:
+ rpfx: '{{ resource_group | hash(''md5'') | truncate(7, True, '''') }}{{ 1000 | random }}'
+ run_once: true
+- name: Create instance of MySQL Server -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 5.6
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of MySQL Server
+ register: output
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 5.6
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+ - output.state == 'Ready'
+- name: Create again instance of MySQL Server
+ register: output
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 5.6
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+ - output.state == 'Ready'
+- name: Update instance of MySQL Server, change storage size
+ register: output
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 128000
+ version: 5.6
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed
+ - output.state == 'Ready'
+- debug:
+ var: output
+- name: Gather facts MySQL Server
+ azure_rm_mysqlserver_facts:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}
+ register: output
+- name: Assert that storage size is correct
+ assert:
+ that:
+ - output.servers[0]['storage_mb'] == 128000
+- name: Create second instance of MySQL Server
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}second
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 5.6
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+ tags:
+ aaa: bbb
+- name: Create second instance of MySQL Server
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}second
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ version: 5.6
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+ tags:
+ ccc: ddd
+- name: Gather facts MySQL Server
+ azure_rm_mysqlserver_facts:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}second
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.servers[0]['id'] != None
+ - output.servers[0]['name'] != None
+ - output.servers[0]['location'] != None
+ - output.servers[0]['sku']['name'] != None
+ - output.servers[0]['sku']['tier'] != None
+ - output.servers[0]['sku']['capacity'] != None
+ - output.servers[0]['version'] != None
+ - output.servers[0]['user_visible_state'] != None
+ - output.servers[0]['fully_qualified_domain_name'] != None
+ - output.servers[0]['tags']['aaa'] == 'bbb'
+ - output.servers[0]['tags']['ccc'] == 'ddd'
+- name: Gather facts MySQL Server
+ azure_rm_mysqlserver_facts:
+ resource_group: '{{ resource_group }}'
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.servers[0]['id'] != None
+ - output.servers[0]['name'] != None
+ - output.servers[0]['location'] != None
+ - output.servers[0]['sku']['name'] != None
+ - output.servers[0]['sku']['tier'] != None
+ - output.servers[0]['sku']['capacity'] != None
+ - output.servers[0]['version'] != None
+ - output.servers[0]['user_visible_state'] != None
+ - output.servers[0]['fully_qualified_domain_name'] != None
+ - output.servers[1]['id'] != None
+ - output.servers[1]['name'] != None
+ - output.servers[1]['location'] != None
+ - output.servers[1]['sku']['name'] != None
+ - output.servers[1]['sku']['tier'] != None
+ - output.servers[1]['sku']['capacity'] != None
+ - output.servers[1]['version'] != None
+ - output.servers[1]['user_visible_state'] != None
+ - output.servers[1]['fully_qualified_domain_name'] != None
+- name: Create instance of MySQL Database -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mysqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of MySQL Database
+ register: output
+ azure.azcollection.azure_rm_mysqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase
+ collation: latin1_swedish_ci
+ charset: latin1
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+ - output.name == 'testdatabase'
+- name: Create again instance of MySQL Database
+ register: output
+ azure.azcollection.azure_rm_mysqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase
+ collation: latin1_swedish_ci
+ charset: latin1
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+ - output.name == 'testdatabase'
+- name: Try to update database without force_update
+ ignore_errors: true
+ register: output
+ azure.azcollection.azure_rm_mysqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase
+ collation: latin1_czech_ci
+ charset: latin1
+- name: Assert that nothing has changed
+ assert:
+ that:
+ - output.changed == False
+- name: Update instance of database using force_update
+ register: output
+ azure.azcollection.azure_rm_mysqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase
+ collation: latin1_czech_ci
+ charset: latin1
+ force_update: true
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+ - output.name == 'testdatabase'
+- name: Create second instance of MySQL Database
+ azure.azcollection.azure_rm_mysqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase2
+- name: Gather facts MySQL Database
+ azure_rm_mysqldatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.databases[0]['server_name'] != None
+ - output.databases[0]['name'] != None
+ - output.databases[0]['charset'] != None
+ - output.databases[0]['collation'] != None
+- name: Gather facts MySQL Database
+ azure_rm_mysqldatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.databases[0]['server_name'] != None
+ - output.databases[0]['name'] != None
+ - output.databases[0]['charset'] != None
+ - output.databases[0]['collation'] != None
+ - output.databases[1]['server_name'] != None
+ - output.databases[1]['name'] != None
+ - output.databases[1]['charset'] != None
+ - output.databases[1]['collation'] != None
+- name: Delete instance of MySQL Database -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mysqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of MySQL Database
+ register: output
+ azure.azcollection.azure_rm_mysqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of MySQL Database
+ register: output
+ azure.azcollection.azure_rm_mysqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: testdatabase
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Create instance of Firewall Rule -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mysqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_mysqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create again instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_mysqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+- name: Delete instance of Firewall Rule -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mysqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Create instance of Firewall Rule -- second
+ register: output
+ azure.azcollection.azure_rm_mysqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}second
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Gather facts MySQL Firewall Rule
+ azure_rm_mysqlfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules[0].id != None
+ - output.rules[0].server_name != None
+ - output.rules[0].name != None
+ - output.rules[0].start_ip_address != None
+ - output.rules[0].end_ip_address != None
+ - output.rules | length == 1
+- name: Gather facts MySQL Firewall Rule
+ azure_rm_mysqlfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules[0].id != None
+ - output.rules[0].server_name != None
+ - output.rules[0].name != None
+ - output.rules[0].start_ip_address != None
+ - output.rules[0].end_ip_address != None
+ - output.rules[1].id != None
+ - output.rules[1].name != None
+ - output.rules[1].start_ip_address != None
+ - output.rules[1].end_ip_address != None
+ - output.rules | length == 2
+- name: Delete instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_mysqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_mysqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Delete instance of Firewall Rule - second
+ azure.azcollection.azure_rm_mysqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}second
+ state: absent
+- name: Gather facts MySQL Firewall Rule
+ azure_rm_mysqlfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ register: output
+- name: Assert that empty list was returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules | length == 0
+- name: Create instance of Configuration -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mysqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: event_scheduler
+ value: 'ON'
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+- name: Try to delete default configuraion
+ azure_rm_mysqlconfiguration_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: event_scheduler
+ register: output
+- name: Get facts of event_scheduler
+ debug:
+ var: output
+- name: Try to delete default configuraion
+ register: output
+ azure.azcollection.azure_rm_mysqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: event_scheduler
+ state: absent
+- name: Assert that change was registered
+ assert:
+ that:
+ - not output.changed
+- name: Try to change default configuraion
+ register: output
+ azure.azcollection.azure_rm_mysqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: event_scheduler
+ value: 'ON'
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+- name: Try to change default configuration -- idempotent
+ register: output
+ azure.azcollection.azure_rm_mysqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: event_scheduler
+ value: 'ON'
+- name: Assert that change was registered
+ assert:
+ that:
+ - not output.changed
+- name: Try to reset configuration
+ register: output
+ azure.azcollection.azure_rm_mysqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: event_scheduler
+ state: absent
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+- name: Try to reset configuration -- idempotent
+ register: output
+ azure.azcollection.azure_rm_mysqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: event_scheduler
+ state: absent
+- name: Assert that change was registered
+ assert:
+ that:
+ - not output.changed
+- name: Gather facts MySQL Configuration
+ azure_rm_mysqlconfiguration_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ name: event_scheduler
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.settings[0].id != None
+ - output.settings[0].name != None
+ - output.settings[0].value != None
+ - output.settings[0].description != None
+ - output.settings[0].source != None
+ - output.settings | length == 1
+- name: Gather facts MySQL Configuration
+ azure_rm_mysqlconfiguration_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: mysqlsrv{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.settings[0].id != None
+ - output.settings[0].name != None
+ - output.settings[0].value != None
+ - output.settings[0].description != None
+ - output.settings[0].source != None
+ - output.settings | length > 1
+- name: Delete instance of MySQL Server -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of MySQL Server
+ register: output
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of MySQL Server
+ register: output
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Delete second instance of MySQL Server
+ async: 400
+ poll: 0
+ azure.azcollection.azure_rm_mysqlserver:
+ resource_group: '{{ resource_group }}'
+ name: mysqlsrv{{ rpfx }}second
+ state: absent
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/aliases
new file mode 100644
index 00000000..b5923cc0
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/aliases
@@ -0,0 +1,10 @@
+cloud/azure
+destructive
+shippable/azure/group1
+azure_rm_postgresqlserver_facts
+azure_rm_postgresqldatabase
+azure_rm_postgresqldatabase_facts
+azure_rm_postgresqlfirewallrule
+azure_rm_postgresqlfirewallrule_facts
+azure_rm_postgresqlserverconfiguration
+azure_rm_postgresqlserverconfiguration_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/tasks/main.yml
new file mode 100644
index 00000000..03a87f65
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_postgresqlserver/tasks/main.yml
@@ -0,0 +1,552 @@
+- name: Prepare random number
+ set_fact:
+ rpfx: '{{ resource_group | hash(''md5'') | truncate(7, True, '''') }}{{ 1000 | random }}'
+ run_once: true
+- name: Create instance of PostgreSQL Server -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of PostgreSQL Server
+ register: output
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+ - output.state == 'Ready'
+- name: Create again instance of PostgreSQL Server
+ register: output
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+ - output.state == 'Ready'
+- name: Update instance of PostgreSQL Server, change storage size
+ register: output
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 128000
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed
+ - output.state == 'Ready'
+- debug:
+ var: output
+- name: Gather facts postgresql Server
+ azure_rm_postgresqlserver_facts:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}
+ register: output
+- name: Assert that storage size is correct
+ assert:
+ that:
+ - output.servers[0]['storage_mb'] == 128000
+- name: Create second instance of PostgreSQL Server
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}second
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+ tags:
+ aaa: bbb
+- name: Create second instance of PostgreSQL Server -- add tags
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}second
+ sku:
+ name: B_Gen5_1
+ tier: Basic
+ location: westus2
+ storage_mb: 51200
+ enforce_ssl: true
+ admin_username: zimxyz
+ admin_password: Testpasswordxyz12!
+ tags:
+ ccc: ddd
+- name: Gather facts PostgreSQL Server
+ azure_rm_postgresqlserver_facts:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}second
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.servers[0]['id'] != None
+ - output.servers[0]['name'] != None
+ - output.servers[0]['location'] != None
+ - output.servers[0]['sku']['name'] != None
+ - output.servers[0]['sku']['tier'] != None
+ - output.servers[0]['sku']['capacity'] != None
+ - output.servers[0]['version'] != None
+ - output.servers[0]['user_visible_state'] != None
+ - output.servers[0]['fully_qualified_domain_name'] != None
+ - output.servers[0]['tags']['aaa'] == 'bbb'
+ - output.servers[0]['tags']['ccc'] == 'ddd'
+- name: Gather facts PostgreSQL Server
+ azure_rm_postgresqlserver_facts:
+ resource_group: '{{ resource_group }}'
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.servers[0]['id'] != None
+ - output.servers[0]['name'] != None
+ - output.servers[0]['location'] != None
+ - output.servers[0]['sku']['name'] != None
+ - output.servers[0]['sku']['tier'] != None
+ - output.servers[0]['sku']['capacity'] != None
+ - output.servers[0]['version'] != None
+ - output.servers[0]['user_visible_state'] != None
+ - output.servers[0]['fully_qualified_domain_name'] != None
+ - output.servers[1]['id'] != None
+ - output.servers[1]['name'] != None
+ - output.servers[1]['location'] != None
+ - output.servers[1]['sku']['name'] != None
+ - output.servers[1]['sku']['tier'] != None
+ - output.servers[1]['sku']['capacity'] != None
+ - output.servers[1]['version'] != None
+ - output.servers[1]['user_visible_state'] != None
+ - output.servers[1]['fully_qualified_domain_name'] != None
+- name: Create instance of PostgreSQL Database -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_postgresqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase
+ charset: UTF8
+ collation: English_United States.1252
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of PostgreSQL Database
+ register: output
+ azure.azcollection.azure_rm_postgresqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase
+ charset: UTF8
+ collation: English_United States.1252
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+ - output.name == 'testdatabase'
+- name: Create again instance of PostgreSQL Database
+ register: output
+ azure.azcollection.azure_rm_postgresqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase
+ charset: UTF8
+ collation: English_United States.1252
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+ - output.name == 'testdatabase'
+- name: Try to update PostgreSQL Database without force_update
+ ignore_errors: true
+ register: output
+ azure.azcollection.azure_rm_postgresqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase
+ charset: WIN1252
+ collation: SQL_Latin1_General_CP1_CS_AS
+- name: Assert that nothing has changed
+ assert:
+ that:
+ - output.changed == False
+- name: Try to update PostgreSQL Database with force_update
+ register: output
+ azure.azcollection.azure_rm_postgresqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase
+ charset: WIN1252
+ collation: SQL_Latin1_General_CP1_CS_AS
+ force_update: true
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+ - output.name == 'testdatabase'
+- name: Create second instance of PostgreSQL Database
+ azure.azcollection.azure_rm_postgresqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase2
+- name: Gather facts PostgreSQL Database
+ azure_rm_postgresqldatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.databases[0]['server_name'] != None
+ - output.databases[0]['name'] != None
+ - output.databases[0]['charset'] != None
+ - output.databases[0]['collation'] != None
+- name: Gather facts PostgreSQL Database
+ azure_rm_postgresqldatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.databases[0]['server_name'] != None
+ - output.databases[0]['name'] != None
+ - output.databases[0]['charset'] != None
+ - output.databases[0]['collation'] != None
+ - output.databases[1]['server_name'] != None
+ - output.databases[1]['name'] != None
+ - output.databases[1]['charset'] != None
+ - output.databases[1]['collation'] != None
+- name: Delete instance of PostgreSQL Database -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_postgresqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of PostgreSQL Database
+ register: output
+ azure.azcollection.azure_rm_postgresqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of PostgreSQL Database
+ register: output
+ azure.azcollection.azure_rm_postgresqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: testdatabase
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Create instance of Firewall Rule -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_postgresqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_postgresqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create again instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_postgresqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+- name: Create Firewall Rule - second
+ azure.azcollection.azure_rm_postgresqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}second
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Gather facts PostgreSQL Firewall Rule
+ azure_rm_postgresqlfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules[0].id != None
+ - output.rules[0].server_name != None
+ - output.rules[0].name != None
+ - output.rules[0].start_ip_address != None
+ - output.rules[0].end_ip_address != None
+ - output.rules | length == 1
+- name: Gather facts PostgreSQL Firewall Rule
+ azure_rm_postgresqlfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules[0].id != None
+ - output.rules[0].server_name != None
+ - output.rules[0].name != None
+ - output.rules[0].start_ip_address != None
+ - output.rules[0].end_ip_address != None
+ - output.rules[1].id != None
+ - output.rules[1].name != None
+ - output.rules[1].start_ip_address != None
+ - output.rules[1].end_ip_address != None
+ - output.rules | length == 2
+- name: Delete instance of Firewall Rule -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_postgresqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_postgresqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_postgresqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Delete instance of Firewall Rule - second
+ azure.azcollection.azure_rm_postgresqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}second
+ state: absent
+- name: Gather facts PostgreSQL Firewall Rule
+ azure_rm_postgresqlfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: firewallrule{{ rpfx }}
+ register: output
+- name: Assert that empty list was returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules | length == 0
+- name: Create instance of Configuration -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_postgresqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: deadlock_timeout
+ value: 2000
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+- name: Try to change default configuration
+ register: output
+ azure.azcollection.azure_rm_postgresqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: deadlock_timeout
+ value: 2000
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+- name: Try to change default configuration -- idempotent
+ register: output
+ azure.azcollection.azure_rm_postgresqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: deadlock_timeout
+ value: 2000
+- name: Assert that change was not registered
+ assert:
+ that:
+ - not output.changed
+- name: Try to reset configuration
+ register: output
+ azure.azcollection.azure_rm_postgresqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: deadlock_timeout
+ state: absent
+- name: Assert that change was registered
+ assert:
+ that:
+ - output.changed
+- name: Try to reset configuration -- idempotent
+ register: output
+ azure.azcollection.azure_rm_postgresqlconfiguration:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: deadlock_timeout
+ state: absent
+- name: Assert that change was registered
+ assert:
+ that:
+ - not output.changed
+- name: Gather facts PostgreSQL Configuration
+ azure_rm_postgresqlconfiguration_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ name: deadlock_timeout
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.settings[0].id != None
+ - output.settings[0].name != None
+ - output.settings[0].value != None
+ - output.settings[0].description != None
+ - output.settings[0].source != None
+ - output.settings | length == 1
+- name: Gather facts PostgreSQL Configuration
+ azure_rm_postgresqlconfiguration_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: postgresqlsrv{{ rpfx }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.settings[0].id != None
+ - output.settings[0].name != None
+ - output.settings[0].value != None
+ - output.settings[0].description != None
+ - output.settings[0].source != None
+ - output.settings | length > 1
+- name: Delete instance of PostgreSQL Server -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of PostgreSQL Server
+ register: output
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of PostgreSQL Server
+ register: output
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Delete second instance of PostgreSQL Server
+ async: 400
+ poll: 0
+ azure.azcollection.azure_rm_postgresqlserver:
+ resource_group: '{{ resource_group }}'
+ name: postgresqlsrv{{ rpfx }}second
+ state: absent
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/aliases
new file mode 100644
index 00000000..eed0eb55
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/aliases
@@ -0,0 +1,4 @@
+cloud/azure
+shippable/azure/group1
+destructive
+azure_rm_publicipaddress_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/tasks/main.yml
new file mode 100644
index 00000000..6d9ef050
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_publicipaddress/tasks/main.yml
@@ -0,0 +1,95 @@
+- name: Create domain name
+ set_fact:
+ domain_name: ansible-{{ resource_group | hash('md5') | truncate(24, True, '') }}
+ rpfx: '{{ resource_group | hash(''md5'') | truncate(7, True, '''') }}{{ 1000 | random }}'
+- name: Remove public ip
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ name: pip{{ rpfx }}
+ state: absent
+- name: Create public ip
+ register: output
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ name: pip{{ rpfx }}
+ allocation_method: Static
+ domain_name: '{{ domain_name }}'
+ tags:
+ testing: testing
+ delete: on-exit
+- assert:
+ that:
+ - output.state.public_ip_allocation_method == 'static'
+ - output.state.dns_settings.domain_name_label == domain_name
+ - output.state.tags | length == 2
+ - output.state.tags.testing == 'testing'
+- name: Should be idempotent
+ register: output
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ name: pip{{ rpfx }}
+ allocation_method: static
+ domain_name: '{{ domain_name }}'
+- assert:
+ that: not output.changed
+- name: Update tags
+ register: output
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ name: pip{{ rpfx }}
+ allocation_method: static
+ domain_name: '{{ domain_name }}'
+ append_tags: true
+ tags:
+ delete: never
+ foo: bar
+- assert:
+ that:
+ - output.state.tags | length == 3
+ - output.state.tags.delete == 'never'
+- name: Gather facts, filtering by tag
+ azure_rm_publicipaddress_facts:
+ resource_group: '{{ resource_group }}'
+ tags:
+ - testing
+ - foo:bar
+- assert:
+ that: azure_publicipaddresses | length == 1
+- name: Purge all tags
+ register: output
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ name: pip{{ rpfx }}
+ allocation_method: static
+ domain_name: '{{ domain_name }}'
+ append_tags: false
+- assert:
+ that:
+ - output.state.tags | length == 0
+- name: Gather facts for a public ip
+ azure_rm_publicipaddress_facts:
+ resource_group: '{{ resource_group }}'
+ name: pip{{ rpfx }}
+ register: pip
+- assert:
+ that:
+ - pip.publicipaddresses | length == 1
+ - pip.publicipaddresses[0].name == "pip{{ rpfx }}"
+ - pip.publicipaddresses[0].allocation_method == 'static'
+ - pip.publicipaddresses[0].dns_settings.domain_name_label == domain_name
+- name: Gather facts for all public ips
+ azure_rm_publicipaddress_facts:
+ resource_group: '{{ resource_group }}'
+- assert:
+ that: azure_publicipaddresses | length > 0
+- name: Remove public ip
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ name: pip{{ rpfx }}
+ state: absent
+- name: Gather facts for a public ip
+ azure_rm_publicipaddress_facts:
+ resource_group: '{{ resource_group }}'
+ name: pip{{ rpfx }}
+- assert:
+ that: azure_publicipaddresses | length == 0
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/aliases
new file mode 100644
index 00000000..0e4abdd8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/aliases
@@ -0,0 +1,5 @@
+cloud/azure
+shippable/azure/group1
+destructive
+azure_rm_rediscache_facts
+azure_rm_rediscachefirewallrule
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/tasks/main.yml
new file mode 100644
index 00000000..ba5e62e8
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_rediscache/tasks/main.yml
@@ -0,0 +1,269 @@
+- name: Fix resource prefix
+ set_fact:
+ redis_name: redis-{{ resource_group | hash('md5') | truncate(7, True, '') }}-{{ 1000 | random }}
+ vnet_name: vnet-{{ resource_group | hash('md5') | truncate(7, True, '') }}-{{ 1000 | random }}
+ subnet_name: subnet-{{ resource_group | hash('md5') | truncate(7, True, '') }}-{{ 1000 | random }}
+ rule_name: rule1
+ run_once: true
+- name: Create a redis cache (Check Mode)
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ sku:
+ name: basic
+ size: C1
+ wait_for_provisioning: false
+- name: Assert creating redis cache check mode
+ assert:
+ that:
+ - output.changed
+- name: Create a redis cache
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ sku:
+ name: basic
+ size: C1
+ wait_for_provisioning: false
+- name: Assert creating redis cache
+ assert:
+ that:
+ - output.changed
+ - output.id
+- name: Get facts
+ azure_rm_rediscache_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ register: facts
+- name: Assert facts
+ assert:
+ that:
+ - facts.rediscaches | length == 1
+ - facts.rediscaches[0].id != None
+ - facts.rediscaches[0].host_name != None
+ - facts.rediscaches[0].provisioning_state != None
+ - facts.rediscaches[0].sku.name == 'basic'
+ - facts.rediscaches[0].sku.size == 'C1'
+- name: Update the redis cache (idempotent)
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ sku:
+ name: basic
+ size: C1
+ wait_for_provisioning: false
+- name: assert output not changed
+ assert:
+ that:
+ - not output.changed
+- name: long-running rediscache tests [run with `--tags long_run,untagged` to enable]
+ block:
+ - name: Wait for Redis provisioning to complete
+ azure_rm_rediscache_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ register: facts
+ until: facts.rediscaches[0]['provisioning_state'] == 'Succeeded'
+ retries: 30
+ delay: 60
+ - name: (actually) update redis cache
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ sku:
+ name: basic
+ size: C1
+ enable_non_ssl_port: true
+ tags:
+ testing: foo
+ wait_for_provisioning: true
+ - name: assert output changed
+ assert:
+ that:
+ - output.changed
+ - name: Update redis cache configuration
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ sku:
+ name: basic
+ size: C1
+ enable_non_ssl_port: true
+ maxmemory_policy: allkeys_lru
+ tags:
+ testing: foo
+ - name: assert output changed
+ assert:
+ that:
+ - output.changed
+ - name: Scale up the redis cache
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ sku:
+ name: standard
+ size: C1
+ tags:
+ testing: foo
+ wait_for_provisioning: true
+ - assert:
+ that:
+ - output.changed
+ - name: Force reboot redis cache
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ reboot:
+ reboot_type: all
+ - assert:
+ that:
+ - output.changed
+ - name: Delete the redis cache (Check Mode)
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ state: absent
+ - name: assert deleting redis cache check mode
+ assert:
+ that: output.changed
+ - name: Delete the redis cache
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}'
+ state: absent
+ - assert:
+ that:
+ - output.changed
+ tags:
+ - long_run
+ - never
+- name: Create virtual network
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vnet_name }}'
+ address_prefixes: 10.10.0.0/16
+- name: Add subnet
+ azure.azcollection.azure_rm_subnet:
+ resource_group: '{{ resource_group }}'
+ name: '{{ subnet_name }}'
+ address_prefix: 10.10.0.0/24
+ virtual_network: '{{ vnet_name }}'
+- name: Create redis with subnet
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}2'
+ sku:
+ name: premium
+ size: P1
+ subnet:
+ name: '{{ subnet_name }}'
+ virtual_network_name: '{{ vnet_name }}'
+ wait_for_provisioning: false
+- name: Assert creating redis cache
+ assert:
+ that:
+ - output.changed
+ - output.id
+- name: Get facts
+ azure_rm_rediscache_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}2'
+ return_access_keys: true
+ register: facts
+- name: Assert facts
+ assert:
+ that:
+ - facts.rediscaches | length == 1
+ - facts.rediscaches[0].subnet != None
+ - facts.rediscaches[0].access_keys.primary != None
+- name: Create firewall rule (Check mode)
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_rediscachefirewallrule:
+ resource_group: '{{ resource_group }}'
+ cache_name: '{{ redis_name }}2'
+ name: '{{ rule_name }}'
+ start_ip_address: 192.168.1.1
+ end_ip_address: 192.168.1.4
+- name: Assert check mode creation
+ assert:
+ that:
+ - output.changed
+- name: long-running rediscachefirewallrule tests [run with `--tags long_run,untagged` to enable]
+ block:
+ - name: Wait for Redis provisioning to complete
+ azure_rm_rediscache_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}2'
+ register: facts
+ until: facts.rediscaches[0]['provisioning_state'] == 'Succeeded'
+ retries: 30
+ delay: 60
+ - name: Create firewall rule
+ register: output
+ azure.azcollection.azure_rm_rediscachefirewallrule:
+ resource_group: '{{ resource_group }}'
+ cache_name: '{{ redis_name }}2'
+ name: '{{ rule_name }}'
+ start_ip_address: 192.168.1.1
+ end_ip_address: 192.168.1.4
+ - name: Assert creation
+ assert:
+ that:
+ - output.changed
+ - output.id
+ - name: Update firewall rule idempotence
+ register: output
+ azure.azcollection.azure_rm_rediscachefirewallrule:
+ resource_group: '{{ resource_group }}'
+ cache_name: '{{ redis_name }}2'
+ name: '{{ rule_name }}'
+ start_ip_address: 192.168.1.1
+ end_ip_address: 192.168.1.4
+ - name: Assert idempotence
+ assert:
+ that:
+ - output.changed == False
+ - name: Update firewall rule
+ register: output
+ azure.azcollection.azure_rm_rediscachefirewallrule:
+ resource_group: '{{ resource_group }}'
+ cache_name: '{{ redis_name }}2'
+ name: '{{ rule_name }}'
+ end_ip_address: 192.168.1.5
+ - name: Assert updating
+ assert:
+ that:
+ - output.changed
+ - name: Delete firewall rule
+ register: output
+ azure.azcollection.azure_rm_rediscachefirewallrule:
+ resource_group: '{{ resource_group }}'
+ cache_name: '{{ redis_name }}2'
+ name: '{{ rule_name }}'
+ state: absent
+ - name: Assert deletion
+ assert:
+ that:
+ - output.changed
+ - name: Delete the redis cache
+ register: output
+ azure.azcollection.azure_rm_rediscache:
+ resource_group: '{{ resource_group }}'
+ name: '{{ redis_name }}2'
+ state: absent
+ tags:
+ - long_run
+ - never
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/aliases
new file mode 100644
index 00000000..69848e3b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/aliases
@@ -0,0 +1,4 @@
+cloud/azure
+shippable/azure/group1
+destructive
+azure_rm_securitygroup1
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/tasks/main.yml
new file mode 100644
index 00000000..d44c0286
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_securitygroup/tasks/main.yml
@@ -0,0 +1,269 @@
+- name: Prepare random number
+ set_fact:
+ secgroupname: sg{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}
+ asg_name1: asg1{{ resource_group | hash('md5') | truncate(7, True, '') }}
+ asg_name2: asg2{{ resource_group | hash('md5') | truncate(7, True, '') }}
+ sg_name1: sgasg{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}
+ run_once: true
+- name: Create security group
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ secgroupname }}'
+ tags:
+ testing: testing
+ delete: on-exit
+ foo: bar
+ purge_rules: true
+ rules:
+ - name: DenySSH
+ protocol: Tcp
+ destination_port_range: 22
+ access: Deny
+ priority: 100
+ direction: Inbound
+ - name: AllowSSH
+ protocol: Tcp
+ source_address_prefix: 174.109.158.0/24
+ destination_port_range: 22
+ access: Allow
+ priority: 101
+ direction: Inbound
+- assert:
+ that: '{{ output.state.rules | length }} == 2'
+- name: Gather facts by tags
+ register: output
+ azure.azcollection.azure_rm_securitygroup_info:
+ resource_group: '{{ resource_group }}'
+ tags:
+ - testing
+ - foo:bar
+- assert:
+ that: output.securitygroups | length == 1
+- name: Add/Update rules on existing security group
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ secgroupname }}'
+ rules:
+ - name: AllowSSH
+ protocol: Tcp
+ source_address_prefix: 174.108.158.0/24
+ destination_port_range: 22
+ access: Allow
+ priority: 101
+ - name: AllowSSHFromHome
+ protocol: Tcp
+ source_address_prefix: 174.109.158.0/24
+ destination_port_range: 22-23
+ priority: 102
+- assert:
+ that:
+ - '{{ output.state.rules | length }} == 3'
+ - output.state.rules[0].source_address_prefix == '174.108.158.0/24'
+- name: Test idempotence
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ secgroupname }}'
+ rules:
+ - name: AllowSSH
+ protocol: Tcp
+ source_address_prefix: 174.108.158.0/24
+ destination_port_range: 22
+ access: Allow
+ priority: 101
+ - name: AllowSSHFromHome
+ protocol: Tcp
+ source_address_prefix: 174.109.158.0/24
+ destination_port_range: 22-23
+ priority: 102
+- assert:
+ that: not output.changed
+- name: Update tags
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ secgroupname }}'
+ tags:
+ testing: testing
+ delete: never
+ baz: bar
+ append_tags: false
+- assert:
+ that:
+ - output.state.tags | length == 3
+ - output.state.tags.delete == 'never'
+- name: Purge tags
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ secgroupname }}'
+ append_tags: false
+ tags:
+ testing: testing
+ delete: on-exit
+- assert:
+ that:
+ - output.state.tags | length == 2
+ - output.state.tags.delete == 'on-exit'
+- name: Gather facts for one accounts
+ register: output
+ azure.azcollection.azure_rm_securitygroup_info:
+ resource_group: '{{ resource_group }}'
+ name: '{{ secgroupname }}'
+- assert:
+ that:
+ - output.securitygroups | length == 1
+- name: Gather facts for all accounts
+ register: output_groups
+ azure.azcollection.azure_rm_securitygroup_info:
+ resource_group: '{{ resource_group }}'
+- assert:
+ that:
+ - output_groups.securitygroups | length > 0
+- name: Create security group with source_address_prefixes
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ secgroupname }}'
+ tags:
+ testing: testing
+ delete: on-exit
+ foo: bar
+ purge_rules: true
+ rules:
+ - name: AllowSSH
+ protocol: Tcp
+ source_address_prefix:
+ - 52.100.120.240
+ - 53.100.250.190
+ - 54.110.200.200
+ destination_port_range: 22
+ access: Allow
+ priority: 101
+ direction: Inbound
+- assert:
+ that:
+ - '{{ output.state.rules | length }} == 1'
+ - '{{ output.state.rules[0].source_address_prefixes | length }} == 3'
+ - not output.state.rules[0].source_address_prefix
+- name: Create security group with source_address_prefixes(idempontent)
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ secgroupname }}'
+ tags:
+ testing: testing
+ delete: on-exit
+ foo: bar
+ purge_rules: true
+ rules:
+ - name: AllowSSH
+ protocol: Tcp
+ source_address_prefix:
+ - 52.100.120.240
+ - 53.100.250.190
+ - 54.110.200.200
+ destination_port_range: 22
+ access: Allow
+ priority: 101
+ direction: Inbound
+- assert:
+ that: not output.changed
+- name: Add a single one group
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ secgroupname }}'
+ tags:
+ testing: testing
+ delete: on-exit
+ foo: bar
+ rules:
+ - name: DenySSH
+ protocol: Tcp
+ source_address_prefix:
+ - 54.120.120.240
+ destination_port_range: 22
+ access: Deny
+ priority: 102
+ direction: Inbound
+- assert:
+ that:
+ - output.changed
+ - '{{ output.state.rules | length }} == 2'
+- name: Create Application security group 1
+ register: asg1
+ azure.azcollection.azure_rm_applicationsecuritygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ asg_name1 }}'
+ tags:
+ testing: testing
+- name: Create Application security group 2
+ register: asg2
+ azure.azcollection.azure_rm_applicationsecuritygroup:
+ resource_group: '{{ resource_group_secondary }}'
+ name: '{{ asg_name2 }}'
+ tags:
+ testing: testing
+- name: Create security group with application security group
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ sg_name1 }}'
+ purge_rules: true
+ rules:
+ - name: AsgToAsg
+ protocol: Tcp
+ source_application_security_groups:
+ - '{{ asg1.id }}'
+ destination_application_security_groups:
+ - resource_group: '{{ resource_group_secondary }}'
+ name: '{{ asg_name2 }}'
+ destination_port_range: 22
+ access: Allow
+ priority: 101
+ direction: Inbound
+- assert:
+ that:
+ - output.changed
+- name: Create security group with application security group - Idempotent
+ register: output
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ sg_name1 }}'
+ purge_rules: true
+ rules:
+ - name: AsgToAsg
+ protocol: Tcp
+ source_application_security_groups:
+ - '{{ asg_name1 }}'
+ destination_application_security_groups:
+ - resource_group: '{{ resource_group_secondary }}'
+ name: '{{ asg_name2 }}'
+ destination_port_range: 22
+ access: Allow
+ priority: 101
+ direction: Inbound
+- assert:
+ that:
+ - not output.changed
+- name: Delete security group
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ sg_name1 }}'
+ state: absent
+- name: Delete all security groups
+ with_items: '{{ output_groups.securitygroups }}'
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ item.name }}'
+ state: absent
+- name: Should have no security groups remaining
+ register: output
+ azure.azcollection.azure_rm_securitygroup_info:
+ resource_group: '{{ resource_group }}'
+- assert:
+ that:
+ - output.securitygroups | length == 0
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/aliases
new file mode 100644
index 00000000..74b30b7f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/aliases
@@ -0,0 +1,8 @@
+cloud/azure
+destructive
+shippable/azure/group1
+azure_rm_sqlserver_facts
+azure_rm_sqldatabase
+azure_rm_sqldatabase_facts
+azure_rm_sqlfirewallrule
+azure_rm_sqlfirewallrule_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/tasks/main.yml
new file mode 100644
index 00000000..c0c3c309
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_sqlserver/tasks/main.yml
@@ -0,0 +1,375 @@
+- name: Prepare random number
+ set_fact:
+ random_postfix: '{{ 1000 | random }}{{ resource_group | hash(''md5'') | truncate(7, True, '''') }}'
+ run_once: true
+- name: Create instance of SQL Server -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_sqlserver:
+ resource_group: '{{ resource_group }}'
+ name: sqlsrv{{ random_postfix }}
+ location: eastus
+ admin_username: mylogin
+ admin_password: Testpasswordxyz12!
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of SQL Server
+ register: output
+ azure.azcollection.azure_rm_sqlserver:
+ resource_group: '{{ resource_group }}'
+ name: sqlsrv{{ random_postfix }}
+ location: eastus
+ admin_username: mylogin
+ admin_password: Testpasswordxyz12!
+ tags:
+ aaa: bbb
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+ - output.state == 'Ready'
+- name: Create again instance of SQL Server
+ register: output
+ azure.azcollection.azure_rm_sqlserver:
+ resource_group: '{{ resource_group }}'
+ name: sqlsrv{{ random_postfix }}
+ location: eastus
+ admin_username: mylogin
+ admin_password: Testpasswordxyz12!
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+ - output.state == 'Ready'
+- name: Gather facts SQL Server
+ azure_rm_sqlserver_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.servers.sqlsrv{{ random_postfix }}.id != None
+ - output.servers.sqlsrv{{ random_postfix }}.name == "sqlsrv{{ random_postfix }}"
+ - output.servers.sqlsrv{{ random_postfix }}.type != None
+ - output.servers.sqlsrv{{ random_postfix }}.location != None
+ - output.servers.sqlsrv{{ random_postfix }}.kind != None
+ - output.servers.sqlsrv{{ random_postfix }}.version != None
+ - output.servers.sqlsrv{{ random_postfix }}.state != None
+ - output.servers.sqlsrv{{ random_postfix }}.fully_qualified_domain_name != None
+ - output.servers.sqlsrv{{ random_postfix }}.tags.aaa == 'bbb'
+- name: Gather facts SQL Server - unexisting
+ azure_rm_sqlserver_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: unexisting
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.servers == {}
+- name: Gather facts SQL Server - list
+ azure_rm_sqlserver_facts:
+ resource_group: '{{ resource_group }}'
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.servers.sqlsrv{{ random_postfix }}.id != None
+ - output.servers.sqlsrv{{ random_postfix }}.name == "sqlsrv{{ random_postfix }}"
+ - output.servers.sqlsrv{{ random_postfix }}.type != None
+ - output.servers.sqlsrv{{ random_postfix }}.location != None
+ - output.servers.sqlsrv{{ random_postfix }}.kind != None
+ - output.servers.sqlsrv{{ random_postfix }}.version != None
+ - output.servers.sqlsrv{{ random_postfix }}.state != None
+ - output.servers.sqlsrv{{ random_postfix }}.fully_qualified_domain_name != None
+- name: Create instance of SQL Database -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_sqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}
+ location: eastus
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of SQL Database
+ register: output
+ azure.azcollection.azure_rm_sqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}
+ location: eastus
+ tags:
+ aaa: bbb
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+ - output.status == 'Online'
+- name: Create again instance of SQL Database
+ register: output
+ azure.azcollection.azure_rm_sqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}
+ location: eastus
+ tags:
+ aaa: bbb
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+ - output.status == 'Online'
+- name: Create second SQL Database
+ azure.azcollection.azure_rm_sqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}second
+ location: eastus
+- name: Gather facts SQL Database
+ azure_rm_sqldatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.databases[0].id != None
+ - output.databases[0].name != None
+ - output.databases[0].location != None
+ - output.databases[0].sku.name != None
+ - output.databases[0].sku.tier != None
+ - output.databases[0].sku.capacity != None
+ - output.databases[0].kind != None
+ - output.databases[0].status != None
+- name: Gather facts SQL Database
+ azure_rm_sqldatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.databases[0].id != None
+ - output.databases[0].name != None
+ - output.databases[0].location != None
+ - output.databases[0].sku.name != None
+ - output.databases[0].sku.tier != None
+ - output.databases[0].sku.capacity != None
+ - output.databases[0].kind != None
+ - output.databases[0].status != None
+ - output.databases[1].id != None
+ - output.databases[1].name != None
+ - output.databases[1].location != None
+ - output.databases[1].sku.name != None
+ - output.databases[1].sku.tier != None
+ - output.databases[1].sku.capacity != None
+ - output.databases[1].kind != None
+ - output.databases[1].status != None
+- name: Delete instance of secondary database
+ azure.azcollection.azure_rm_sqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}second
+ state: absent
+- name: Delete instance of SQL Database -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_sqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of SQL Database
+ register: output
+ azure.azcollection.azure_rm_sqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of SQL Database
+ register: output
+ azure.azcollection.azure_rm_sqldatabase:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
+- name: Gather facts SQL Database
+ azure_rm_sqldatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: database{{ random_postfix }}
+ register: output
+- name: Assert that empty dictionary was returned
+ assert:
+ that:
+ - output.changed == False
+ - output.databases | length == 0
+- name: Gather facts SQL Database
+ azure_rm_sqldatabase_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ register: output
+- name: Assert that empty dictionary was returned (one database is there by default)
+ assert:
+ that:
+ - output.changed == False
+ - output.databases | length == 1
+- name: Create instance of Firewall Rule -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_sqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: firewallrule{{ random_postfix }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_sqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: firewallrule{{ random_postfix }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the resource instance is well created
+ assert:
+ that:
+ - output.changed
+- name: Create again instance of Firewall Rule
+ register: output
+ azure.azcollection.azure_rm_sqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: firewallrule{{ random_postfix }}
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Assert the state has not changed
+ assert:
+ that:
+ - output.changed == false
+- name: Create Firewall Rule - second
+ azure.azcollection.azure_rm_sqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: firewallrule{{ random_postfix }}second
+ start_ip_address: 172.28.10.136
+ end_ip_address: 172.28.10.138
+- name: Gather facts SQL Firewall Rule
+ azure_rm_sqlfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: firewallrule{{ random_postfix }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules[0].id != None
+ - output.rules[0].resource_group != None
+ - output.rules[0].server_name != None
+ - output.rules[0].name != None
+ - output.rules[0].start_ip_address != None
+ - output.rules[0].end_ip_address != None
+- name: Gather facts SQL Firewall Rule
+ azure_rm_sqlfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ register: output
+- name: Assert that facts are returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules[0].id != None
+ - output.rules[0].id != None
+ - output.rules[0].resource_group != None
+ - output.rules[0].server_name != None
+ - output.rules[0].name != None
+ - output.rules[0].start_ip_address != None
+ - output.rules[0].end_ip_address != None
+ - output.rules[1].id != None
+ - output.rules[1].resource_group != None
+ - output.rules[1].server_name != None
+ - output.rules[1].name != None
+ - output.rules[1].start_ip_address != None
+ - output.rules[1].end_ip_address != None
+- name: Delete instance of Firewall Rule
+ azure.azcollection.azure_rm_sqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: firewallrule{{ random_postfix }}
+ state: absent
+- name: Delete instance of Firewall Rule
+ azure.azcollection.azure_rm_sqlfirewallrule:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: firewallrule{{ random_postfix }}second
+ state: absent
+- name: Gather facts SQL Firewall Rule
+ azure_rm_sqlfirewallrule_facts:
+ resource_group: '{{ resource_group }}'
+ server_name: sqlsrv{{ random_postfix }}
+ name: firewallrule{{ random_postfix }}
+ register: output
+- name: Assert that empty dictionary was returned
+ assert:
+ that:
+ - output.changed == False
+ - output.rules | length == 0
+- name: Delete instance of SQL Server -- check mode
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_sqlserver:
+ resource_group: '{{ resource_group }}'
+ name: sqlsrv{{ random_postfix }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete instance of SQL Server
+ register: output
+ azure.azcollection.azure_rm_sqlserver:
+ resource_group: '{{ resource_group }}'
+ name: sqlsrv{{ random_postfix }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed
+- name: Delete unexisting instance of SQL Server
+ register: output
+ azure.azcollection.azure_rm_sqlserver:
+ resource_group: '{{ resource_group }}'
+ name: sqlsrv{{ random_postfix }}
+ state: absent
+- name: Assert the state has changed
+ assert:
+ that:
+ - output.changed == false
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/aliases
new file mode 100644
index 00000000..218b8261
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/aliases
@@ -0,0 +1,4 @@
+cloud/azure
+shippable/azure/group1
+destructive
+azure_rm_virtualmachine_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/inventory.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/inventory.yml
new file mode 100644
index 00000000..acd98ebf
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/inventory.yml
@@ -0,0 +1,66 @@
+all:
+ hosts:
+ azure_test_invalid:
+ azure_test_public_ip:
+ network: 10.42.0.0/24
+ subnet: 10.42.0.0/28
+
+ azure_test_no_public_ip:
+ network: 10.42.1.0/24
+ subnet: 10.42.1.0/28
+
+ azure_test_deallocate:
+ network: 10.42.2.0/24
+ subnet: 10.42.2.0/28
+
+ azure_test_minimal:
+ network: 10.42.3.0/24
+ subnet: 10.42.3.0/28
+
+ azure_test_dual_nic:
+ network: 10.42.4.0/24
+ subnet: 10.42.4.0/28
+ secondary_network: 10.42.5.0/24
+ secondary_subnet: 10.42.5.0/28
+ nic_list:
+ - name: "{{ 'int' ~ uid_short ~ '-1' }}"
+ resource_group: "{{ resource_group_secondary }}"
+ - name: "{{ 'int' ~ uid_short ~ '-2' }}"
+ resource_group: "{{ resource_group_secondary }}"
+
+ vars:
+ ansible_connection: local
+ ansible_python_interpreter: "{{ ansible_playbook_python }}"
+
+ uid: "{{ (resource_group ~ inventory_hostname) | hash('md5') | truncate(18, True, '') }}"
+ uid_short: "{{ (resource_group ~ inventory_hostname) | hash('md5') | truncate(10, True, '') }}"
+
+ storage_account: "{{ 'stor' ~ uid }}"
+ availability_set: "{{ 'avbs' ~ uid_short }}"
+ vm_name: "{{ 'vm' ~ uid_short }}"
+ network_name: "{{ 'vnet' ~ uid_short }}"
+ subnet_name: "{{ 'snet' ~ uid_short }}"
+ security_group: "{{ 'sg' ~ uid_short }}"
+ public_ip_name: "{{ 'ip' ~ uid_short }}"
+ interface_name: "{{ 'int' ~ uid_short }}"
+
+ ssh_keys:
+ - path: '/home/chouseknecht/.ssh/authorized_keys'
+ key_data: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1igsIlcmTa/yfsJnTtnrEX7PP/a01gwbXcig6JOKyrUmJB8E6c/wtZwP115VSyDRTO6TEL/sBFUpkSw01zM8ydNATErh8meBlAlbnDq5NLhDXnMizgG0VNn0iLc/WplFTqkefsHXa8NtIxAtyEVIj/fKbK3XfBOdEpE3+MJYNtGlWyaod28W+5qmQPZDQys+YnE4OjSwN7D3g85/7dtLFvDH+lEC4ooJOaxVFr9VSMXUIkaRF6oI+R1Zu803LFSCTb4BfFOYOHPuQ/rEMP0KuUzggvP+TEBY14PEA2FoHOn+oRsT0ZR2+loGRaxSVqCQKaEHbNbkm+6Rllx2NQRO0BJxCSKRU1iifInLPxmSc4gvsHCKMAWy/tGkmKHPWIfN8hvwyDMK5MNBp/SJ1pVx4xuFDQjVWNbll0yk2+72uJgtFHHwEPK9QsOz45gX85vS3yhYCKrscS/W9h2l36SWwQXuGy4fXotE7esPsvNGAzBndHX1O8RMPg47qJXz059RyoGforoa9TnzIs3hIv+ts7ESx3OEq3HNk0FJ+wDka7IM7WQpGrVToJ0vfDy9Q46nw54vv5Zc/u4OZF3F5twHmyf3rLYKXRDuCvZQKT2iWQKVX6j63bq6orA5hwl22zndxWZNtOwtq8Sd0Ns0K/Fo/ggYDDGBtr68DwhA+MrxrHw== chouseknecht@ansible.com"
+
+ image:
+ offer: CentOS
+ publisher: OpenLogic
+ sku: '7.1'
+ version: latest
+
+ image_paid:
+ publisher: cognosys
+ offer: ubuntu-14-04-lts
+ sku: hardened-ubuntu-14-04
+ version: latest
+
+ plan_paid:
+ name: hardened-ubuntu-14-04
+ product: ubuntu-14-04-lts
+ publisher: cognosys
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/main.yml
new file mode 100644
index 00000000..7722487b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/main.yml
@@ -0,0 +1,7 @@
+- name: Run Azurue VM tests in parallel
+ hosts: all
+ gather_facts: no
+ strategy: free
+ tasks:
+ - name: Include tasks based on inventory hostname
+ include_tasks: tasks/{{ inventory_hostname }}.yml
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/runme.sh b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/runme.sh
new file mode 100755
index 00000000..c7895c9d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -eux
+
+ansible-playbook -i inventory.yml main.yml "$@"
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_deallocate.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_deallocate.yml
new file mode 100644
index 00000000..80dc5946
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_deallocate.yml
@@ -0,0 +1,78 @@
+- include_tasks: setup.yml
+- name: Create minimal VM with defaults
+ register: vm_output
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ admin_username: testuser
+ admin_password: Pass123$$$abx!
+ vm_size: Standard_A0
+ virtual_network: '{{ network_name }}'
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ version: latest
+- name: Restart the virtual machine
+ register: restart_result
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ restarted: true
+ vm_size: Standard_A0
+- name: Ensue VM was restarted
+ assert:
+ that:
+ - azure_vm.powerstate in ['starting', 'running']
+ - restart_result is changed
+- name: Deallocate the virtual machine
+ register: deallocate_result
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ allocated: false
+ vm_size: Standard_A0
+- name: Ensure VM was deallocated
+ assert:
+ that:
+ - azure_vm.powerstate == 'deallocated'
+ - deallocate_result is changed
+- name: Start the virtual machine
+ register: start_result
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ vm_size: Standard_A0
+- name: Ensure VM was started
+ assert:
+ that:
+ - azure_vm.powerstate in ['starting', 'running']
+ - start_result is changed
+- name: Delete VM
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ state: absent
+ remove_on_absent: all_autocreated
+- name: Destroy subnet
+ azure.azcollection.azure_rm_subnet:
+ resource_group: '{{ resource_group }}'
+ virtual_network: '{{ network_name }}'
+ name: '{{ subnet_name }}'
+ state: absent
+- name: Destroy virtual network
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group }}'
+ name: '{{ network_name }}'
+ state: absent
+- name: Destroy availability set
+ azure.azcollection.azure_rm_availabilityset:
+ resource_group: '{{ resource_group }}'
+ name: '{{ availability_set }}'
+ state: absent
+- name: Destroy storage account
+ azure.azcollection.azure_rm_storageaccount:
+ resource_group: '{{ resource_group }}'
+ name: '{{ storage_account }}'
+ force_delete_nonempty: true
+ state: absent
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_dual_nic.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_dual_nic.yml
new file mode 100644
index 00000000..64e5b54b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_dual_nic.yml
@@ -0,0 +1,116 @@
+- include_tasks: setup.yml
+- name: Create virtual network in secondary resource group
+ register: create_virt_net_result
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group_secondary }}'
+ name: '{{ network_name ~ ''-2'' }}'
+ address_prefixes: '{{ secondary_network }}'
+- name: Create subnet in secondary resource group
+ azure.azcollection.azure_rm_subnet:
+ resource_group: '{{ resource_group_secondary }}'
+ name: '{{ subnet_name ~ ''-2'' }}'
+ address_prefix: '{{ secondary_subnet }}'
+ virtual_network: '{{ network_name ~ ''-2'' }}'
+- name: Create NICs for dual NIC VM in secondary resource group
+ loop: '{{ nic_list }}'
+ azure.azcollection.azure_rm_networkinterface:
+ resource_group: '{{ item.resource_group }}'
+ name: '{{ item.name }}'
+ virtual_network: '{{ network_name ~ ''-2'' }}'
+ subnet: '{{ subnet_name ~ ''-2'' }}'
+- name: Create virtual machine with two NICs
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ vm_size: Standard_A0
+ storage_account: '{{ storage_account }}'
+ storage_container: '{{ vm_name }}'
+ storage_blob: '{{ vm_name }}.vhd'
+ admin_username: adminuser
+ admin_password: Password123!
+ short_hostname: testvm
+ os_type: Linux
+ os_disk_size_gb: 64
+ os_disk_name: testosdiskxx
+ network_interfaces: '{{ nic_list }}'
+ availability_set: '{{ availability_set }}'
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ version: latest
+ tags:
+ abc: def
+- name: Ensure VM was created properly
+ assert:
+ that:
+ - azure_vm.properties.availabilitySet.id
+ - azure_vm.properties.storageProfile.osDisk.name == 'testosdiskxx'
+- name: Retrieve VM facts (filtering by name)
+ azure_rm_virtualmachine_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ register: vm_facts_results
+- name: Ensure facts module returned the second VM
+ assert:
+ that:
+ - vm_facts_results.vms | length == 1
+ - vm_facts_results.vms[0].name == "{{ vm_name }}"
+ - vm_facts_results.vms[0].location
+ - vm_facts_results.vms[0].admin_username == 'adminuser'
+ - vm_facts_results.vms[0].resource_group == "{{ resource_group }}"
+ - vm_facts_results.vms[0].power_state != None
+- name: Retrieve facts by tags
+ azure_rm_virtualmachine_facts:
+ tags:
+ - abc:def
+ register: facts_by_tags_results
+- name: Assert that facts module returned the second VM
+ assert:
+ that:
+ - facts_by_tags_results.vms | length >= 1
+- name: Should be idempotent with a dual NICs
+ register: dual_nics_result
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ vm_size: Standard_A0
+ storage_account: '{{ storage_account }}'
+ storage_container: '{{ vm_name }}'
+ storage_blob: '{{ vm_name }}.vhd'
+ admin_username: adminuser
+ admin_password: Password123!
+ short_hostname: testvm
+ os_type: Linux
+ os_disk_size_gb: 64
+ network_interfaces: '{{ nic_list }}'
+ availability_set: '{{ availability_set }}'
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ version: latest
+- name: Ensure nothing changed
+ assert:
+ that: dual_nics_result is not changed
+- name: Generalize VM
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ generalized: true
+- name: Gather facts and check if machine is generalized
+ azure_rm_virtualmachine_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ register: generalized_output
+- name: Ensure power state is generalized
+ assert:
+ that: generalized_output.vms[0].power_state == 'generalized'
+- name: Delete dual NIC VM
+ async: 5000
+ poll: 0
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ state: absent
+ vm_size: Standard_A0
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_invalid.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_invalid.yml
new file mode 100644
index 00000000..8b1979a9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_invalid.yml
@@ -0,0 +1,31 @@
+- name: Assert error thrown with invalid image dict
+ register: fail_invalid_image_dict
+ failed_when: 'fail_invalid_image_dict.msg != "parameter error: expecting image to contain [publisher, offer, sku, version], [name, resource_group] or [id]"'
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ image:
+ offer: UbuntuServer
+- name: Assert error thrown with invalid image type
+ register: fail_invalid_image_type
+ failed_when: 'fail_invalid_image_type.msg != "parameter error: expecting image to be a string or dict not list"'
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ image:
+ - testing
+- name: Assert error finding missing custom image
+ register: fail_missing_custom_image
+ failed_when: fail_missing_custom_image.msg != "Error could not find image with name invalid-image"
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ image: invalid-image
+- name: Assert error finding missing custom image (dict style)
+ register: fail_missing_custom_image_dict
+ failed_when: fail_missing_custom_image_dict.msg != "Error could not find image with name invalid-image"
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ image:
+ name: invalid-image
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_minimal.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_minimal.yml
new file mode 100644
index 00000000..74446055
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_minimal.yml
@@ -0,0 +1,64 @@
+- include_tasks: setup.yml
+- name: Create minimal VM with defaults
+ register: vm_output
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ admin_username: testuser
+ admin_password: Pass123$$$abx!
+ vm_size: Standard_B1ms
+ virtual_network: '{{ network_name }}'
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ version: latest
+- name: Delete VM
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ remove_on_absent: all_autocreated
+ state: absent
+- name: Query auto created NIC
+ register: nic_result
+ azure.azcollection.azure_rm_networkinterface_info:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}01'
+- name: Query auto created security group
+ register: nsg_result
+ azure.azcollection.azure_rm_securitygroup_info:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}01'
+- name: Query auto created public IP
+ register: pip_result
+ azure.azcollection.azure_rm_publicipaddress_info:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}01'
+- name: Assert that autocreated resources were deleted
+ assert:
+ that:
+ - nic_result.networkinterfaces | length == 0
+ - nsg_result.securitygroups | length == 0
+ - pip_result.publicipaddresses | length == 0
+- name: Destroy subnet
+ azure.azcollection.azure_rm_subnet:
+ resource_group: '{{ resource_group }}'
+ virtual_network: '{{ network_name }}'
+ name: '{{ subnet_name }}'
+ state: absent
+- name: Destroy virtual network
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group }}'
+ name: '{{ network_name }}'
+ state: absent
+- name: Destroy availability set
+ azure.azcollection.azure_rm_availabilityset:
+ resource_group: '{{ resource_group }}'
+ name: '{{ availability_set }}'
+ state: absent
+- name: Destroy storage account
+ azure.azcollection.azure_rm_storageaccount:
+ resource_group: '{{ resource_group }}'
+ name: '{{ storage_account }}'
+ force_delete_nonempty: true
+ state: absent
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_no_public_ip.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_no_public_ip.yml
new file mode 100644
index 00000000..e9b81b08
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_no_public_ip.yml
@@ -0,0 +1,38 @@
+- include_tasks: setup.yml
+- name: Create virtual machine without public ip address and with boot diagnostics enabled
+ register: create_vm_public_result
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ vm_size: Standard_A0
+ admin_username: adminuser
+ admin_password: Password123!
+ short_hostname: testvm
+ os_type: Linux
+ public_ip_allocation_method: Disabled
+ storage_account_name: '{{ storage_account }}'
+ availability_set: '{{ availability_set }}'
+ virtual_network: '{{ network_name }}'
+ boot_diagnostics:
+ enabled: true
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ version: latest
+- name: Ensure VM was created properly
+ assert:
+ that:
+ - azure_vm.properties.diagnosticsProfile.bootDiagnostics.enabled
+ - azure_vm.properties.diagnosticsProfile.bootDiagnostics.storageUri is defined
+ - azure_vm.properties.instanceView.bootDiagnostics.consoleScreenshotBlobUri is defined
+ - azure_vm.properties.instanceView.bootDiagnostics.serialConsoleLogBlobUri is defined
+ - not 'publicIPAddress' in create_vm_public_result.ansible_facts.azure_vm.properties.networkProfile.networkInterfaces[0].properties.ipConfigurations[0].properties
+- name: Delete VM with no public ip
+ async: 5000
+ poll: 0
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ state: absent
+ remove_on_absent: all_autocreated
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_public_ip.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_public_ip.yml
new file mode 100644
index 00000000..ef89fbf7
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/azure_test_public_ip.yml
@@ -0,0 +1,236 @@
+- include_tasks: setup.yml
+- name: Create public ip
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ allocation_method: Static
+ name: '{{ public_ip_name }}'
+- name: Create security group
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ security_group }}'
+ purge_rules: true
+ rules:
+ - name: ALLOW_SSH
+ protocol: Tcp
+ destination_port_range: 22
+ access: Allow
+ priority: 100
+ direction: Inbound
+ - name: ALLOW_HTTP
+ protocol: Tcp
+ destination_port_range: 80
+ access: Allow
+ priority: 110
+ direction: Inbound
+- name: Create network interface
+ azure.azcollection.azure_rm_networkinterface:
+ resource_group: '{{ resource_group }}'
+ name: '{{ interface_name }}'
+ virtual_network: '{{ network_name }}'
+ subnet: '{{ subnet_name }}'
+ public_ip_name: '{{ public_ip_name }}'
+ security_group: '{{ security_group }}'
+- name: Create virtual machine with a single NIC and no boot diagnostics
+ register: output
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ vm_size: Standard_A0
+ storage_account: '{{ storage_account }}'
+ storage_container: '{{ vm_name }}'
+ storage_blob: '{{ vm_name }}.vhd'
+ admin_username: adminuser
+ admin_password: Password123!
+ short_hostname: testvm
+ os_type: Linux
+ network_interfaces: '{{ interface_name }}'
+ availability_set: '{{ availability_set }}'
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ version: latest
+ custom_data: '#!/bin/sh
+
+ echo "custom_data was executed" > /tmp/custom_data.txt
+
+ '
+- name: Ensure VM was created properly
+ assert:
+ that:
+ - azure_vm.properties.provisioningState == 'Succeeded'
+ - azure_vm.properties.availabilitySet.id
+ - '''diagnosticsProfile'' not in azure_vm.properties or not azure_vm.properties.diagnosticsProfile.bootDiagnostics.enabled'
+- name: Get facts for virtual machine without boot diagnostics disabled
+ azure_rm_virtualmachine_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ register: vm_facts_no_boot_diag_result
+- name: Ensure VM facts are correct
+ assert:
+ that:
+ - vm_facts_no_boot_diag_result.vms != []
+ - not vm_facts_no_boot_diag_result.vms[0].boot_diagnostics.enabled
+ - not vm_facts_no_boot_diag_result.vms[0].boot_diagnostics.storage_uri
+- name: Enable boot diagnostics on an existing VM for the first time without specifying a storage account
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ boot_diagnostics:
+ enabled: true
+- name: Ensure VM properties are correct
+ assert:
+ that:
+ - azure_vm.properties.diagnosticsProfile.bootDiagnostics.enabled
+ - azure_vm.properties.diagnosticsProfile.bootDiagnostics.storageUri is defined
+ - azure_vm.properties.instanceView.bootDiagnostics.consoleScreenshotBlobUri is defined
+ - azure_vm.properties.instanceView.bootDiagnostics.serialConsoleLogBlobUri is defined
+- name: Get facts for virtual machine with boot diagnostics enabled
+ azure_rm_virtualmachine_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ register: vm_facts_boot_diag_result
+- name: Ensure VM facts were returned
+ assert:
+ that:
+ - vm_facts_boot_diag_result.vms != []
+ - vm_facts_boot_diag_result.vms[0].boot_diagnostics.enabled
+ - vm_facts_boot_diag_result.vms[0].boot_diagnostics.storage_uri is defined
+ - vm_facts_boot_diag_result.vms[0].boot_diagnostics.console_screenshot_uri is defined
+ - vm_facts_boot_diag_result.vms[0].boot_diagnostics.serial_console_log_uri is defined
+- name: Change the boot diagnostics storage account while enabled
+ ignore_errors: true
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ boot_diagnostics:
+ enabled: true
+ storage_account: '{{ storage_account }}'
+- name: Disable boot diagnostics and change the storage account at the same time
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ boot_diagnostics:
+ enabled: false
+ storage_account: '{{ storage_account }}'
+- name: Ensure boot diagnostics was disabled
+ assert:
+ that:
+ - not azure_vm.properties.diagnosticsProfile.bootDiagnostics.enabled
+- name: Re-enable boot diagnostics on an existing VM where it was previously configured
+ register: reenable_boot_diag_result
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ boot_diagnostics:
+ enabled: true
+- name: Ensure boot diagnostics was reenabled
+ assert:
+ that:
+ - azure_vm.properties.diagnosticsProfile.bootDiagnostics.enabled
+ - azure_vm.properties.diagnosticsProfile.bootDiagnostics.storageUri is defined
+ - azure_vm.properties.instanceView.bootDiagnostics.consoleScreenshotBlobUri is defined
+ - azure_vm.properties.instanceView.bootDiagnostics.serialConsoleLogBlobUri is defined
+- name: Should be idempotent with a single NIC
+ register: single_nic_result
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ vm_size: Standard_A0
+ storage_account: '{{ storage_account }}'
+ storage_container: '{{ vm_name }}'
+ storage_blob: '{{ vm_name }}.vhd'
+ admin_username: adminuser
+ admin_password: Password123!
+ short_hostname: testvm
+ os_type: Linux
+ network_interfaces: '{{ interface_name }}'
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ version: latest
+- name: Ensure nothing changed
+ assert:
+ that: single_nic_result is not changed
+- name: Resize VM
+ register: resize_result
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ vm_size: Standard_A1
+ storage_account: '{{ storage_account }}'
+ storage_container: '{{ vm_name }}'
+ storage_blob: '{{ vm_name }}.vhd'
+ admin_username: adminuser
+ admin_password: Password123!
+ short_hostname: testvm
+ os_type: Linux
+ network_interfaces: '{{ interface_name }}'
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ version: latest
+- name: Esure VM was resized
+ assert:
+ that:
+ - resize_result is changed
+ - resize_result.ansible_facts.azure_vm.properties.hardwareProfile.vmSize == "Standard_A1"
+- name: Delete VM
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: '{{ vm_name }}'
+ state: absent
+ vm_size: Standard_A0
+- name: NIC should be gone
+ azure_rm_networkinterface_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ interface_name }}'
+- name: Ensure NIC was removed
+ assert:
+ that: azure_networkinterfaces | length == 0
+- name: Public IP should be gone
+ azure_rm_publicipaddress_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ public_ip_name }}'
+- name: Ensure public IP was removed
+ assert:
+ that: azure_publicipaddresses | length == 0
+- name: Destroy NIC
+ azure.azcollection.azure_rm_networkinterface:
+ resource_group: '{{ resource_group }}'
+ name: '{{ interface_name }}'
+ state: absent
+- name: Destroy security group
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: '{{ security_group }}'
+ state: absent
+- name: Destroy subnet
+ azure.azcollection.azure_rm_subnet:
+ resource_group: '{{ resource_group }}'
+ virtual_network: '{{ network_name }}'
+ name: '{{ subnet_name }}'
+ state: absent
+- name: Destroy virtual network
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group }}'
+ name: '{{ network_name }}'
+ state: absent
+- name: Destroy public ip
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ name: '{{ public_ip_name }}'
+ state: absent
+- name: Destroy availability set
+ azure.azcollection.azure_rm_availabilityset:
+ resource_group: '{{ resource_group }}'
+ name: '{{ availability_set }}'
+ state: absent
+- name: Destroy storage account
+ azure.azcollection.azure_rm_storageaccount:
+ resource_group: '{{ resource_group }}'
+ name: '{{ storage_account }}'
+ force_delete_nonempty: true
+ state: absent
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/setup.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/setup.yml
new file mode 100644
index 00000000..2d4f19c0
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachine/tasks/setup.yml
@@ -0,0 +1,22 @@
+- debug:
+ msg: UID is {{ uid_short }}
+- name: SETUP | Create storage account
+ azure.azcollection.azure_rm_storageaccount:
+ resource_group: '{{ resource_group }}'
+ name: '{{ storage_account }}'
+ account_type: Standard_LRS
+- name: SETUP | Create availability set
+ azure.azcollection.azure_rm_availabilityset:
+ name: '{{ availability_set }}'
+ resource_group: '{{ resource_group }}'
+- name: SETUP | Create virtual network
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group }}'
+ name: '{{ network_name }}'
+ address_prefixes: '{{ network }}'
+- name: SETUP | Create subnet
+ azure.azcollection.azure_rm_subnet:
+ resource_group: '{{ resource_group }}'
+ name: '{{ subnet_name }}'
+ address_prefix: '{{ subnet }}'
+ virtual_network: '{{ network_name }}'
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/aliases
new file mode 100644
index 00000000..6c772d71
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/aliases
@@ -0,0 +1,4 @@
+cloud/azure
+shippable/azure/group1
+destructive
+azure_rm_virtualmachineextension_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/tasks/main.yml
new file mode 100644
index 00000000..390c0cb6
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachineextension/tasks/main.yml
@@ -0,0 +1,167 @@
+- name: Create Random Storage Account Name
+ set_fact:
+ storage_account: '{{ resource_group | hash(''md5'') | truncate(24, True, '''') }}'
+- name: Create virtual network
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group }}'
+ name: testVnet
+ address_prefixes: 10.0.0.0/16
+- name: Add subnet
+ azure.azcollection.azure_rm_subnet:
+ resource_group: '{{ resource_group }}'
+ name: testSubnet
+ address_prefix: 10.0.1.0/24
+ virtual_network: testVnet
+- name: Create public IP address
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ allocation_method: Dynamic
+ name: testPublicIP
+- name: Create Network Security Group that allows SSH
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: testNetworkSecurityGroup
+ rules:
+ - name: SSH
+ protocol: Tcp
+ destination_port_range: 22
+ access: Allow
+ priority: 1001
+ direction: Inbound
+- name: Create virtual network interface card
+ azure.azcollection.azure_rm_networkinterface:
+ resource_group: '{{ resource_group }}'
+ name: testNIC
+ virtual_network: testVnet
+ subnet: testSubnet
+ public_ip_name: testPublicIP
+ security_group_name: testNetworkSecurityGroup
+- name: create a storage account
+ azure.azcollection.azure_rm_storageaccount:
+ resource_group: '{{ resource_group }}'
+ name: '{{ storage_account }}'
+ type: Standard_LRS
+- name: Create VM
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: testVM
+ vm_size: Standard_DS1_v2
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ network_interfaces: testNIC
+ storage_account_name: '{{ storage_account }}'
+ storage_container: osdisk
+ storage_blob: osdisk.vhd
+ os_disk_caching: ReadWrite
+ image:
+ offer: CoreOS
+ publisher: CoreOS
+ sku: Stable
+ version: latest
+- name: Create VM Extension
+ register: results
+ azure.azcollection.azure_rm_virtualmachineextension:
+ resource_group: '{{ resource_group }}'
+ name: testVMExtension
+ virtual_machine_name: testVM
+ publisher: Microsoft.Azure.Extensions
+ virtual_machine_extension_type: CustomScript
+ type_handler_version: 2.0
+ auto_upgrade_minor_version: true
+ settings:
+ commandToExecute: hostname
+- name: Assert that VM Extension ran
+ assert:
+ that: results.changed
+- name: Query extension
+ azure_rm_virtualmachineextension_facts:
+ resource_group: '{{ resource_group }}'
+ name: testVMExtension
+ virtual_machine_name: testVM
+ register: results
+- name: Assert that facts are returned
+ assert:
+ that:
+ - results.changed == False
+ - results.extensions[0]['id'] != None
+ - results.extensions[0]['resource_group'] != None
+ - results.extensions[0]['virtual_machine_name'] != None
+ - results.extensions[0]['name'] != None
+ - results.extensions[0]['location'] != None
+ - results.extensions[0]['publisher'] != None
+ - results.extensions[0]['type'] != None
+ - results.extensions[0]['settings'] != None
+ - results.extensions[0]['auto_upgrade_minor_version'] != None
+ - results.extensions[0]['provisioning_state'] != None
+- name: List extensions
+ azure_rm_virtualmachineextension_facts:
+ resource_group: '{{ resource_group }}'
+ virtual_machine_name: testVM
+ register: results
+- name: Assert that facts are returned
+ assert:
+ that:
+ - results.changed == False
+ - results.extensions[0]['id'] != None
+ - results.extensions[0]['resource_group'] != None
+ - results.extensions[0]['virtual_machine_name'] != None
+ - results.extensions[0]['name'] != None
+ - results.extensions[0]['location'] != None
+ - results.extensions[0]['publisher'] != None
+ - results.extensions[0]['type'] != None
+ - results.extensions[0]['settings'] != None
+ - results.extensions[0]['auto_upgrade_minor_version'] != None
+ - results.extensions[0]['provisioning_state'] != None
+- name: Delete VM Extension
+ register: results
+ azure.azcollection.azure_rm_virtualmachineextension:
+ resource_group: '{{ resource_group }}'
+ name: testVMExtension
+ virtual_machine_name: testVM
+ state: absent
+ publisher: Microsoft.Azure.Extensions
+ virtual_machine_extension_type: CustomScript
+ type_handler_version: 2.0
+ auto_upgrade_minor_version: true
+ settings:
+ commandToExecute: hostname
+- name: Assert that VM Extension deleted
+ assert:
+ that: results.changed
+- name: Delete VM
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: testVM
+ state: absent
+ remove_on_absent:
+ - all
+ vm_size: Standard_DS1_v2
+ admin_username: testuser
+ network_interfaces: testNIC
+ storage_container: osdisk
+ storage_blob: osdisk.vhd
+ os_disk_caching: ReadWrite
+ image:
+ offer: CoreOS
+ publisher: CoreOS
+ sku: Stable
+ version: latest
+- name: Delete a storage account
+ azure.azcollection.azure_rm_storageaccount:
+ resource_group: '{{ resource_group }}'
+ name: '{{ storage_account }}'
+ type: Standard_LRS
+ state: absent
+ force_delete_nonempty: true
+- name: Delete Network Security Group that allows SSH
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: testNetworkSecurityGroup
+ state: absent
+- name: Delete virtual network
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group }}'
+ name: testVnet
+ state: absent
+ address_prefixes: 10.0.0.0/16
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/aliases
new file mode 100644
index 00000000..01c44d5e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/aliases
@@ -0,0 +1,7 @@
+cloud/azure
+shippable/azure/group1
+destructive
+azure_rm_virtualmachinescaleset_facts
+azure_rm_virtualmachinescalesetinstance_facts
+azure_rm_virtualmachinescalesetextension
+azure_rm_virtualmachinescalesetextension_facts
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/tasks/main.yml
new file mode 100644
index 00000000..434eb2e9
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_virtualmachinescaleset/tasks/main.yml
@@ -0,0 +1,547 @@
+- name: Prepare random number
+ set_fact:
+ rpfx: '{{ resource_group | hash(''md5'') | truncate(7, True, '''') }}{{ 1000 | random }}'
+ run_once: true
+- name: Create virtual network
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group }}'
+ name: testVnet
+ address_prefixes: 10.0.0.0/16
+- name: Add subnet
+ azure.azcollection.azure_rm_subnet:
+ resource_group: '{{ resource_group }}'
+ name: testSubnet
+ address_prefix: 10.0.1.0/24
+ virtual_network: testVnet
+- name: Create public IP address
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ allocation_method: Static
+ name: testPublicIP
+- name: Create load balancer
+ azure.azcollection.azure_rm_loadbalancer:
+ resource_group: '{{ resource_group }}'
+ name: testLB
+ public_ip_address_name: testPublicIP
+- name: Create public IP address 1
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ allocation_method: Static
+ name: testPublicIP1
+- name: Create load balancer 1
+ azure.azcollection.azure_rm_loadbalancer:
+ resource_group: '{{ resource_group }}'
+ name: testLB1
+ public_ip_address_name: testPublicIP1
+- name: Create network security group within same resource group of VMSS.
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: testNetworkSecurityGroup
+- name: Create network security group in different resource group of VMSS.
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group_secondary }}'
+ name: testNetworkSecurityGroup2
+- name: Create virtual network inteface cards for VM A and B
+ azure.azcollection.azure_rm_networkinterface:
+ resource_group: '{{ resource_group }}'
+ name: vmforimage{{ rpfx }}nic
+ virtual_network: testVnet
+ subnet: testSubnet
+- name: Create VM
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: vmforimage{{ rpfx }}
+ admin_username: testuser
+ admin_password: Password1234!
+ vm_size: Standard_B1ms
+ network_interfaces: vmforimage{{ rpfx }}nic
+ image:
+ offer: UbuntuServer
+ publisher: Canonical
+ sku: 16.04-LTS
+ version: latest
+- name: Generalize VM
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: vmforimage{{ rpfx }}
+ generalized: true
+- name: Create image A
+ azure.azcollection.azure_rm_image:
+ resource_group: '{{ resource_group }}'
+ name: testimagea
+ source: vmforimage{{ rpfx }}
+- name: Create image B
+ azure.azcollection.azure_rm_image:
+ resource_group: '{{ resource_group }}'
+ name: testimageb
+ source: vmforimage{{ rpfx }}
+- name: Delete VM
+ azure.azcollection.azure_rm_virtualmachine:
+ resource_group: '{{ resource_group }}'
+ name: vmforimage{{ rpfx }}
+ state: absent
+- name: Create VMSS (check mode)
+ register: results
+ check_mode: true
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}
+ vm_size: Standard_B1s
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ capacity: 1
+ virtual_network_name: testVnet
+ subnet_name: testSubnet
+ load_balancer: testLB
+ upgrade_policy: Manual
+ tier: Standard
+ managed_disk_type: Standard_LRS
+ os_disk_caching: ReadWrite
+ image:
+ offer: CoreOS
+ publisher: CoreOS
+ sku: Stable
+ version: latest
+ data_disks:
+ - lun: 0
+ disk_size_gb: 64
+ caching: ReadWrite
+ managed_disk_type: Standard_LRS
+- name: Assert that VMSS can be created
+ assert:
+ that: results.changed
+- name: Get VMSS to assert no VMSS is created in check mode
+ azure_rm_virtualmachinescaleset_facts:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}
+ format: curated
+ register: output_scaleset
+- name: Assert no VMSS created in check mode
+ assert:
+ that:
+ - output_scaleset.ansible_facts.azure_vmss | length == 0
+- name: Create VMSS
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}
+ vm_size: Standard_B1s
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ capacity: 1
+ virtual_network_name: testVnet
+ subnet_name: testSubnet
+ upgrade_policy: Manual
+ load_balancer: testLB
+ tier: Standard
+ managed_disk_type: Standard_LRS
+ os_disk_caching: ReadWrite
+ custom_data: '#cloud-config'
+ image:
+ offer: CoreOS
+ publisher: CoreOS
+ sku: Stable
+ version: latest
+ data_disks:
+ - lun: 0
+ disk_size_gb: 64
+ caching: ReadWrite
+ managed_disk_type: Standard_LRS
+ scale_in_policy: NewestVM
+- name: Assert that VMSS was created
+ assert:
+ that: results.changed
+- name: Create VMSS -- test upgrade_policy idempotence and load balancer
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}
+ vm_size: Standard_B1s
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ capacity: 1
+ virtual_network_name: testVnet
+ subnet_name: testSubnet
+ upgrade_policy: Automatic
+ load_balancer: testLB1
+ tier: Standard
+ managed_disk_type: Standard_LRS
+ os_disk_caching: ReadWrite
+ custom_data: '#cloud-config'
+ image:
+ offer: CoreOS
+ publisher: CoreOS
+ sku: Stable
+ version: latest
+ data_disks:
+ - lun: 0
+ disk_size_gb: 64
+ caching: ReadWrite
+ managed_disk_type: Standard_LRS
+- name: Assert that VMSS was created
+ assert:
+ that: results.changed
+- name: Retrieve scaleset facts
+ azure_rm_virtualmachinescaleset_facts:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}
+ format: curated
+ register: output_scaleset
+- assert:
+ that:
+ - output_scaleset.vmss[0].load_balancer == "testLB1"
+- name: Retrieve scaleset VMs facts
+ azure_rm_virtualmachinescalesetinstance_facts:
+ resource_group: '{{ resource_group }}'
+ vmss_name: testVMSS{{ rpfx }}
+ register: instances
+- name: Assert that facts returned correctly
+ assert:
+ that:
+ - instances.instances | length == 1
+ - instances.instances[0].id != None
+ - instances.instances[0].name != None
+ - instances.instances[0].instance_id != None
+ - instances.instances[0].provisioning_state != None
+ - instances.instances[0].vm_id != None
+ - instances.instances[0].latest_model != None
+ - instances.instances[0].power_state != None
+- name: Get scaleset body
+ set_fact:
+ body: '{{ output_scaleset.vmss[0] }}'
+- name: Try to update VMSS using output as input
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ body.resource_group }}'
+ name: '{{ body.name }}'
+ vm_size: '{{ body.vm_size }}'
+ admin_username: '{{ body.admin_username }}'
+ ssh_password_enabled: '{{ body.ssh_password_enabled }}'
+ admin_password: Password1234!
+ capacity: '{{ body.capacity }}'
+ virtual_network_name: '{{ body.virtual_network_name }}'
+ subnet_name: '{{ body.subnet_name }}'
+ upgrade_policy: '{{ body.upgrade_policy }}'
+ load_balancer: '{{ body.load_balancer }}'
+ tier: '{{ body.tier }}'
+ managed_disk_type: '{{ body.managed_disk_type }}'
+ os_disk_caching: '{{ body.os_disk_caching }}'
+ image: '{{ body.image }}'
+ data_disks: '{{ body.data_disks }}'
+ overprovision: '{{ body.overprovision }}'
+- name: Assert that nothing was changed
+ assert:
+ that: not results.changed
+- name: Install VMSS Extension
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescalesetextension:
+ resource_group: '{{ resource_group }}'
+ vmss_name: testVMSS{{ rpfx }}
+ name: testExtension
+ publisher: Microsoft.Azure.Extensions
+ type: CustomScript
+ type_handler_version: 2.0
+ auto_upgrade_minor_version: true
+ settings:
+ commandToExecute: sudo apt-get -y install apache2
+- name: Assert that something was changed
+ assert:
+ that: results.changed
+- name: Install Again VMSS Extension - again
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescalesetextension:
+ resource_group: '{{ resource_group }}'
+ vmss_name: testVMSS{{ rpfx }}
+ name: testExtension
+ publisher: Microsoft.Azure.Extensions
+ type: CustomScript
+ type_handler_version: 2.0
+ auto_upgrade_minor_version: true
+ settings:
+ commandToExecute: sudo apt-get -y install apache2
+- name: Assert that nothing was changed
+ assert:
+ that: not results.changed
+- name: Query extension
+ azure_rm_virtualmachinescalesetextension_facts:
+ resource_group: '{{ resource_group }}'
+ vmss_name: testVMSS{{ rpfx }}
+ name: testExtension
+ register: results
+- name: Assert that facts are returned
+ assert:
+ that:
+ - results.changed == False
+ - results.extensions[0]['id'] != None
+ - results.extensions[0]['resource_group'] != None
+ - results.extensions[0]['vmss_name'] != None
+ - results.extensions[0]['name'] != None
+ - results.extensions[0]['publisher'] != None
+ - results.extensions[0]['type'] != None
+ - results.extensions[0]['settings'] != None
+ - results.extensions[0]['auto_upgrade_minor_version'] != None
+ - results.extensions[0]['provisioning_state'] != None
+- name: List extensions
+ azure_rm_virtualmachinescalesetextension_facts:
+ resource_group: '{{ resource_group }}'
+ vmss_name: testVMSS{{ rpfx }}
+ register: results
+- name: Assert that facts are returned
+ assert:
+ that:
+ - results.changed == False
+ - results.extensions[0]['id'] != None
+ - results.extensions[0]['resource_group'] != None
+ - results.extensions[0]['vmss_name'] != None
+ - results.extensions[0]['name'] != None
+ - results.extensions[0]['publisher'] != None
+ - results.extensions[0]['type'] != None
+ - results.extensions[0]['settings'] != None
+ - results.extensions[0]['auto_upgrade_minor_version'] != None
+ - results.extensions[0]['provisioning_state'] != None
+- name: Delete VMSS Extension
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescalesetextension:
+ resource_group: '{{ resource_group }}'
+ vmss_name: testVMSS{{ rpfx }}
+ name: testExtension
+ state: absent
+- name: Assert that change was reported
+ assert:
+ that: results.changed
+- name: Upgrade instance to the latest image
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescalesetinstance:
+ resource_group: '{{ resource_group }}'
+ vmss_name: testVMSS{{ rpfx }}
+ instance_id: '{{ instances.instances[0].instance_id }}'
+ latest_model: true
+- name: Assert that something has changed
+ assert:
+ that: results.changed
+- name: Stop virtual machine
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescalesetinstance:
+ resource_group: '{{ resource_group }}'
+ vmss_name: testVMSS{{ rpfx }}
+ instance_id: '{{ instances.instances[0].instance_id }}'
+ power_state: stopped
+- name: Assert that something has changed
+ assert:
+ that: results.changed
+- name: Delete instance
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescalesetinstance:
+ resource_group: '{{ resource_group }}'
+ vmss_name: testVMSS{{ rpfx }}
+ instance_id: '{{ instances.instances[0].instance_id }}'
+ state: absent
+- name: Assert that something has changed
+ assert:
+ that: results.changed
+- name: Delete VMSS
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}
+ state: absent
+- name: Create VMSS with security group in same resource group, with accelerated networking(check mode).
+ register: results
+ check_mode: true
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}2
+ vm_size: Standard_D3_v2
+ capacity: 0
+ virtual_network_name: testVnet
+ subnet_name: testSubnet
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ image:
+ name: testimagea
+ resource_group: '{{ resource_group }}'
+ upgrade_policy: Manual
+ security_group: testNetworkSecurityGroup
+ enable_accelerated_networking: true
+- name: Assert that VMSS can be created
+ assert:
+ that: results.changed
+- name: Create VMSS with security group in same resource group, with accelerated networking.
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}2
+ vm_size: Standard_D3_v2
+ capacity: 0
+ virtual_network_name: testVnet
+ subnet_name: testSubnet
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ image:
+ name: testimagea
+ resource_group: '{{ resource_group }}'
+ upgrade_policy: Manual
+ security_group: testNetworkSecurityGroup
+ enable_accelerated_networking: true
+- name: Assert that VMSS ran
+ assert:
+ that:
+ - results.changed
+ - results.ansible_facts.azure_vmss.properties.virtualMachineProfile.networkProfile.networkInterfaceConfigurations.0.properties.enableAcceleratedNetworking == true
+ - results.ansible_facts.azure_vmss.properties.virtualMachineProfile.networkProfile.networkInterfaceConfigurations.0.properties.networkSecurityGroup != {}
+- name: Create VMSS with security group in same resource group, with accelerated networking.
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}2
+ vm_size: Standard_D3_v2
+ capacity: 0
+ virtual_network_name: testVnet
+ subnet_name: testSubnet
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ image:
+ name: testimagea
+ resource_group: '{{ resource_group }}'
+ upgrade_policy: Manual
+ security_group: testNetworkSecurityGroup
+ enable_accelerated_networking: true
+- name: Assert that nothing has changed
+ assert:
+ that:
+ - not results.changed
+- name: Create VMSS with security group in same resource group, with accelerated networking.
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}2
+ vm_size: Standard_D3_v2
+ capacity: 0
+ virtual_network_name: testVnet
+ subnet_name: testSubnet
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ image:
+ name: testimageb
+ resource_group: '{{ resource_group }}'
+ upgrade_policy: Manual
+ security_group: testNetworkSecurityGroup
+ enable_accelerated_networking: true
+- name: Assert that something has changed
+ assert:
+ that:
+ - results.changed
+- name: update VMSS with security group in different resource group.
+ register: results
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}2
+ vm_size: Standard_B1s
+ capacity: 0
+ virtual_network_name: testVnet
+ subnet_name: testSubnet
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ image:
+ name: testimageb
+ resource_group: '{{ resource_group }}'
+ upgrade_policy: Manual
+ security_group:
+ name: testNetworkSecurityGroup2
+ resource_group: '{{ resource_group_secondary }}'
+- name: Delete VMSS
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}2
+ state: absent
+- name: Fail when instance type is not supported to enable accelerated networking
+ register: results
+ ignore_errors: true
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testVMSS{{ rpfx }}4
+ vm_size: Standard_B1s
+ virtual_network_name: testVnet
+ subnet_name: testSubnet
+ admin_username: testuser
+ ssh_password_enabled: true
+ admin_password: Password1234!
+ image:
+ offer: CoreOS
+ publisher: CoreOS
+ sku: Stable
+ version: latest
+ upgrade_policy: Manual
+ enable_accelerated_networking: true
+- name: Assert failure to show that accelerated networking is enabled only with supported instance types.
+ assert:
+ that:
+ - '"VMSizeIsNotPermittedToEnableAcceleratedNetworkingForVmss" in results.msg'
+- name: Delete network security group
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group }}'
+ name: testNetworkSecurityGroup
+ state: absent
+- name: Delete network security group
+ azure.azcollection.azure_rm_securitygroup:
+ resource_group: '{{ resource_group_secondary }}'
+ name: testNetworkSecurityGroup2
+ state: absent
+- name: Delete load balancer
+ azure.azcollection.azure_rm_loadbalancer:
+ resource_group: '{{ resource_group }}'
+ name: testLB
+ state: absent
+- name: Delete public IP address
+ azure.azcollection.azure_rm_publicipaddress:
+ resource_group: '{{ resource_group }}'
+ state: absent
+ name: testPublicIP
+- name: Delete virtual network
+ azure.azcollection.azure_rm_virtualnetwork:
+ resource_group: '{{ resource_group }}'
+ name: testVnet
+ state: absent
+ address_prefixes: 10.0.0.0/16
+- name: assert error thrown with invalid image dict
+ register: fail_invalid_image_dict
+ failed_when: 'fail_invalid_image_dict.msg != "parameter error: expecting image to contain [publisher, offer, sku, version], [name, resource_group] or [id]"'
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testvm002
+ vm_size: Standard_B1s
+ image:
+ offer: UbuntuServer
+- name: assert error thrown with invalid image type
+ register: fail_invalid_image_type
+ failed_when: 'fail_invalid_image_type.msg != "parameter error: expecting image to be a string or dict not list"'
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testvm002
+ vm_size: Standard_B1s
+ image:
+ - testing
+- name: assert error finding missing custom image
+ register: fail_missing_custom_image
+ failed_when: fail_missing_custom_image.msg != "Error could not find image with name invalid-image"
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testvm002
+ vm_size: Standard_B1s
+ image: invalid-image
+- name: assert error finding missing custom image (dict style)
+ register: fail_missing_custom_image_dict
+ failed_when: fail_missing_custom_image_dict.msg != "Error could not find image with name invalid-image"
+ azure.azcollection.azure_rm_virtualmachinescaleset:
+ resource_group: '{{ resource_group }}'
+ name: testvm002
+ vm_size: Standard_B1s
+ image:
+ name: invalid-image
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/aliases
new file mode 100644
index 00000000..fc534017
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/aliases
@@ -0,0 +1,5 @@
+cloud/azure
+shippable/azure/group1
+destructive
+azure_rm_webapp_facts
+azure_rm_webappslot
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/meta/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/meta/main.yml
new file mode 100644
index 00000000..95e1952f
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/tasks/main.yml b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/tasks/main.yml
new file mode 100644
index 00000000..af995af0
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/azure_rm_webapp/tasks/main.yml
@@ -0,0 +1,369 @@
+- name: Fix resource prefix
+ set_fact:
+ linux_app_plan_resource_group: '{{ resource_group_secondary }}'
+ win_app_name: '{{ (resource_prefix | replace(''-'',''x''))[-8:] }}{{ 1000 | random}}winapp'
+ win_plan_name: '{{ (resource_prefix | replace(''-'',''x''))[-8:] }}winplan'
+ linux_plan_name: '{{ (resource_group_secondary | replace(''-'',''x''))[-8:] }}linplan'
+ slot1_name: stage1
+- name: Create a windows web app with non-exist app service plan
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}1'
+ plan:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_plan_name }}'
+ is_linux: false
+ sku: S1
+- name: Create a windows web app with existing app service plan
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}2'
+ plan: '{{ win_plan_name }}'
+- name: stop the web app
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}2'
+ plan: '{{ win_plan_name }}'
+ app_state: stopped
+- name: assert output changed
+ assert:
+ that: output.changed
+- name: Create a windows web app with existing app service plan, try to update some root level params
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}3'
+ plan: '{{ win_plan_name }}'
+ dns_registration: true
+ https_only: true
+ tags:
+ testwebapptag: test
+- name: get web app with resource group and tag
+ azure_rm_webapp_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}3'
+ tags:
+ - testwebapptag
+ register: output
+- assert:
+ that:
+ - output.webapps | length == 1
+- name: Create a win web app with java run time specific
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}4'
+ plan: '{{ win_plan_name }}'
+ frameworks:
+ - name: java
+ version: '1.8'
+ settings:
+ java_container: Tomcat
+ java_container_version: '8.0'
+ app_settings:
+ testkey: testvalue
+- name: assert the web app was created
+ assert:
+ that: output.changed
+- name: get web app with name
+ azure_rm_webapp_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}4'
+ register: output
+- assert:
+ that:
+ - output.webapps | length == 1
+ - output.webapps[0].app_settings | length == 1
+ - output.webapps[0].frameworks | length > 1
+- name: Update app settings and framework
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}4'
+ plan: '{{ win_plan_name }}'
+ frameworks:
+ - name: java
+ version: '1.7'
+ settings:
+ java_container: Tomcat
+ java_container_version: '8.5'
+ app_settings:
+ testkey2: testvalue2
+- name: Assert the web app was updated
+ assert:
+ that:
+ - output.changed
+- name: get web app with name
+ azure_rm_webapp_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}4'
+ register: output
+- name: Assert updating
+ assert:
+ that:
+ - output.webapps[0].app_settings | length == 2
+ - output.webapps[0].app_settings['testkey'] == 'testvalue'
+ - output.webapps[0].app_settings['testkey2'] == 'testvalue2'
+- name: get web app with return publishing profile
+ azure_rm_webapp_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}4'
+ return_publish_profile: true
+ register: output
+- assert:
+ that:
+ - output.webapps | length == 1
+ - output.webapps[0].publishing_username != ""
+ - output.webapps[0].publishing_password != ""
+- name: Purge all existing app settings
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}4'
+ plan: '{{ win_plan_name }}'
+ purge_app_settings: true
+- name: Assert the web app was updated
+ assert:
+ that: output.changed
+- name: Create a win web app with python run time and php run time
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}5'
+ plan: '{{ win_plan_name }}'
+ frameworks:
+ - name: python
+ version: '2.7'
+ - name: node
+ version: '6.6'
+ - name: php
+ version: '7.0'
+- name: Assert the web app was created
+ assert:
+ that: output.changed
+- name: Create a docker web app with some app settings
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}6'
+ plan:
+ resource_group: '{{ linux_app_plan_resource_group }}'
+ name: '{{ linux_plan_name }}'
+ is_linux: true
+ sku: S1
+ number_of_workers: 1
+ container_settings:
+ name: ansible/ansible:ubuntu1404
+- name: Assert the web app was created
+ assert:
+ that: output.changed
+- name: Create a docker web app with private acr registry
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}7'
+ plan:
+ resource_group: '{{ linux_app_plan_resource_group }}'
+ name: '{{ linux_plan_name }}'
+ container_settings:
+ name: ansible/ansible:ubuntu1404
+ registry_server_url: test.io
+ registry_server_user: user
+ registry_server_password: password
+- name: Assert the web app was created
+ assert:
+ that: output.changed
+- name: Create a linux web app with nodejs framework
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}8'
+ plan:
+ resource_group: '{{ linux_app_plan_resource_group }}'
+ name: '{{ linux_plan_name }}'
+ frameworks:
+ - name: node
+ version: '6.6'
+- name: Should be idempotent with linux web app created
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}8'
+ plan:
+ resource_group: '{{ linux_app_plan_resource_group }}'
+ name: '{{ linux_plan_name }}'
+ frameworks:
+ - name: node
+ version: '6.6'
+- assert:
+ that: not output.changed
+- name: Update nodejs framework
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}8'
+ plan:
+ resource_group: '{{ linux_app_plan_resource_group }}'
+ name: '{{ linux_plan_name }}'
+ frameworks:
+ - name: node
+ version: '6.9'
+- name: Assert the web app was created
+ assert:
+ that: output.changed
+- name: Create a linux web app with deployment source github
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}10'
+ plan:
+ resource_group: '{{ linux_app_plan_resource_group }}'
+ name: '{{ linux_plan_name }}'
+ deployment_source:
+ url: https://github.com/test/test
+ branch: master
+ scm_type: GitHub
+- name: Assert the web app was created
+ assert:
+ that: output.changed
+- name: Delete web app
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}8'
+ state: absent
+- name: Assert the web app was deleted
+ assert:
+ that: output.changed
+- name: assert error that java is mutually exclusive with frameworks
+ register: fail_win_java_version_mutual_exclusive
+ failed_when: fail_win_java_version_mutual_exclusive.msg != "Java is mutually exclusive with other frameworks."
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}11'
+ plan: '{{ win_plan_name }}'
+ frameworks:
+ - name: python
+ version: '2.7'
+ - name: java
+ version: '1.8'
+- name: assert error when linux web app, only can specify one framework
+ register: fail_linux_one_framework_only
+ failed_when: fail_linux_one_framework_only.msg != "Can specify one framework only for Linux web app."
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ linux_plan_name }}12'
+ plan:
+ resource_group: '{{ linux_app_plan_resource_group }}'
+ name: '{{ linux_plan_name }}'
+ frameworks:
+ - name: python
+ version: '2.7'
+ - name: node
+ version: '6.6'
+- name: Create a linux web app with java tomcat container
+ register: output
+ azure.azcollection.azure_rm_webapp:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}13'
+ plan:
+ resource_group: '{{ linux_app_plan_resource_group }}'
+ name: '{{ linux_plan_name }}'
+ frameworks:
+ - name: java
+ version: '8'
+ settings:
+ java_container: tomcat
+ java_container_version: '8.5'
+- name: Assert the web app was created
+ assert:
+ that: output.changed
+- name: Get facts with publish profile
+ azure_rm_webapp_facts:
+ resource_group: '{{ resource_group }}'
+ name: '{{ win_app_name }}13'
+ no_log: true
+ register: facts
+- name: Assert publish profile returned
+ assert:
+ that:
+ - facts.webapps[0].ftp_publish_url != ''
+- name: Create a webapp slot (Check mode)
+ check_mode: true
+ register: output
+ azure.azcollection.azure_rm_webappslot:
+ resource_group: '{{ resource_group }}'
+ webapp_name: '{{ win_app_name }}13'
+ name: '{{ slot1_name }}'
+ configuration_source: '{{ win_app_name }}13'
+ app_settings:
+ testkey: testvalue
+- name: Assert slot check mode creation
+ assert:
+ that:
+ - output.changed
+- name: Create a webapp slot
+ register: output
+ azure.azcollection.azure_rm_webappslot:
+ resource_group: '{{ resource_group }}'
+ webapp_name: '{{ win_app_name }}13'
+ name: '{{ slot1_name }}'
+ configuration_source: '{{ win_app_name }}13'
+ app_settings:
+ testkey: testvalueslot
+- name: Assert slot creation
+ assert:
+ that:
+ - output.changed
+- name: Update webapp slot (idempotence)
+ register: output
+ azure.azcollection.azure_rm_webappslot:
+ resource_group: '{{ resource_group }}'
+ webapp_name: '{{ win_app_name }}13'
+ name: '{{ slot1_name }}'
+ app_settings:
+ testkey: testvalueslot
+- name: Assert idempotence
+ assert:
+ that:
+ - not output.changed
+- name: Update webapp slot
+ register: output
+ azure.azcollection.azure_rm_webappslot:
+ resource_group: '{{ resource_group }}'
+ webapp_name: '{{ win_app_name }}13'
+ name: '{{ slot1_name }}'
+ frameworks:
+ - name: node
+ version: '10.1'
+ app_settings:
+ testkey: testvalue2
+- name: Assert updating
+ assert:
+ that:
+ - output.changed
+- name: Swap webapp slot
+ register: output
+ azure.azcollection.azure_rm_webappslot:
+ resource_group: '{{ resource_group }}'
+ webapp_name: '{{ win_app_name }}13'
+ name: '{{ slot1_name }}'
+ swap:
+ action: swap
+- name: Assert swap
+ assert:
+ that:
+ - output.changed
+- name: Stop webapp slot
+ register: output
+ azure.azcollection.azure_rm_webappslot:
+ resource_group: '{{ resource_group }}'
+ webapp_name: '{{ win_app_name }}13'
+ name: '{{ slot1_name }}'
+ app_state: stopped
+- name: Assert stopped
+ assert:
+ that:
+ - output.changed
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/setup_azure/aliases b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/setup_azure/aliases
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/integration/targets/setup_azure/aliases
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/requirements.yml b/collections-debian-merged/ansible_collections/community/azure/tests/requirements.yml
new file mode 100644
index 00000000..30c143c3
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/requirements.yml
@@ -0,0 +1,3 @@
+integration_tests_dependencies:
+- azure.azcollection
+unit_tests_dependencies: []
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/sanity/ignore-2.10.txt b/collections-debian-merged/ansible_collections/community/azure/tests/sanity/ignore-2.10.txt
new file mode 100644
index 00000000..9393be22
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/sanity/ignore-2.10.txt
@@ -0,0 +1,270 @@
+plugins/modules/azure_rm_aks_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_aks_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_aks_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_aks_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_aksversion_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_aksversion_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_aksversion_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_applicationsecuritygroup_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_applicationsecuritygroup_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_applicationsecuritygroup_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_applicationsecuritygroup_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_appserviceplan_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_appserviceplan_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_appserviceplan_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_appserviceplan_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_automationaccount_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_automationaccount_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_automationaccount_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_autoscale_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_autoscale_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_autoscale_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_autoscale_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_availabilityset_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_availabilityset_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_availabilityset_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_availabilityset_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_cdnendpoint_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_cdnendpoint_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_cdnendpoint_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_cdnendpoint_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_cdnendpoint_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_cdnprofile_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_cdnprofile_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_cdnprofile_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_cdnprofile_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_containerinstance_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_containerinstance_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_containerinstance_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_containerinstance_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_containerregistry_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_containerregistry_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_containerregistry_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_containerregistry_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_cosmosdbaccount_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_cosmosdbaccount_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_cosmosdbaccount_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_cosmosdbaccount_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_deployment_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_deployment_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_deployment_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_deployment_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlab_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_devtestlab_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlab_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_devtestlab_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlabarmtemplate_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlabarmtemplate_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_devtestlabarmtemplate_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlabartifact_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlabartifact_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_devtestlabartifact_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlabartifactsource_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_devtestlabartifactsource_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlabartifactsource_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_devtestlabartifactsource_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlabcustomimage_info.py validate-modules:doc-required-mismatch
+plugins/modules/azure_rm_devtestlabcustomimage_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_devtestlabcustomimage_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlabcustomimage_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_devtestlabcustomimage_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlabenvironment_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_devtestlabenvironment_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlabenvironment_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_devtestlabenvironment_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlabpolicy_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_devtestlabpolicy_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlabpolicy_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_devtestlabpolicy_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlabschedule_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_devtestlabschedule_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlabschedule_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_devtestlabschedule_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlabvirtualmachine_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_devtestlabvirtualmachine_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlabvirtualmachine_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_devtestlabvirtualmachine_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_devtestlabvirtualnetwork_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_devtestlabvirtualnetwork_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_dnsrecordset_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_dnsrecordset_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_dnsrecordset_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_dnsrecordset_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_dnszone_info.py validate-modules:doc-type-does-not-match-spec
+plugins/modules/azure_rm_dnszone_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_dnszone_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_dnszone_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_dnszone_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_dnszone_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_functionapp_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_functionapp_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_functionapp_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_functionapp_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_hdinsightcluster_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_hdinsightcluster_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_hdinsightcluster_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_hdinsightcluster_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_hdinsightcluster_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_image_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_image_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_image_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_image_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_image_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_loadbalancer_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_loadbalancer_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_loadbalancer_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_loadbalancer_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_lock_info.py validate-modules:doc-required-mismatch
+plugins/modules/azure_rm_lock_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_lock_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_loganalyticsworkspace_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_loganalyticsworkspace_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_loganalyticsworkspace_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_loganalyticsworkspace_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_manageddisk.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_manageddisk.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_manageddisk.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_manageddisk_info.py validate-modules:doc-type-does-not-match-spec
+plugins/modules/azure_rm_manageddisk_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_manageddisk_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_manageddisk_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_mariadbconfiguration_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_mariadbconfiguration_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_mariadbconfiguration_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_mariadbdatabase_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_mariadbdatabase_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_mariadbfirewallrule_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_mariadbfirewallrule_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_mariadbserver_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_mariadbserver_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_mariadbserver_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_mysqlconfiguration_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_mysqlconfiguration_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_mysqlconfiguration_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_mysqldatabase_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_mysqldatabase_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_mysqlfirewallrule_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_mysqlfirewallrule_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_mysqlserver_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_mysqlserver_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_mysqlserver_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_networkinterface_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_networkinterface_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_networkinterface_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_networkinterface_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_networkinterface_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_postgresqlconfiguration_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_postgresqlconfiguration_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_postgresqlconfiguration_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_postgresqldatabase_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_postgresqldatabase_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_postgresqlfirewallrule_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_postgresqlfirewallrule_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_postgresqlserver_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_postgresqlserver_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_postgresqlserver_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_publicipaddress_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_publicipaddress_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_publicipaddress_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_publicipaddress_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_rediscache_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_rediscache_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_rediscache_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_rediscache_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_resource_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_resource_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_resource_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_resource_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_resourcegroup_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_resourcegroup_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_resourcegroup_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_resourcegroup_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_roleassignment_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_roleassignment_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_roleassignment_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_roledefinition_info.py validate-modules:invalid-ansiblemodule-schema
+plugins/modules/azure_rm_roledefinition_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_roledefinition_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_roledefinition_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_roledefinition_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_routetable_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_routetable_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_routetable_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_routetable_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_securitygroup_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_securitygroup_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_securitygroup_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_securitygroup_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_servicebus_info.py validate-modules:doc-required-mismatch
+plugins/modules/azure_rm_servicebus_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_servicebus_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_servicebus_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_servicebus_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_sqldatabase_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_sqldatabase_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_sqldatabase_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_sqldatabase_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_sqlfirewallrule_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_sqlfirewallrule_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_sqlfirewallrule_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_sqlserver_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_sqlserver_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_sqlserver_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_storageaccount_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_storageaccount_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_storageaccount_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_storageaccount_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_storageaccount_info.py validate-modules:return-syntax-error
+plugins/modules/azure_rm_subnet_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_subnet_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_subnet_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_trafficmanagerendpoint_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_trafficmanagerendpoint_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_trafficmanagerendpoint_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_trafficmanagerprofile_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_trafficmanagerprofile_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_trafficmanagerprofile_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_trafficmanagerprofile_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualmachine_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_virtualmachine_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualmachine_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualmachine_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualmachineextension.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualmachineextension.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualmachineextension.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualmachineextension_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_virtualmachineextension_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualmachineextension_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualmachineextension_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualmachineimage_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualmachineimage_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualmachineimage_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualmachinescaleset.py validate-modules:doc-required-mismatch
+plugins/modules/azure_rm_virtualmachinescaleset.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_virtualmachinescaleset.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualmachinescaleset.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualmachinescaleset.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualmachinescaleset_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_virtualmachinescaleset_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualmachinescaleset_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualmachinescaleset_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualmachinescalesetextension_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualmachinescalesetextension_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualmachinescalesetextension_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualmachinescalesetinstance_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_virtualmachinescalesetinstance_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualmachinescalesetinstance_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualmachinescalesetinstance_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualnetwork_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_virtualnetwork_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualnetwork_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualnetwork_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_virtualnetworkpeering_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_virtualnetworkpeering_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_virtualnetworkpeering_info.py validate-modules:required_if-unknown-key
+plugins/modules/azure_rm_webapp_info.py validate-modules:parameter-list-no-elements
+plugins/modules/azure_rm_webapp_info.py validate-modules:parameter-type-not-in-doc
+plugins/modules/azure_rm_webapp_info.py validate-modules:required_if-requirements-unknown
+plugins/modules/azure_rm_webapp_info.py validate-modules:required_if-unknown-key
+tests/utils/shippable/check_matrix.py replace-urlopen
+tests/utils/shippable/timing.py shebang
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/sanity/requirements.txt b/collections-debian-merged/ansible_collections/community/azure/tests/sanity/requirements.txt
new file mode 100644
index 00000000..3e3a9669
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/sanity/requirements.txt
@@ -0,0 +1,4 @@
+packaging # needed for update-bundled and changelog
+sphinx ; python_version >= '3.5' # docs build requires python 3+
+sphinx-notfound-page ; python_version >= '3.5' # docs build requires python 3+
+straight.plugin ; python_version >= '3.5' # needed for hacking/build-ansible.py which will host changelog generation and requires python 3+
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/utils/ado/ado.sh b/collections-debian-merged/ansible_collections/community/azure/tests/utils/ado/ado.sh
new file mode 100755
index 00000000..55d7f66d
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/utils/ado/ado.sh
@@ -0,0 +1,124 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+group="${args[0]}"
+
+command -v python
+python -V
+
+if [ "$2" = "2.7" ]
+then
+ command -v pip
+ pip --version
+ pip list --disable-pip-version-check
+else
+ command -v pip3
+ pip3 --version
+ pip3 list --disable-pip-version-check
+fi
+
+export PATH="${PWD}/bin:${PATH}"
+export PYTHONIOENCODING="UTF-8"
+export LC_ALL="en_US.utf-8"
+
+if [ "$2" = "2.7" ]
+then
+ pip install virtualenv
+ virtualenv --python /usr/bin/python2.7 ~/ansible-venv
+else
+ pip3 install virtualenv
+ virtualenv --python /usr/bin/python"$2" ~/ansible-venv
+fi
+
+set +ux
+. ~/ansible-venv/bin/activate
+set -ux
+
+if [ "$2" = "2.7" ]
+then
+ if [ "$3" = "devel" ]
+ then
+ pip install git+https://github.com/ansible/ansible.git@devel --disable-pip-version-check
+ else
+ git clone https://github.com/ansible/ansible.git
+ cd "ansible"
+ git checkout "stable-$3"
+ source hacking/env-setup
+ pip install paramiko PyYAML Jinja2 httplib2 six
+ fi
+else
+ if [ "$3" = "devel" ]
+ then
+ pip3 install git+https://github.com/ansible/ansible.git@devel --disable-pip-version-check
+ else
+ git clone https://github.com/ansible/ansible.git
+ cd "ansible"
+ git checkout "stable-$3"
+ source hacking/env-setup
+ pip3 install paramiko PyYAML Jinja2 httplib2 six
+ fi
+fi
+
+TEST_DIR="${HOME}/.ansible/ansible_collections/azure/azcollection"
+mkdir -p "${TEST_DIR}"
+cp -aT "${SHIPPABLE_BUILD_DIR}" "${TEST_DIR}"
+cd "${TEST_DIR}"
+mkdir -p shippable/testresults
+
+if [ "$2" = "2.7" ]
+then
+ pip install --upgrade pip
+ pip install -I -r "${TEST_DIR}/requirements-azure.txt"
+ pip3 install setuptools
+ pip3 install -I -r "${TEST_DIR}/sanity-requirements-azure.txt"
+ pip3 list
+else
+ pip3 install -I -r "${TEST_DIR}/requirements-azure.txt"
+ pip3 install -I -r "${TEST_DIR}/sanity-requirements-azure.txt"
+ pip3 list
+fi
+
+timeout=60
+
+if [ "$4" = "all" ]
+then
+ echo "All module need test"
+else
+ path_dir="${TEST_DIR}/tests/integration/targets/"
+ for item in "$path_dir"*
+ do
+ if [ "${item}" = "$path_dir""$4" ]
+ then
+ echo "PASS"
+ else
+ echo " " >> "${item}"/aliases
+ echo "disabled" >> "${item}"/aliases
+ fi
+ done
+fi
+echo '--------------------------------------------'
+ansible --version
+echo '--------------------------------------------'
+
+ansible-test env --dump --show --timeout "${timeout}" --color -v
+
+cat <<EOF >> "${TEST_DIR}"/tests/integration/cloud-config-azure.ini
+[default]
+AZURE_CLIENT_ID:${AZURE_CLIENT_ID}
+AZURE_SECRET:${AZURE_SECRET}
+AZURE_SUBSCRIPTION_ID:${AZURE_SUBSCRIPTION_ID}
+AZURE_TENANT:${AZURE_TENANT}
+RESOURCE_GROUP:${RESOURCE_GROUP}
+RESOURCE_GROUP_SECONDARY:${RESOURCE_GROUP_SECONDARY}
+EOF
+
+if [ "sanity" = "${group}" ]
+then
+ ansible-test sanity --color -v --junit
+else
+ ansible-test integration --color -v --retry-on-error "shippable/azure/group${group}/" --allow-destructive
+fi
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/azure.sh b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/azure.sh
new file mode 100755
index 00000000..d76c3228
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/azure.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+cloud="${args[0]}"
+python="${args[1]}"
+group="${args[2]}"
+
+target="shippable/${cloud}/group${group}/"
+
+stage="${S:-prod}"
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --remote-terminate always --remote-stage "${stage}" \
+ --docker --python "${python}"
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/check_matrix.py b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/check_matrix.py
new file mode 100755
index 00000000..fb559466
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/check_matrix.py
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+"""Verify the currently executing Shippable test matrix matches the one defined in the "shippable.yml" file."""
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import datetime
+import json
+import os
+import re
+import sys
+import time
+
+try:
+ from typing import NoReturn
+except ImportError:
+ NoReturn = None
+
+try:
+ # noinspection PyCompatibility
+ from urllib2 import urlopen # pylint: disable=ansible-bad-import-from
+except ImportError:
+ # noinspection PyCompatibility
+ from urllib.request import urlopen
+
+
+def main(): # type: () -> None
+ """Main entry point."""
+ repo_full_name = os.environ['REPO_FULL_NAME']
+ required_repo_full_name = 'ansible-collections/community.azure'
+
+ if repo_full_name != required_repo_full_name:
+ sys.stderr.write('Skipping matrix check on repo "%s" which is not "%s".\n' % (repo_full_name, required_repo_full_name))
+ return
+
+ with open('shippable.yml', 'rb') as yaml_file:
+ yaml = yaml_file.read().decode('utf-8').splitlines()
+
+ defined_matrix = [match.group(1) for match in [re.search(r'^ *- env: T=(.*)$', line) for line in yaml] if match and match.group(1) != 'none']
+
+ if not defined_matrix:
+ fail('No matrix entries found in the "shippable.yml" file.',
+ 'Did you modify the "shippable.yml" file?')
+
+ run_id = os.environ['SHIPPABLE_BUILD_ID']
+ sleep = 1
+ jobs = []
+
+ for attempts_remaining in range(4, -1, -1):
+ try:
+ jobs = json.loads(urlopen('https://api.shippable.com/jobs?runIds=%s' % run_id).read())
+
+ if not isinstance(jobs, list):
+ raise Exception('Shippable run %s data is not a list.' % run_id)
+
+ break
+ except Exception as ex:
+ if not attempts_remaining:
+ fail('Unable to retrieve Shippable run %s matrix.' % run_id,
+ str(ex))
+
+ sys.stderr.write('Unable to retrieve Shippable run %s matrix: %s\n' % (run_id, ex))
+ sys.stderr.write('Trying again in %d seconds...\n' % sleep)
+ time.sleep(sleep)
+ sleep *= 2
+
+ if len(jobs) != len(defined_matrix):
+ if len(jobs) == 1:
+ hint = '\n\nMake sure you do not use the "Rebuild with SSH" option.'
+ else:
+ hint = ''
+
+ fail('Shippable run %s has %d jobs instead of the expected %d jobs.' % (run_id, len(jobs), len(defined_matrix)),
+ 'Try re-running the entire matrix.%s' % hint)
+
+ actual_matrix = dict((job.get('jobNumber'), dict(tuple(line.split('=', 1)) for line in job.get('env', [])).get('T', '')) for job in jobs)
+ errors = [(job_number, test, actual_matrix.get(job_number)) for job_number, test in enumerate(defined_matrix, 1) if actual_matrix.get(job_number) != test]
+
+ if len(errors):
+ error_summary = '\n'.join('Job %s expected "%s" but found "%s" instead.' % (job_number, expected, actual) for job_number, expected, actual in errors)
+
+ fail('Shippable run %s has a job matrix mismatch.' % run_id,
+ 'Try re-running the entire matrix.\n\n%s' % error_summary)
+
+
+def fail(message, output): # type: (str, str) -> NoReturn
+ # Include a leading newline to improve readability on Shippable "Tests" tab.
+ # Without this, the first line becomes indented.
+ output = '\n' + output.strip()
+
+ timestamp = datetime.datetime.utcnow().replace(microsecond=0).isoformat()
+
+ # hack to avoid requiring junit-xml, which isn't pre-installed on Shippable outside our test containers
+ xml = '''
+<?xml version="1.0" encoding="utf-8"?>
+<testsuites disabled="0" errors="1" failures="0" tests="1" time="0.0">
+\t<testsuite disabled="0" errors="1" failures="0" file="None" log="None" name="ansible-test" skipped="0" tests="1" time="0" timestamp="%s" url="None">
+\t\t<testcase classname="timeout" name="timeout">
+\t\t\t<error message="%s" type="error">%s</error>
+\t\t</testcase>
+\t</testsuite>
+</testsuites>
+''' % (timestamp, message, output)
+
+ path = 'shippable/testresults/check-matrix.xml'
+ dir_path = os.path.dirname(path)
+
+ if not os.path.exists(dir_path):
+ os.makedirs(dir_path)
+
+ with open(path, 'w') as junit_fd:
+ junit_fd.write(xml.lstrip())
+
+ sys.stderr.write(message + '\n')
+ sys.stderr.write(output + '\n')
+
+ sys.exit(1)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/cloud.sh b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/cloud.sh
new file mode 100755
index 00000000..d76c3228
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/cloud.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+cloud="${args[0]}"
+python="${args[1]}"
+group="${args[2]}"
+
+target="shippable/${cloud}/group${group}/"
+
+stage="${S:-prod}"
+
+# shellcheck disable=SC2086
+ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
+ --remote-terminate always --remote-stage "${stage}" \
+ --docker --python "${python}"
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/sanity.sh b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/sanity.sh
new file mode 100755
index 00000000..c216220e
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/sanity.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+group="${args[1]}"
+
+if [ "${BASE_BRANCH:-}" ]; then
+ base_branch="origin/${BASE_BRANCH}"
+else
+ base_branch=""
+fi
+
+if [ "${group}" == "extra" ]; then
+ # ansible-galaxy -vvv collection install community.internal_test_tools
+ git clone --single-branch --depth 1 https://github.com/ansible-collections/community.internal_test_tools.git ../internal_test_tools
+
+ ../internal_test_tools/tools/run.py --color
+ exit
+fi
+
+# shellcheck disable=SC2086
+ansible-test sanity --color -v --junit ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
+ --docker --base-branch "${base_branch}" \
+ --allow-disabled
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/shippable.sh b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/shippable.sh
new file mode 100755
index 00000000..1f9672d4
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/shippable.sh
@@ -0,0 +1,202 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eux
+
+declare -a args
+IFS='/:' read -ra args <<< "$1"
+
+ansible_version="${args[0]}"
+script="${args[1]}"
+
+function join {
+ local IFS="$1";
+ shift;
+ echo "$*";
+}
+
+test="$(join / "${args[@]:1}")"
+
+docker images ansible/ansible
+docker images quay.io/ansible/*
+docker ps
+
+for container in $(docker ps --format '{{.Image}} {{.ID}}' | grep -v '^drydock/' | sed 's/^.* //'); do
+ docker rm -f "${container}" || true # ignore errors
+done
+
+docker ps
+
+if [ -d /home/shippable/cache/ ]; then
+ ls -la /home/shippable/cache/
+fi
+
+command -v python
+python -V
+
+function retry
+{
+ # shellcheck disable=SC2034
+ for repetition in 1 2 3; do
+ set +e
+ "$@"
+ result=$?
+ set -e
+ if [ ${result} == 0 ]; then
+ return ${result}
+ fi
+ echo "@* -> ${result}"
+ done
+ echo "Command '@*' failed 3 times!"
+ exit -1
+}
+
+command -v pip
+pip --version
+pip list --disable-pip-version-check
+if [ "${ansible_version}" == "devel" ]; then
+ retry pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
+else
+ retry pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check
+fi
+
+export ANSIBLE_COLLECTIONS_PATHS="${HOME}/.ansible"
+SHIPPABLE_RESULT_DIR="$(pwd)/shippable"
+TEST_DIR="${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/community/azure"
+mkdir -p "${TEST_DIR}"
+cp -aT "${SHIPPABLE_BUILD_DIR}" "${TEST_DIR}"
+cd "${TEST_DIR}"
+
+# START: HACK install dependencies
+retry ansible-galaxy -vvv collection install azure.azcollection
+
+# END: HACK
+
+export PYTHONIOENCODING='utf-8'
+
+if [ "${JOB_TRIGGERED_BY_NAME:-}" == "nightly-trigger" ]; then
+ COVERAGE=yes
+ COMPLETE=yes
+fi
+
+if [ -n "${COVERAGE:-}" ]; then
+ # on-demand coverage reporting triggered by setting the COVERAGE environment variable to a non-empty value
+ export COVERAGE="--coverage"
+elif [[ "${COMMIT_MESSAGE}" =~ ci_coverage ]]; then
+ # on-demand coverage reporting triggered by having 'ci_coverage' in the latest commit message
+ export COVERAGE="--coverage"
+else
+ # on-demand coverage reporting disabled (default behavior, always-on coverage reporting remains enabled)
+ export COVERAGE="--coverage-check"
+fi
+
+if [ -n "${COMPLETE:-}" ]; then
+ # disable change detection triggered by setting the COMPLETE environment variable to a non-empty value
+ export CHANGED=""
+elif [[ "${COMMIT_MESSAGE}" =~ ci_complete ]]; then
+ # disable change detection triggered by having 'ci_complete' in the latest commit message
+ export CHANGED=""
+else
+ # enable change detection (default behavior)
+ export CHANGED="--changed"
+fi
+
+if [ "${IS_PULL_REQUEST:-}" == "true" ]; then
+ # run unstable tests which are targeted by focused changes on PRs
+ export UNSTABLE="--allow-unstable-changed"
+else
+ # do not run unstable tests outside PRs
+ export UNSTABLE=""
+fi
+
+# remove empty core/extras module directories from PRs created prior to the repo-merge
+find plugins -type d -empty -print -delete
+
+function cleanup
+{
+ # for complete on-demand coverage generate a report for all files with no coverage on the "sanity/5" job so we only have one copy
+ if [ "${COVERAGE}" == "--coverage" ] && [ "${CHANGED}" == "" ] && [ "${test}" == "sanity/5" ]; then
+ stub="--stub"
+ # trigger coverage reporting for stubs even if no other coverage data exists
+ mkdir -p tests/output/coverage/
+ else
+ stub=""
+ fi
+
+ if [ -d tests/output/coverage/ ]; then
+ if find tests/output/coverage/ -mindepth 1 -name '.*' -prune -o -print -quit | grep -q .; then
+ process_coverage='yes' # process existing coverage files
+ elif [ "${stub}" ]; then
+ process_coverage='yes' # process coverage when stubs are enabled
+ else
+ process_coverage=''
+ fi
+
+ if [ "${process_coverage}" ]; then
+ # use python 3.7 for coverage to avoid running out of memory during coverage xml processing
+ # only use it for coverage to avoid the additional overhead of setting up a virtual environment for a potential no-op job
+ virtualenv --python /usr/bin/python3.7 ~/ansible-venv
+ set +ux
+ . ~/ansible-venv/bin/activate
+ set -ux
+
+ # shellcheck disable=SC2086
+ ansible-test coverage xml --color -v --requirements --group-by command --group-by version ${stub:+"$stub"}
+ cp -a tests/output/reports/coverage=*.xml "$SHIPPABLE_RESULT_DIR/codecoverage/"
+
+ if [ "${ansible_version}" != "2.9" ]; then
+ # analyze and capture code coverage aggregated by integration test target
+ ansible-test coverage analyze targets generate -v "$SHIPPABLE_RESULT_DIR/testresults/coverage-analyze-targets.json"
+ fi
+
+ # upload coverage report to codecov.io only when using complete on-demand coverage
+ if [ "${COVERAGE}" == "--coverage" ] && [ "${CHANGED}" == "" ]; then
+ for file in tests/output/reports/coverage=*.xml; do
+ flags="${file##*/coverage=}"
+ flags="${flags%-powershell.xml}"
+ flags="${flags%.xml}"
+ # remove numbered component from stub files when converting to tags
+ flags="${flags//stub-[0-9]*/stub}"
+ flags="${flags//=/,}"
+ flags="${flags//[^a-zA-Z0-9_,]/_}"
+
+ bash <(curl -s https://codecov.io/bash) \
+ -f "${file}" \
+ -F "${flags}" \
+ -n "${test}" \
+ -t 47041dbd-4bef-43b8-8873-4c6a1a8a3711 \
+ -X coveragepy \
+ -X gcov \
+ -X fix \
+ -X search \
+ -X xcode \
+ || echo "Failed to upload code coverage report to codecov.io: ${file}"
+ done
+ fi
+ fi
+ fi
+
+ if [ -d tests/output/junit/ ]; then
+ cp -aT tests/output/junit/ "$SHIPPABLE_RESULT_DIR/testresults/"
+ fi
+
+ if [ -d tests/output/data/ ]; then
+ cp -a tests/output/data/ "$SHIPPABLE_RESULT_DIR/testresults/"
+ fi
+
+ if [ -d tests/output/bot/ ]; then
+ cp -aT tests/output/bot/ "$SHIPPABLE_RESULT_DIR/testresults/"
+ fi
+}
+
+trap cleanup EXIT
+
+if [[ "${COVERAGE:-}" == "--coverage" ]]; then
+ timeout=60
+else
+ timeout=50
+fi
+
+ansible-test env --dump --show --timeout "${timeout}" --color -v
+
+"tests/utils/shippable/check_matrix.py"
+"tests/utils/shippable/${script}.sh" "${test}"
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/timing.py b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/timing.py
new file mode 100755
index 00000000..fb538271
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/timing.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3.7
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import sys
+import time
+
+start = time.time()
+
+sys.stdin.reconfigure(errors='surrogateescape')
+sys.stdout.reconfigure(errors='surrogateescape')
+
+for line in sys.stdin:
+ seconds = time.time() - start
+ sys.stdout.write('%02d:%02d %s' % (seconds // 60, seconds % 60, line))
+ sys.stdout.flush()
diff --git a/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/timing.sh b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/timing.sh
new file mode 100755
index 00000000..77e25783
--- /dev/null
+++ b/collections-debian-merged/ansible_collections/community/azure/tests/utils/shippable/timing.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -o pipefail -eu
+
+"$@" 2>&1 | "$(dirname "$0")/timing.py"