зеркало из https://github.com/Azure/azure_modules.git
Merged changes of Azure modules from Ansible repo
This commit is contained in:
Родитель
a6adb1c006
Коммит
cf95e50c9c
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"lib/ansible/module_utils/azure_rm_common.py": "41778a8e1259993cc87c3ddc328de7d00e4d3eb2",
|
||||
"lib/ansible/modules/cloud/azure": "bf108ee7bfc0270715fe26d143bc5885eb398fb5",
|
||||
"packaging/requirements/requirements-azure.txt": "b4732dd2e6db5ff193a8b013ebe73a56f7ca373d",
|
||||
"test/integration/targets": "a6f6256a0a2f886262ff92c3b789abb0bac73d74"
|
||||
"lib/ansible/module_utils/azure_rm_common.py": "52a665e224a82b09cb26436d29a753dc8f7facad",
|
||||
"lib/ansible/modules/cloud/azure": "68f9cd14cbbafdf426cc7f2f3a40a5b6c709ed11",
|
||||
"packaging/requirements/requirements-azure.txt": "68fa03138c719377b754dc1bbd083529297d38b3",
|
||||
"test/integration/targets": "2ebeadfc143449d4408a59cfd4b5fe4fca9880ef"
|
||||
}
|
|
@ -71,7 +71,6 @@ azure_aks:
|
|||
type: list
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
try:
|
||||
|
@ -107,11 +106,6 @@ class AzureRMManagedClusterInfo(AzureRMModuleBase):
|
|||
self.tags = None
|
||||
self.show_kubeconfig = None
|
||||
|
||||
module = AnsibleModule(self.module_args)
|
||||
is_old_facts = module._name == 'azure_rm_aks_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_aks_facts' module has been renamed to 'azure_rm_aks_info'", version='2.13')
|
||||
|
||||
super(AzureRMManagedClusterInfo, self).__init__(
|
||||
derived_arg_spec=self.module_args,
|
||||
supports_tags=False,
|
||||
|
@ -120,6 +114,10 @@ class AzureRMManagedClusterInfo(AzureRMModuleBase):
|
|||
|
||||
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])
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ azure_aks_versions:
|
|||
type: list
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
try:
|
||||
|
@ -84,11 +83,6 @@ class AzureRMAKSVersion(AzureRMModuleBase):
|
|||
self.location = None
|
||||
self.version = None
|
||||
|
||||
module = AnsibleModule(self.module_args)
|
||||
is_old_facts = module._name == 'azure_rm_aksversion_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_aksversion_facts' module has been renamed to 'azure_rm_aksversion_info'", version='2.13')
|
||||
|
||||
super(AzureRMAKSVersion, self).__init__(
|
||||
derived_arg_spec=self.module_args,
|
||||
supports_tags=False,
|
||||
|
@ -97,6 +91,10 @@ class AzureRMAKSVersion(AzureRMModuleBase):
|
|||
|
||||
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])
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ applicationsecuritygroups:
|
|||
sample: Succeeded
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
try:
|
||||
|
@ -130,12 +129,6 @@ class AzureRMApplicationSecurityGroupInfo(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(changed=False)
|
||||
|
||||
module = AnsibleModule(self.module_arg_spec)
|
||||
is_old_facts = module._name == 'azure_rm_applicationsecuritygroup_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_applicationsecuritygroup_facts' module has been renamed to 'azure_rm_applicationsecuritygroup_info'",
|
||||
version='2.13')
|
||||
|
||||
super(AzureRMApplicationSecurityGroupInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
|
||||
supports_check_mode=False,
|
||||
supports_tags=False)
|
||||
|
@ -143,6 +136,11 @@ class AzureRMApplicationSecurityGroupInfo(AzureRMModuleBase):
|
|||
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])
|
||||
|
|
|
@ -126,7 +126,6 @@ except Exception:
|
|||
# This is handled in azure_rm_common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
AZURE_OBJECT_CLASS = 'AppServicePlan'
|
||||
|
@ -149,17 +148,16 @@ class AzureRMAppServicePlanInfo(AzureRMModuleBase):
|
|||
self.tags = None
|
||||
self.info_level = None
|
||||
|
||||
module = AnsibleModule(self.module_arg_spec)
|
||||
is_old_facts = module._name == 'azure_rm_appserviceplan_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_appserviceplan_facts' module has been renamed to 'azure_rm_appserviceplan_info'", version='2.13')
|
||||
|
||||
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])
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_automationaccount_facts
|
||||
module: azure_rm_automationaccount_info
|
||||
version_added: '2.9'
|
||||
short_description: Get Azure automation account facts
|
||||
description:
|
||||
|
@ -61,7 +61,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get details of an automation account
|
||||
azure_rm_automationaccount_facts:
|
||||
azure_rm_automationaccount_info:
|
||||
name: Testing
|
||||
resource_group: myResourceGroup
|
||||
list_statistics: yes
|
||||
|
@ -69,11 +69,11 @@ EXAMPLES = '''
|
|||
list_keys: yes
|
||||
|
||||
- name: List automation account in a resource group
|
||||
azure_rm_automationaccount_facts:
|
||||
azure_rm_automationaccount_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: List automation account in a resource group
|
||||
azure_rm_automationaccount_facts:
|
||||
azure_rm_automationaccount_info:
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
@ -246,7 +246,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMAutomationAccountFacts(AzureRMModuleBase):
|
||||
class AzureRMAutomationAccountInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -278,9 +278,15 @@ class AzureRMAutomationAccountFacts(AzureRMModuleBase):
|
|||
self.list_statistics = None
|
||||
self.list_usages = None
|
||||
self.list_keys = None
|
||||
super(AzureRMAutomationAccountFacts, self).__init__(self.module_arg_spec, supports_tags=False, facts_module=True)
|
||||
|
||||
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])
|
||||
|
||||
|
@ -370,7 +376,7 @@ class AzureRMAutomationAccountFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMAutomationAccountFacts()
|
||||
AzureRMAutomationAccountInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -114,7 +114,6 @@ autoscales:
|
|||
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
@ -228,14 +227,14 @@ class AzureRMAutoScaleInfo(AzureRMModuleBase):
|
|||
self.name = None
|
||||
self.tags = None
|
||||
|
||||
module = AnsibleModule(self.module_arg_spec)
|
||||
is_old_facts = module._name == 'azure_rm_autoscale_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_autoscale_facts' module has been renamed to 'azure_rm_autoscale_info'", version='2.13')
|
||||
|
||||
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])
|
||||
|
||||
|
|
|
@ -105,7 +105,6 @@ azure_availabilityset:
|
|||
sample: { env: sandbox }
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
try:
|
||||
|
@ -130,7 +129,7 @@ class AzureRMAvailabilitySetInfo(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(
|
||||
changed=False,
|
||||
ansible_facts=dict(
|
||||
ansible_info=dict(
|
||||
azure_availabilitysets=[]
|
||||
)
|
||||
)
|
||||
|
@ -139,11 +138,6 @@ class AzureRMAvailabilitySetInfo(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
module = AnsibleModule(self.module_args)
|
||||
is_old_facts = module._name == 'azure_rm_availabilityset_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_availabilityset_facts' module has been renamed to 'azure_rm_availabilityset_info'", version='2.13')
|
||||
|
||||
super(AzureRMAvailabilitySetInfo, self).__init__(
|
||||
derived_arg_spec=self.module_args,
|
||||
supports_tags=False,
|
||||
|
@ -152,15 +146,19 @@ class AzureRMAvailabilitySetInfo(AzureRMModuleBase):
|
|||
|
||||
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_facts']['azure_availabilitysets'] = self.get_item()
|
||||
self.results['ansible_info']['azure_availabilitysets'] = self.get_item()
|
||||
else:
|
||||
self.results['ansible_facts']['azure_availabilitysets'] = self.list_items()
|
||||
self.results['ansible_info']['azure_availabilitysets'] = self.list_items()
|
||||
|
||||
return self.results
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_cdnendpoint_facts
|
||||
module: azure_rm_cdnendpoint_info
|
||||
|
||||
version_added: "2.8"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get Azure CDN endpoint facts
|
||||
|
||||
|
@ -49,12 +49,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for all endpoints in CDN profile
|
||||
azure_rm_cdnendpoint_facts:
|
||||
azure_rm_cdnendpoint_info:
|
||||
resource_group: myResourceGroup
|
||||
profile_name: myCDNProfile
|
||||
|
||||
- name: Get facts of specific CDN endpoint
|
||||
azure_rm_cdnendpoint_facts:
|
||||
azure_rm_cdnendpoint_info:
|
||||
resource_group: myResourceGroup
|
||||
profile_name: myCDNProfile
|
||||
name: myEndpoint1
|
||||
|
@ -180,7 +180,7 @@ import re
|
|||
AZURE_OBJECT_CLASS = 'endpoints'
|
||||
|
||||
|
||||
class AzureRMCdnEndpointFacts(AzureRMModuleBase):
|
||||
class AzureRMCdnEndpointInfo(AzureRMModuleBase):
|
||||
"""Utility class to get Azure Azure CDN endpoint facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -208,7 +208,7 @@ class AzureRMCdnEndpointFacts(AzureRMModuleBase):
|
|||
self.profile_name = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMCdnEndpointFacts, self).__init__(
|
||||
super(AzureRMCdnEndpointInfo, self).__init__(
|
||||
derived_arg_spec=self.module_args,
|
||||
supports_tags=False,
|
||||
facts_module=True
|
||||
|
@ -216,6 +216,10 @@ class AzureRMCdnEndpointFacts(AzureRMModuleBase):
|
|||
|
||||
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])
|
||||
|
||||
|
@ -304,7 +308,7 @@ class AzureRMCdnEndpointFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMCdnEndpointFacts()
|
||||
AzureRMCdnEndpointInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -14,9 +14,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_cdnprofile_facts
|
||||
module: azure_rm_cdnprofile_info
|
||||
|
||||
version_added: "2.8"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get Azure CDN profile facts
|
||||
|
||||
|
@ -44,15 +44,15 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one CDN profile
|
||||
azure_rm_cdnprofile_facts:
|
||||
azure_rm_cdnprofile_info:
|
||||
name: Testing
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all CDN profiles
|
||||
azure_rm_cdnprofile_facts:
|
||||
azure_rm_cdnprofile_info:
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_cdnprofile_facts:
|
||||
azure_rm_cdnprofile_info:
|
||||
tags:
|
||||
- Environment:Test
|
||||
'''
|
||||
|
@ -129,7 +129,7 @@ import re
|
|||
AZURE_OBJECT_CLASS = 'profiles'
|
||||
|
||||
|
||||
class AzureRMCdnprofileFacts(AzureRMModuleBase):
|
||||
class AzureRMCdnprofileInfo(AzureRMModuleBase):
|
||||
"""Utility class to get Azure CDN profile facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -150,7 +150,7 @@ class AzureRMCdnprofileFacts(AzureRMModuleBase):
|
|||
self.tags = None
|
||||
self.cdn_client = None
|
||||
|
||||
super(AzureRMCdnprofileFacts, self).__init__(
|
||||
super(AzureRMCdnprofileInfo, self).__init__(
|
||||
derived_arg_spec=self.module_args,
|
||||
supports_tags=False,
|
||||
facts_module=True
|
||||
|
@ -158,6 +158,10 @@ class AzureRMCdnprofileFacts(AzureRMModuleBase):
|
|||
|
||||
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])
|
||||
|
||||
|
@ -257,7 +261,7 @@ class AzureRMCdnprofileFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMCdnprofileFacts()
|
||||
AzureRMCdnprofileInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_containerinstance_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_containerinstance_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Container Instance facts
|
||||
description:
|
||||
- Get facts of Container Instance.
|
||||
|
@ -43,12 +43,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get specific Container Instance facts
|
||||
azure_rm_containerinstance_facts:
|
||||
azure_rm_containerinstance_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myContainer
|
||||
|
||||
- name: List Container Instances in a specified resource group name
|
||||
azure_rm_containerinstance_facts:
|
||||
azure_rm_containerinstance_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -184,7 +184,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMContainerInstanceFacts(AzureRMModuleBase):
|
||||
class AzureRMContainerInstanceInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -206,9 +206,15 @@ class AzureRMContainerInstanceFacts(AzureRMModuleBase):
|
|||
)
|
||||
self.resource_group = None
|
||||
self.name = None
|
||||
super(AzureRMContainerInstanceFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
|
||||
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])
|
||||
|
||||
|
@ -308,7 +314,7 @@ class AzureRMContainerInstanceFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMContainerInstanceFacts()
|
||||
AzureRMContainerInstanceInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_containerregistry_facts
|
||||
version_added: "2.7"
|
||||
module: azure_rm_containerregistry_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Container Registry facts
|
||||
description:
|
||||
- Get facts for Container Registry.
|
||||
|
@ -48,12 +48,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Registry
|
||||
azure_rm_containerregistry_facts:
|
||||
azure_rm_containerregistry_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myRegistry
|
||||
|
||||
- name: List instances of Registry
|
||||
azure_rm_containerregistry_facts:
|
||||
azure_rm_containerregistry_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -150,7 +150,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMContainerRegistryFacts(AzureRMModuleBase):
|
||||
class AzureRMContainerRegistryInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -176,9 +176,15 @@ class AzureRMContainerRegistryFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.name = None
|
||||
self.retrieve_credentials = False
|
||||
super(AzureRMContainerRegistryFacts, self).__init__(self.module_arg_spec, supports_tags=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])
|
||||
|
||||
|
@ -270,7 +276,7 @@ class AzureRMContainerRegistryFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMContainerRegistryFacts()
|
||||
AzureRMContainerRegistryInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_cosmosdbaccount_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_cosmosdbaccount_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Cosmos DB Account facts
|
||||
description:
|
||||
- Get facts of Azure Cosmos DB Account.
|
||||
|
@ -53,12 +53,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Database Account
|
||||
azure_rm_cosmosdbaccount_facts:
|
||||
azure_rm_cosmosdbaccount_info:
|
||||
resource_group: myResourceGroup
|
||||
name: testaccount
|
||||
|
||||
- name: List instances of Database Account
|
||||
azure_rm_cosmosdbaccousnt_facts:
|
||||
azure_rm_cosmosdbaccousnt_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -357,7 +357,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMCosmosDBAccountFacts(AzureRMModuleBase):
|
||||
class AzureRMCosmosDBAccountInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -389,9 +389,14 @@ class AzureRMCosmosDBAccountFacts(AzureRMModuleBase):
|
|||
self.retrieve_keys = None
|
||||
self.retrieve_connection_strings = None
|
||||
|
||||
super(AzureRMCosmosDBAccountFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -508,7 +513,7 @@ class AzureRMCosmosDBAccountFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMCosmosDBAccountFacts()
|
||||
AzureRMCosmosDBAccountInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_deployment_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_deployment_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Deployment facts
|
||||
description:
|
||||
- Get facts of Azure Deployment.
|
||||
|
@ -40,7 +40,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Deployment
|
||||
azure_rm_deployment_facts:
|
||||
azure_rm_deployment_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myDeployment
|
||||
'''
|
||||
|
@ -135,7 +135,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDeploymentFacts(AzureRMModuleBase):
|
||||
class AzureRMDeploymentInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
self.module_arg_spec = dict(
|
||||
resource_group=dict(
|
||||
|
@ -151,9 +151,15 @@ class AzureRMDeploymentFacts(AzureRMModuleBase):
|
|||
)
|
||||
self.resource_group = None
|
||||
self.name = None
|
||||
super(AzureRMDeploymentFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
|
||||
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])
|
||||
|
||||
|
@ -237,7 +243,7 @@ class AzureRMDeploymentFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDeploymentFacts()
|
||||
AzureRMDeploymentInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlab_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlab_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure DevTest Lab facts
|
||||
description:
|
||||
- Get facts of Azure DevTest Lab.
|
||||
|
@ -25,12 +25,15 @@ 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
|
||||
|
@ -41,14 +44,14 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: List instances of DevTest Lab by resource group
|
||||
azure_rm_devtestlab_facts:
|
||||
azure_rm_devtestlab_info:
|
||||
resource_group: testrg
|
||||
|
||||
- name: List instances of DevTest Lab in subscription
|
||||
azure_rm_devtestlab_facts:
|
||||
azure_rm_devtestlab_info:
|
||||
|
||||
- name: Get instance of DevTest Lab
|
||||
azure_rm_devtestlab_facts:
|
||||
azure_rm_devtestlab_info:
|
||||
resource_group: testrg
|
||||
name: testlab
|
||||
'''
|
||||
|
@ -151,7 +154,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDevTestLabFacts(AzureRMModuleBase):
|
||||
class AzureRMDevTestLabInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -173,9 +176,13 @@ class AzureRMDevTestLabFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMDevTestLabFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -258,7 +265,7 @@ class AzureRMDevTestLabFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDevTestLabFacts()
|
||||
AzureRMDevTestLabInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlabarmtemplate_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlabarmtemplate_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure DevTest Lab ARM Template facts
|
||||
description:
|
||||
- Get facts of Azure DevTest Lab ARM Template.
|
||||
|
@ -26,17 +26,21 @@ options:
|
|||
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
|
||||
|
@ -48,7 +52,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get information on DevTest Lab ARM Template
|
||||
azure_rm_devtestlabarmtemplate_facts:
|
||||
azure_rm_devtestlabarmtemplate_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
artifact_source_name: public environment repo
|
||||
|
@ -117,7 +121,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDtlArmTemplateFacts(AzureRMModuleBase):
|
||||
class AzureRMDtlArmTemplateInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -146,9 +150,13 @@ class AzureRMDtlArmTemplateFacts(AzureRMModuleBase):
|
|||
self.lab_name = None
|
||||
self.artifact_source_name = None
|
||||
self.name = None
|
||||
super(AzureRMDtlArmTemplateFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -211,7 +219,7 @@ class AzureRMDtlArmTemplateFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDtlArmTemplateFacts()
|
||||
AzureRMDtlArmTemplateInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlabartifact_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlabartifact_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure DevTest Lab Artifact facts
|
||||
description:
|
||||
- Get facts of Azure DevTest Lab Artifact.
|
||||
|
@ -26,17 +26,21 @@ options:
|
|||
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
|
||||
|
@ -48,7 +52,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of DevTest Lab Artifact
|
||||
azure_rm_devtestlabartifact_facts:
|
||||
azure_rm_devtestlabartifact_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
artifact_source_name: myArtifactSource
|
||||
|
@ -142,7 +146,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMArtifactFacts(AzureRMModuleBase):
|
||||
class AzureRMArtifactInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -171,7 +175,7 @@ class AzureRMArtifactFacts(AzureRMModuleBase):
|
|||
self.lab_name = None
|
||||
self.artifact_source_name = None
|
||||
self.name = None
|
||||
super(AzureRMArtifactFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
super(AzureRMArtifactInfo, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
|
||||
def exec_module(self, **kwargs):
|
||||
for key in self.module_arg_spec:
|
||||
|
@ -239,7 +243,7 @@ class AzureRMArtifactFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMArtifactFacts()
|
||||
AzureRMArtifactInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlabartifactsource_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlabartifactsource_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure DevTest Lab Artifact Source facts
|
||||
description:
|
||||
- Get facts of Azure DevTest Lab Artifact Source.
|
||||
|
@ -26,16 +26,20 @@ options:
|
|||
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
|
||||
|
@ -47,7 +51,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of DevTest Lab Artifact Source
|
||||
azure_rm_devtestlabartifactsource_facts:
|
||||
azure_rm_devtestlabartifactsource_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
name: myArtifactSource
|
||||
|
@ -146,7 +150,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDtlArtifactSourceFacts(AzureRMModuleBase):
|
||||
class AzureRMDtlArtifactSourceInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -174,9 +178,14 @@ class AzureRMDtlArtifactSourceFacts(AzureRMModuleBase):
|
|||
self.lab_name = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMDtlArtifactSourceFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -242,7 +251,7 @@ class AzureRMDtlArtifactSourceFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDtlArtifactSourceFacts()
|
||||
AzureRMDtlArtifactSourceInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlabcustomimage_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlabcustomimage_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure DevTest Lab Custom Image facts
|
||||
description:
|
||||
- Get facts of Azure Azure DevTest Lab Custom Image.
|
||||
|
@ -26,16 +26,20 @@ options:
|
|||
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
|
||||
|
@ -47,13 +51,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Custom Image
|
||||
azure_rm_devtestlabcustomimage_facts:
|
||||
azure_rm_devtestlabcustomimage_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
name: myImage
|
||||
|
||||
- name: List instances of Custom Image in the lab
|
||||
azure_rm_devtestlabcustomimage_facts:
|
||||
azure_rm_devtestlabcustomimage_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
name: myImage
|
||||
|
@ -123,7 +127,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDtlCustomImageFacts(AzureRMModuleBase):
|
||||
class AzureRMDtlCustomImageInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -152,9 +156,13 @@ class AzureRMDtlCustomImageFacts(AzureRMModuleBase):
|
|||
self.lab_name = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMDtlCustomImageFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -214,7 +222,7 @@ class AzureRMDtlCustomImageFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDtlCustomImageFacts()
|
||||
AzureRMDtlCustomImageInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlabenvironment_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlabenvironment_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Environment facts
|
||||
description:
|
||||
- Get facts of Azure Environment.
|
||||
|
@ -26,20 +26,25 @@ options:
|
|||
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
|
||||
|
@ -51,7 +56,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Environment
|
||||
azure_rm_devtestlabenvironment_facts:
|
||||
azure_rm_devtestlabenvironment_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
user_name: myUser
|
||||
|
@ -128,7 +133,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDtlEnvironmentFacts(AzureRMModuleBase):
|
||||
class AzureRMDtlEnvironmentInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -161,9 +166,13 @@ class AzureRMDtlEnvironmentFacts(AzureRMModuleBase):
|
|||
self.user_name = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMDtlEnvironmentFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -229,7 +238,7 @@ class AzureRMDtlEnvironmentFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDtlEnvironmentFacts()
|
||||
AzureRMDtlEnvironmentInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlabpolicy_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlabpolicy_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure DTL Policy facts
|
||||
description:
|
||||
- Get facts of Azure DTL Policy.
|
||||
|
@ -26,20 +26,25 @@ options:
|
|||
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
|
||||
|
@ -51,7 +56,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Policy
|
||||
azure_rm_devtestlabpolicy_facts:
|
||||
azure_rm_devtestlabpolicy_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
policy_set_name: myPolicySet
|
||||
|
@ -127,7 +132,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDtlPolicyFacts(AzureRMModuleBase):
|
||||
class AzureRMDtlPolicyInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -160,9 +165,13 @@ class AzureRMDtlPolicyFacts(AzureRMModuleBase):
|
|||
self.policy_set_name = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMDtlPolicyFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -227,7 +236,7 @@ class AzureRMDtlPolicyFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDtlPolicyFacts()
|
||||
AzureRMDtlPolicyInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlabschedule_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlabschedule_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Schedule facts
|
||||
description:
|
||||
- Get facts of Azure Schedule.
|
||||
|
@ -26,16 +26,20 @@ options:
|
|||
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
|
||||
|
@ -47,7 +51,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Schedule
|
||||
azure_rm_devtestlabschedule_facts:
|
||||
azure_rm_devtestlabschedule_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
name: mySchedule
|
||||
|
@ -117,7 +121,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDtlScheduleFacts(AzureRMModuleBase):
|
||||
class AzureRMDtlScheduleInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -145,9 +149,13 @@ class AzureRMDtlScheduleFacts(AzureRMModuleBase):
|
|||
self.lab_name = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMDtlScheduleFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -207,7 +215,7 @@ class AzureRMDtlScheduleFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDtlScheduleFacts()
|
||||
AzureRMDtlScheduleInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlabvirtualmachine_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlabvirtualmachine_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure DevTest Lab Virtual Machine facts
|
||||
description:
|
||||
- Get facts of Azure DevTest Lab Virtual Machine.
|
||||
|
@ -26,16 +26,20 @@ options:
|
|||
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
|
||||
|
@ -47,7 +51,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of DTL Virtual Machine
|
||||
azure_rm_devtestlabvirtualmachine_facts:
|
||||
azure_rm_devtestlabvirtualmachine_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
name: myVm
|
||||
|
@ -212,7 +216,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDtlVirtualMachineFacts(AzureRMModuleBase):
|
||||
class AzureRMDtlVirtualMachineInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -240,9 +244,14 @@ class AzureRMDtlVirtualMachineFacts(AzureRMModuleBase):
|
|||
self.lab_name = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMDtlVirtualMachineFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -313,7 +322,7 @@ class AzureRMDtlVirtualMachineFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDtlVirtualMachineFacts()
|
||||
AzureRMDtlVirtualMachineInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_devtestlabvirtualnetwork_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_devtestlabvirtualnetwork_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure DevTest Lab Virtual Network facts
|
||||
description:
|
||||
- Get facts of Azure DevTest Lab Virtual Network.
|
||||
|
@ -26,13 +26,16 @@ options:
|
|||
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
|
||||
|
@ -44,13 +47,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of DevTest Lab Virtual Network
|
||||
azure_rm_devtestlabvirtualnetwork_facts:
|
||||
azure_rm_devtestlabvirtualnetwork_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
name: myVirtualNetwork
|
||||
|
||||
- name: List all Virtual Networks in DevTest Lab
|
||||
azure_rm_devtestlabvirtualnetwork_facts:
|
||||
azure_rm_devtestlabvirtualnetwork_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
name: myVirtualNetwork
|
||||
|
@ -120,7 +123,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMDevTestLabVirtualNetworkFacts(AzureRMModuleBase):
|
||||
class AzureRMDevTestLabVirtualNetworkInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -144,9 +147,14 @@ class AzureRMDevTestLabVirtualNetworkFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.lab_name = None
|
||||
self.name = None
|
||||
super(AzureRMDevTestLabVirtualNetworkFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -206,7 +214,7 @@ class AzureRMDevTestLabVirtualNetworkFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDevTestLabVirtualNetworkFacts()
|
||||
AzureRMDevTestLabVirtualNetworkInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -13,9 +13,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_dnsrecordset_facts
|
||||
module: azure_rm_dnsrecordset_info
|
||||
|
||||
version_added: "2.4"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get DNS Record Set facts
|
||||
|
||||
|
@ -51,18 +51,18 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one Record Set
|
||||
azure_rm_dnsrecordset_facts:
|
||||
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
|
||||
azure_rm_dnsrecordset_facts:
|
||||
azure_rm_dnsrecordset_info:
|
||||
resource_group: myResourceGroup
|
||||
zone_name: example.com
|
||||
record_type: A
|
||||
- name: Get all record sets in one zone
|
||||
azure_rm_dnsrecordset_facts:
|
||||
azure_rm_dnsrecordset_info:
|
||||
resource_group: myResourceGroup
|
||||
zone_name: example.com
|
||||
'''
|
||||
|
@ -163,7 +163,7 @@ RECORDSET_VALUE_MAP = dict(
|
|||
)
|
||||
|
||||
|
||||
class AzureRMRecordSetFacts(AzureRMModuleBase):
|
||||
class AzureRMRecordSetInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -179,7 +179,7 @@ class AzureRMRecordSetFacts(AzureRMModuleBase):
|
|||
# store the results of the module operation
|
||||
self.results = dict(
|
||||
changed=False,
|
||||
ansible_facts=dict(azure_dnsrecordset=[])
|
||||
ansible_info=dict(azure_dnsrecordset=[])
|
||||
)
|
||||
|
||||
self.relative_name = None
|
||||
|
@ -188,10 +188,14 @@ class AzureRMRecordSetFacts(AzureRMModuleBase):
|
|||
self.record_type = None
|
||||
self.top = None
|
||||
|
||||
super(AzureRMRecordSetFacts, self).__init__(self.module_arg_spec)
|
||||
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])
|
||||
|
||||
|
@ -216,7 +220,8 @@ class AzureRMRecordSetFacts(AzureRMModuleBase):
|
|||
# if there is a zone name listed, then they want all the record sets in a zone
|
||||
results = self.list_zone()
|
||||
|
||||
self.results['ansible_facts']['azure_dnsrecordset'] = self.serialize_list(results)
|
||||
if is_old_facts:
|
||||
self.results['ansible_facts']['azure_dnsrecordset'] = self.serialize_list(results)
|
||||
self.results['dnsrecordsets'] = self.curated_list(results)
|
||||
return self.results
|
||||
|
||||
|
@ -281,7 +286,7 @@ class AzureRMRecordSetFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMRecordSetFacts()
|
||||
AzureRMRecordSetInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -14,9 +14,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_dnszone_facts
|
||||
module: azure_rm_dnszone_info
|
||||
|
||||
version_added: "2.4"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get DNS zone facts
|
||||
|
||||
|
@ -45,16 +45,16 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one zone
|
||||
azure_rm_dnszone_facts:
|
||||
azure_rm_dnszone_info:
|
||||
resource_group: myResourceGroup
|
||||
name: foobar22
|
||||
|
||||
- name: Get facts for all zones in a resource group
|
||||
azure_rm_dnszone_facts:
|
||||
azure_rm_dnszone_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_dnszone_facts:
|
||||
azure_rm_dnszone_info:
|
||||
tags:
|
||||
- testing
|
||||
'''
|
||||
|
@ -137,7 +137,7 @@ except Exception:
|
|||
AZURE_OBJECT_CLASS = 'DnsZone'
|
||||
|
||||
|
||||
class AzureRMDNSZoneFacts(AzureRMModuleBase):
|
||||
class AzureRMDNSZoneInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -151,17 +151,21 @@ class AzureRMDNSZoneFacts(AzureRMModuleBase):
|
|||
# store the results of the module operation
|
||||
self.results = dict(
|
||||
changed=False,
|
||||
ansible_facts=dict(azure_dnszones=[])
|
||||
ansible_info=dict(azure_dnszones=[])
|
||||
)
|
||||
|
||||
self.name = None
|
||||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMDNSZoneFacts, self).__init__(self.module_arg_spec)
|
||||
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])
|
||||
|
||||
|
@ -180,7 +184,7 @@ class AzureRMDNSZoneFacts(AzureRMModuleBase):
|
|||
# all the zones in a subscription
|
||||
results = self.list_items()
|
||||
|
||||
self.results['ansible_facts']['azure_dnszones'] = self.serialize_items(results)
|
||||
self.results['ansible_info']['azure_dnszones'] = self.serialize_items(results)
|
||||
self.results['dnszones'] = self.curated_items(results)
|
||||
|
||||
return self.results
|
||||
|
@ -247,7 +251,7 @@ class AzureRMDNSZoneFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMDNSZoneFacts()
|
||||
AzureRMDNSZoneInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_functionapp_facts
|
||||
version_added: "2.4"
|
||||
module: azure_rm_functionapp_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Function App facts
|
||||
description:
|
||||
- Get facts for one Azure Function App or all Function Apps within a resource group.
|
||||
|
@ -42,16 +42,16 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one Function App
|
||||
azure_rm_functionapp_facts:
|
||||
azure_rm_functionapp_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myfunctionapp
|
||||
|
||||
- name: Get facts for all Function Apps in a resource group
|
||||
azure_rm_functionapp_facts:
|
||||
azure_rm_functionapp_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all Function Apps by tags
|
||||
azure_rm_functionapp_facts:
|
||||
azure_rm_functionapp_info:
|
||||
tags:
|
||||
- testing
|
||||
'''
|
||||
|
@ -108,7 +108,7 @@ except Exception:
|
|||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
|
||||
class AzureRMFunctionAppFacts(AzureRMModuleBase):
|
||||
class AzureRMFunctionAppInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -119,14 +119,14 @@ class AzureRMFunctionAppFacts(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(
|
||||
changed=False,
|
||||
ansible_facts=dict(azure_functionapps=[])
|
||||
ansible_info=dict(azure_functionapps=[])
|
||||
)
|
||||
|
||||
self.name = None
|
||||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMFunctionAppFacts, self).__init__(
|
||||
super(AzureRMFunctionAppInfo, self).__init__(
|
||||
self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True
|
||||
|
@ -134,6 +134,10 @@ class AzureRMFunctionAppFacts(AzureRMModuleBase):
|
|||
|
||||
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])
|
||||
|
||||
|
@ -141,11 +145,11 @@ class AzureRMFunctionAppFacts(AzureRMModuleBase):
|
|||
self.fail("Parameter error: resource group required when filtering by name.")
|
||||
|
||||
if self.name:
|
||||
self.results['ansible_facts']['azure_functionapps'] = self.get_functionapp()
|
||||
self.results['ansible_info']['azure_functionapps'] = self.get_functionapp()
|
||||
elif self.resource_group:
|
||||
self.results['ansible_facts']['azure_functionapps'] = self.list_resource_group()
|
||||
self.results['ansible_info']['azure_functionapps'] = self.list_resource_group()
|
||||
else:
|
||||
self.results['ansible_facts']['azure_functionapps'] = self.list_all()
|
||||
self.results['ansible_info']['azure_functionapps'] = self.list_all()
|
||||
|
||||
return self.results
|
||||
|
||||
|
@ -195,7 +199,7 @@ class AzureRMFunctionAppFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMFunctionAppFacts()
|
||||
AzureRMFunctionAppInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_hdinsightcluster_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_hdinsightcluster_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure HDInsight Cluster facts
|
||||
description:
|
||||
- Get facts of Azure HDInsight Cluster.
|
||||
|
@ -42,12 +42,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of HDInsight Cluster
|
||||
azure_rm_hdinsightcluster_facts:
|
||||
azure_rm_hdinsightcluster_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myCluster
|
||||
|
||||
- name: List instances of HDInsight Cluster
|
||||
azure_rm_hdinsightcluster_facts:
|
||||
azure_rm_hdinsightcluster_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -192,7 +192,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMHDInsightclusterFacts(AzureRMModuleBase):
|
||||
class AzureRMHDInsightclusterInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -215,9 +215,15 @@ class AzureRMHDInsightclusterFacts(AzureRMModuleBase):
|
|||
self.name = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMHDInsightclusterFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -308,7 +314,7 @@ class AzureRMHDInsightclusterFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMHDInsightclusterFacts()
|
||||
AzureRMHDInsightclusterInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,9 +12,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_image_facts
|
||||
module: azure_rm_image_info
|
||||
|
||||
version_added: "2.8"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get facts about azure custom images
|
||||
|
||||
|
@ -42,19 +42,19 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: List images with name
|
||||
azure_rm_image_facts:
|
||||
azure_rm_image_info:
|
||||
name: test-image
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: List images by resource group
|
||||
azure_rm_image_facts:
|
||||
azure_rm_image_info:
|
||||
resource_group: myResourceGroup
|
||||
tags:
|
||||
- testing
|
||||
- foo:bar
|
||||
|
||||
- name: List all available images under current subscription
|
||||
azure_rm_image_facts:
|
||||
azure_rm_image_info:
|
||||
'''
|
||||
|
||||
|
||||
|
@ -179,7 +179,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
|||
AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
|
||||
|
||||
|
||||
class AzureRMImageFacts(AzureRMModuleBase):
|
||||
class AzureRMImageInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
||||
|
@ -198,7 +198,7 @@ class AzureRMImageFacts(AzureRMModuleBase):
|
|||
self.format = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMImageFacts, self).__init__(
|
||||
super(AzureRMImageInfo, self).__init__(
|
||||
derived_arg_spec=self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True
|
||||
|
@ -206,6 +206,10 @@ class AzureRMImageFacts(AzureRMModuleBase):
|
|||
|
||||
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])
|
||||
|
||||
|
@ -296,7 +300,7 @@ class AzureRMImageFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMImageFacts()
|
||||
AzureRMImageInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,9 +15,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_loadbalancer_facts
|
||||
module: azure_rm_loadbalancer_info
|
||||
|
||||
version_added: "2.4"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get load balancer facts
|
||||
|
||||
|
@ -44,19 +44,19 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one load balancer
|
||||
azure_rm_loadbalancer_facts:
|
||||
azure_rm_loadbalancer_info:
|
||||
name: Testing
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all load balancers
|
||||
azure_rm_loadbalancer_facts:
|
||||
azure_rm_loadbalancer_info:
|
||||
|
||||
- name: Get facts for all load balancers in a specific resource group
|
||||
azure_rm_loadbalancer_facts:
|
||||
azure_rm_loadbalancer_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_loadbalancer_facts:
|
||||
azure_rm_loadbalancer_info:
|
||||
tags:
|
||||
- testing
|
||||
'''
|
||||
|
@ -81,7 +81,7 @@ except Exception:
|
|||
AZURE_OBJECT_CLASS = 'LoadBalancer'
|
||||
|
||||
|
||||
class AzureRMLoadBalancerFacts(AzureRMModuleBase):
|
||||
class AzureRMLoadBalancerInfo(AzureRMModuleBase):
|
||||
"""Utility class to get load balancer facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -94,7 +94,7 @@ class AzureRMLoadBalancerFacts(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(
|
||||
changed=False,
|
||||
ansible_facts=dict(
|
||||
ansible_info=dict(
|
||||
azure_loadbalancers=[]
|
||||
)
|
||||
)
|
||||
|
@ -103,7 +103,7 @@ class AzureRMLoadBalancerFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMLoadBalancerFacts, self).__init__(
|
||||
super(AzureRMLoadBalancerInfo, self).__init__(
|
||||
derived_arg_spec=self.module_args,
|
||||
supports_tags=False,
|
||||
facts_module=True
|
||||
|
@ -111,10 +111,14 @@ class AzureRMLoadBalancerFacts(AzureRMModuleBase):
|
|||
|
||||
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_facts']['azure_loadbalancers'] = (
|
||||
self.results['ansible_info']['azure_loadbalancers'] = (
|
||||
self.get_item() if self.name
|
||||
else self.list_items()
|
||||
)
|
||||
|
@ -166,7 +170,7 @@ class AzureRMLoadBalancerFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMLoadBalancerFacts()
|
||||
AzureRMLoadBalancerInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_lock_facts
|
||||
module: azure_rm_lock_info
|
||||
version_added: "2.9"
|
||||
short_description: Manage Azure locks
|
||||
description:
|
||||
|
@ -56,27 +56,27 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get myLock details of myVM
|
||||
azure_rm_lock_facts:
|
||||
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
|
||||
azure_rm_lock_facts:
|
||||
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
|
||||
azure_rm_lock_facts:
|
||||
azure_rm_lock_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: List locks of myResourceGroup
|
||||
azure_rm_lock_facts:
|
||||
azure_rm_lock_info:
|
||||
managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup
|
||||
|
||||
- name: List locks of mySubscription
|
||||
azure_rm_lock_facts:
|
||||
azure_rm_lock_info:
|
||||
|
||||
- name: List locks of mySubscription
|
||||
azure_rm_lock_facts:
|
||||
azure_rm_lock_info:
|
||||
managed_resource_id: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
'''
|
||||
|
||||
|
@ -126,7 +126,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMLockFacts(AzureRMModuleBase):
|
||||
class AzureRMLockInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -150,10 +150,14 @@ class AzureRMLockFacts(AzureRMModuleBase):
|
|||
self._query_parameters = {'api-version': '2016-09-01'}
|
||||
self._header_parameters = {'Content-Type': 'application/json; charset=utf-8'}
|
||||
|
||||
super(AzureRMLockFacts, self).__init__(self.module_arg_spec, facts_module=True, mutually_exclusive=mutually_exclusive, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -212,7 +216,7 @@ class AzureRMLockFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMLockFacts()
|
||||
AzureRMLockInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_loganalyticsworkspace_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_loganalyticsworkspace_info
|
||||
version_added: "2.9"
|
||||
short_description: Get facts of Azure Log Analytics workspaces
|
||||
description:
|
||||
- Get, query Azure Log Analytics workspaces.
|
||||
|
@ -57,7 +57,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Query a workspace
|
||||
azure_rm_loganalyticsworkspace_facts:
|
||||
azure_rm_loganalyticsworkspace_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myLogAnalyticsWorkspace
|
||||
show_intelligence_packs: true
|
||||
|
@ -148,7 +148,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMLogAnalyticsWorkspaceFact(AzureRMModuleBase):
|
||||
class AzureRMLogAnalyticsWorkspaceInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -175,10 +175,15 @@ class AzureRMLogAnalyticsWorkspaceFact(AzureRMModuleBase):
|
|||
self.show_usages = None
|
||||
self.show_management_groups = None
|
||||
|
||||
super(AzureRMLogAnalyticsWorkspaceFact, self).__init__(self.module_arg_spec, supports_tags=False, facts_module=True)
|
||||
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])
|
||||
|
||||
|
@ -257,7 +262,7 @@ class AzureRMLogAnalyticsWorkspaceFact(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMLogAnalyticsWorkspaceFact()
|
||||
AzureRMLogAnalyticsWorkspaceInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -14,9 +14,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: azure_rm_manageddisk_facts
|
||||
module: azure_rm_manageddisk_info
|
||||
|
||||
version_added: "2.4"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get managed disk facts
|
||||
|
||||
|
@ -51,15 +51,15 @@ author:
|
|||
|
||||
EXAMPLES = r'''
|
||||
- name: Get facts for one managed disk
|
||||
azure_rm_manageddisk_facts:
|
||||
azure_rm_manageddisk_info:
|
||||
name: Testing
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all managed disks
|
||||
azure_rm_manageddisk_facts:
|
||||
azure_rm_manageddisk_info:
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_manageddisk_facts:
|
||||
azure_rm_manageddisk_info:
|
||||
tags:
|
||||
- testing
|
||||
'''
|
||||
|
@ -147,7 +147,7 @@ def managed_disk_to_dict(managed_disk):
|
|||
)
|
||||
|
||||
|
||||
class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
||||
class AzureRMManagedDiskInfo(AzureRMModuleBase):
|
||||
"""Utility class to get managed disk facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -163,7 +163,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
|||
),
|
||||
)
|
||||
self.results = dict(
|
||||
ansible_facts=dict(
|
||||
ansible_info=dict(
|
||||
azure_managed_disk=[]
|
||||
)
|
||||
)
|
||||
|
@ -173,7 +173,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
|||
self.source_uri = None
|
||||
self.source_resource_uri = None
|
||||
self.tags = None
|
||||
super(AzureRMManagedDiskFacts, self).__init__(
|
||||
super(AzureRMManagedDiskInfo, self).__init__(
|
||||
derived_arg_spec=self.module_arg_spec,
|
||||
supports_check_mode=True,
|
||||
supports_tags=True)
|
||||
|
@ -182,7 +182,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
|||
for key in self.module_arg_spec:
|
||||
setattr(self, key, kwargs[key])
|
||||
|
||||
self.results['ansible_facts']['azure_managed_disk'] = (
|
||||
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())
|
||||
)
|
||||
|
@ -236,7 +236,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMManagedDiskFacts()
|
||||
AzureRMManagedDiskInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -14,9 +14,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: azure_rm_manageddisk_facts
|
||||
module: azure_rm_manageddisk_info
|
||||
|
||||
version_added: "2.4"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get managed disk facts
|
||||
|
||||
|
@ -51,15 +51,15 @@ author:
|
|||
|
||||
EXAMPLES = r'''
|
||||
- name: Get facts for one managed disk
|
||||
azure_rm_manageddisk_facts:
|
||||
azure_rm_manageddisk_info:
|
||||
name: Testing
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all managed disks
|
||||
azure_rm_manageddisk_facts:
|
||||
azure_rm_manageddisk_info:
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_manageddisk_facts:
|
||||
azure_rm_manageddisk_info:
|
||||
tags:
|
||||
- testing
|
||||
'''
|
||||
|
@ -147,7 +147,7 @@ def managed_disk_to_dict(managed_disk):
|
|||
)
|
||||
|
||||
|
||||
class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
||||
class AzureRMManagedDiskInfo(AzureRMModuleBase):
|
||||
"""Utility class to get managed disk facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -163,7 +163,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
|||
),
|
||||
)
|
||||
self.results = dict(
|
||||
ansible_facts=dict(
|
||||
ansible_info=dict(
|
||||
azure_managed_disk=[]
|
||||
)
|
||||
)
|
||||
|
@ -173,7 +173,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
|||
self.source_uri = None
|
||||
self.source_resource_uri = None
|
||||
self.tags = None
|
||||
super(AzureRMManagedDiskFacts, self).__init__(
|
||||
super(AzureRMManagedDiskInfo, self).__init__(
|
||||
derived_arg_spec=self.module_arg_spec,
|
||||
supports_check_mode=True,
|
||||
supports_tags=True)
|
||||
|
@ -182,7 +182,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
|||
for key in self.module_arg_spec:
|
||||
setattr(self, key, kwargs[key])
|
||||
|
||||
self.results['ansible_facts']['azure_managed_disk'] = (
|
||||
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())
|
||||
)
|
||||
|
@ -236,7 +236,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMManagedDiskFacts()
|
||||
AzureRMManagedDiskInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,8 +16,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_mariadbconfiguration_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_mariadbconfiguration_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure MariaDB Configuration facts
|
||||
description:
|
||||
- Get facts of Azure MariaDB Configuration.
|
||||
|
@ -27,13 +27,16 @@ options:
|
|||
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
|
||||
|
@ -46,13 +49,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get specific setting of MariaDB Server
|
||||
azure_rm_mariadbconfiguration_facts:
|
||||
azure_rm_mariadbconfiguration_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: testserver
|
||||
name: deadlock_timeout
|
||||
|
||||
- name: Get all settings of MariaDB Server
|
||||
azure_rm_mariadbconfiguration_facts:
|
||||
azure_rm_mariadbconfiguration_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
'''
|
||||
|
@ -109,7 +112,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMMariaDbConfigurationFacts(AzureRMModuleBase):
|
||||
class AzureRMMariaDbConfigurationInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -131,9 +134,13 @@ class AzureRMMariaDbConfigurationFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMMariaDbConfigurationFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -202,7 +209,7 @@ class AzureRMMariaDbConfigurationFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMMariaDbConfigurationFacts()
|
||||
AzureRMMariaDbConfigurationInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,8 +16,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_mariadbdatabase_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_mariadbdatabase_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure MariaDB Database facts
|
||||
description:
|
||||
- Get facts of MariaDB Database.
|
||||
|
@ -27,13 +27,16 @@ options:
|
|||
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
|
||||
|
@ -46,13 +49,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of MariaDB Database
|
||||
azure_rm_mariadbdatabase_facts:
|
||||
azure_rm_mariadbdatabase_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
name: database_name
|
||||
|
||||
- name: List instances of MariaDB Database
|
||||
azure_rm_mariadbdatabase_facts:
|
||||
azure_rm_mariadbdatabase_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
'''
|
||||
|
@ -114,7 +117,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMMariaDbDatabaseFacts(AzureRMModuleBase):
|
||||
class AzureRMMariaDbDatabaseInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -137,9 +140,13 @@ class AzureRMMariaDbDatabaseFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMMariaDbDatabaseFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -197,7 +204,7 @@ class AzureRMMariaDbDatabaseFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMMariaDbDatabaseFacts()
|
||||
AzureRMMariaDbDatabaseInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,8 +16,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_mariadbfirewallrule_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_mariadbfirewallrule_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure MariaDB Firewall Rule facts
|
||||
description:
|
||||
- Get facts of Azure MariaDB Firewall Rule.
|
||||
|
@ -27,13 +27,16 @@ options:
|
|||
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
|
||||
|
@ -46,13 +49,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of MariaDB Firewall Rule
|
||||
azure_rm_mariadbfirewallrule_facts:
|
||||
azure_rm_mariadbfirewallrule_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
name: firewall_rule_name
|
||||
|
||||
- name: List instances of MariaDB Firewall Rule
|
||||
azure_rm_mariadbfirewallrule_facts:
|
||||
azure_rm_mariadbfirewallrule_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
'''
|
||||
|
@ -109,7 +112,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMMariaDbFirewallRuleFacts(AzureRMModuleBase):
|
||||
class AzureRMMariaDbFirewallRuleInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -133,9 +136,13 @@ class AzureRMMariaDbFirewallRuleFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMMariaDbFirewallRuleFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -193,7 +200,7 @@ class AzureRMMariaDbFirewallRuleFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMMariaDbFirewallRuleFacts()
|
||||
AzureRMMariaDbFirewallRuleInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,8 +16,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_mariadbserver_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_mariadbserver_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure MariaDB Server facts
|
||||
description:
|
||||
- Get facts of MariaDB Server.
|
||||
|
@ -27,12 +27,15 @@ options:
|
|||
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
|
||||
|
@ -45,12 +48,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of MariaDB Server
|
||||
azure_rm_mariadbserver_facts:
|
||||
azure_rm_mariadbserver_info:
|
||||
resource_group: myResourceGroup
|
||||
name: server_name
|
||||
|
||||
- name: List instances of MariaDB Server
|
||||
azure_rm_mariadbserver_facts:
|
||||
azure_rm_mariadbserver_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -163,7 +166,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMMariaDbServerFacts(AzureRMModuleBase):
|
||||
class AzureRMMariaDbServerInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -185,9 +188,13 @@ class AzureRMMariaDbServerFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMMariaDbServerFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -250,7 +257,7 @@ class AzureRMMariaDbServerFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMMariaDbServerFacts()
|
||||
AzureRMMariaDbServerInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_mysqlconfiguration_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_mysqlconfiguration_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure MySQL Configuration facts
|
||||
description:
|
||||
- Get facts of Azure MySQL Configuration.
|
||||
|
@ -26,13 +26,16 @@ options:
|
|||
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
|
||||
|
@ -44,13 +47,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get specific setting of MySQL Server
|
||||
azure_rm_mysqlconfiguration_facts:
|
||||
azure_rm_mysqlconfiguration_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: testmysqlserver
|
||||
name: deadlock_timeout
|
||||
|
||||
- name: Get all settings of MySQL Server
|
||||
azure_rm_mysqlconfiguration_facts:
|
||||
azure_rm_mysqlconfiguration_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
'''
|
||||
|
@ -107,7 +110,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMMySqlConfigurationFacts(AzureRMModuleBase):
|
||||
class AzureRMMySqlConfigurationInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -129,9 +132,13 @@ class AzureRMMySqlConfigurationFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMMySqlConfigurationFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -200,7 +207,7 @@ class AzureRMMySqlConfigurationFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMMySqlConfigurationFacts()
|
||||
AzureRMMySqlConfigurationInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_mysqldatabase_facts
|
||||
version_added: "2.7"
|
||||
module: azure_rm_mysqldatabase_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure MySQL Database facts
|
||||
description:
|
||||
- Get facts of MySQL Database.
|
||||
|
@ -26,13 +26,16 @@ options:
|
|||
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
|
||||
|
@ -44,13 +47,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of MySQL Database
|
||||
azure_rm_mysqldatabase_facts:
|
||||
azure_rm_mysqldatabase_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
name: database_name
|
||||
|
||||
- name: List instances of MySQL Database
|
||||
azure_rm_mysqldatabase_facts:
|
||||
azure_rm_mysqldatabase_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
'''
|
||||
|
@ -112,7 +115,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMMySqlDatabaseFacts(AzureRMModuleBase):
|
||||
class AzureRMMySqlDatabaseInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -135,9 +138,13 @@ class AzureRMMySqlDatabaseFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMMySqlDatabaseFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -195,7 +202,7 @@ class AzureRMMySqlDatabaseFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMMySqlDatabaseFacts()
|
||||
AzureRMMySqlDatabaseInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_mysqlfirewallrule_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_mysqlfirewallrule_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure MySQL Firewall Rule facts
|
||||
description:
|
||||
- Get facts of Azure MySQL Firewall Rule.
|
||||
|
@ -26,13 +26,16 @@ options:
|
|||
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
|
||||
|
@ -44,13 +47,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of MySQL Firewall Rule
|
||||
azure_rm_mysqlfirewallrule_facts:
|
||||
azure_rm_mysqlfirewallrule_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
name: firewall_rule_name
|
||||
|
||||
- name: List instances of MySQL Firewall Rule
|
||||
azure_rm_mysqlfirewallrule_facts:
|
||||
azure_rm_mysqlfirewallrule_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
'''
|
||||
|
@ -107,7 +110,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMMySqlFirewallRuleFacts(AzureRMModuleBase):
|
||||
class AzureRMMySqlFirewallRuleInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -131,9 +134,13 @@ class AzureRMMySqlFirewallRuleFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMMySqlFirewallRuleFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -191,7 +198,7 @@ class AzureRMMySqlFirewallRuleFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMMySqlFirewallRuleFacts()
|
||||
AzureRMMySqlFirewallRuleInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_mysqlserver_facts
|
||||
version_added: "2.7"
|
||||
module: azure_rm_mysqlserver_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure MySQL Server facts
|
||||
description:
|
||||
- Get facts of MySQL Server.
|
||||
|
@ -26,12 +26,15 @@ options:
|
|||
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
|
||||
|
@ -43,12 +46,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of MySQL Server
|
||||
azure_rm_mysqlserver_facts:
|
||||
azure_rm_mysqlserver_info:
|
||||
resource_group: myResourceGroup
|
||||
name: server_name
|
||||
|
||||
- name: List instances of MySQL Server
|
||||
azure_rm_mysqlserver_facts:
|
||||
azure_rm_mysqlserver_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -161,7 +164,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMMySqlServerFacts(AzureRMModuleBase):
|
||||
class AzureRMMySqlServerInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -183,9 +186,13 @@ class AzureRMMySqlServerFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMMySqlServerFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -248,7 +255,7 @@ class AzureRMMySqlServerFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMMySqlServerFacts()
|
||||
AzureRMMySqlServerInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,9 +16,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_networkinterface_facts
|
||||
module: azure_rm_networkinterface_info
|
||||
|
||||
version_added: "2.1"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get network interface facts
|
||||
|
||||
|
@ -47,16 +47,16 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one network interface
|
||||
azure_rm_networkinterface_facts:
|
||||
azure_rm_networkinterface_info:
|
||||
resource_group: myResourceGroup
|
||||
name: nic001
|
||||
|
||||
- name: Get network interfaces within a resource group
|
||||
azure_rm_networkinterface_facts:
|
||||
azure_rm_networkinterface_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get network interfaces by tag
|
||||
azure_rm_networkinterface_facts:
|
||||
azure_rm_networkinterface_info:
|
||||
resource_group: myResourceGroup
|
||||
tags:
|
||||
- testing
|
||||
|
@ -261,7 +261,7 @@ def nic_to_dict(nic):
|
|||
)
|
||||
|
||||
|
||||
class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
|
||||
class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -273,20 +273,24 @@ class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(
|
||||
changed=False,
|
||||
ansible_facts=dict(azure_networkinterfaces=[])
|
||||
)
|
||||
|
||||
self.name = None
|
||||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMNetworkInterfaceFacts, self).__init__(self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True
|
||||
)
|
||||
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])
|
||||
|
||||
|
@ -302,7 +306,10 @@ class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
|
|||
else:
|
||||
results = self.list_all()
|
||||
|
||||
self.results['ansible_facts']['azure_networkinterfaces'] = self.serialize_nics(results)
|
||||
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
|
||||
|
||||
|
@ -340,7 +347,7 @@ class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMNetworkInterfaceFacts()
|
||||
AzureRMNetworkInterfaceInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_postgresqlconfiguration_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_postgresqlconfiguration_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure PostgreSQL Configuration facts
|
||||
description:
|
||||
- Get facts of Azure PostgreSQL Configuration.
|
||||
|
@ -26,13 +26,16 @@ options:
|
|||
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
|
||||
|
@ -44,13 +47,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get specific setting of PostgreSQL configuration
|
||||
azure_rm_postgresqlconfiguration_facts:
|
||||
azure_rm_postgresqlconfiguration_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: testpostgresqlserver
|
||||
name: deadlock_timeout
|
||||
|
||||
- name: Get all settings of PostgreSQL Configuration
|
||||
azure_rm_postgresqlconfiguration_facts:
|
||||
azure_rm_postgresqlconfiguration_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: testpostgresqlserver
|
||||
'''
|
||||
|
@ -107,7 +110,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMPostgreSQLConfigurationFacts(AzureRMModuleBase):
|
||||
class AzureRMPostgreSQLConfigurationInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -131,9 +134,14 @@ class AzureRMPostgreSQLConfigurationFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMPostgreSQLConfigurationFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -202,7 +210,7 @@ class AzureRMPostgreSQLConfigurationFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMPostgreSQLConfigurationFacts()
|
||||
AzureRMPostgreSQLConfigurationInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_postgresqldatabase_facts
|
||||
version_added: "2.7"
|
||||
module: azure_rm_postgresqldatabase_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure PostgreSQL Database facts
|
||||
description:
|
||||
- Get facts of PostgreSQL Database.
|
||||
|
@ -26,13 +26,16 @@ options:
|
|||
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
|
||||
|
@ -44,13 +47,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of PostgreSQL Database
|
||||
azure_rm_postgresqldatabase_facts:
|
||||
azure_rm_postgresqldatabase_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
name: database_name
|
||||
|
||||
- name: List instances of PostgreSQL Database
|
||||
azure_rm_postgresqldatabase_facts:
|
||||
azure_rm_postgresqldatabase_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
'''
|
||||
|
@ -112,7 +115,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMPostgreSqlDatabasesFacts(AzureRMModuleBase):
|
||||
class AzureRMPostgreSqlDatabasesInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -135,9 +138,13 @@ class AzureRMPostgreSqlDatabasesFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMPostgreSqlDatabasesFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -195,7 +202,7 @@ class AzureRMPostgreSqlDatabasesFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMPostgreSqlDatabasesFacts()
|
||||
AzureRMPostgreSqlDatabasesInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_postgresqlfirewallrule_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_postgresqlfirewallrule_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure PostgreSQL Firewall Rule facts
|
||||
description:
|
||||
- Get facts of Azure PostgreSQL Firewall Rule.
|
||||
|
@ -26,13 +26,16 @@ options:
|
|||
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
|
||||
|
@ -44,13 +47,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of PostgreSQL Firewall Rule
|
||||
azure_rm_postgresqlfirewallrule_facts:
|
||||
azure_rm_postgresqlfirewallrule_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
name: firewall_rule_name
|
||||
|
||||
- name: List instances of PostgreSQL Firewall Rule
|
||||
azure_rm_postgresqlfirewallrule_facts:
|
||||
azure_rm_postgresqlfirewallrule_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
'''
|
||||
|
@ -106,7 +109,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMPostgreSQLFirewallRulesFacts(AzureRMModuleBase):
|
||||
class AzureRMPostgreSQLFirewallRulesInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -130,9 +133,14 @@ class AzureRMPostgreSQLFirewallRulesFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMPostgreSQLFirewallRulesFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -190,7 +198,7 @@ class AzureRMPostgreSQLFirewallRulesFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMPostgreSQLFirewallRulesFacts()
|
||||
AzureRMPostgreSQLFirewallRulesInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_postgresqlserver_facts
|
||||
version_added: "2.7"
|
||||
module: azure_rm_postgresqlserver_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure PostgreSQL Server facts
|
||||
description:
|
||||
- Get facts of PostgreSQL Server.
|
||||
|
@ -26,12 +26,15 @@ options:
|
|||
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
|
||||
|
@ -43,12 +46,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of PostgreSQL Server
|
||||
azure_rm_postgresqlserver_facts:
|
||||
azure_rm_postgresqlserver_info:
|
||||
resource_group: myResourceGroup
|
||||
name: server_name
|
||||
|
||||
- name: List instances of PostgreSQL Server
|
||||
azure_rm_postgresqlserver_facts:
|
||||
azure_rm_postgresqlserver_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -162,7 +165,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMPostgreSqlServersFacts(AzureRMModuleBase):
|
||||
class AzureRMPostgreSqlServersInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -184,9 +187,13 @@ class AzureRMPostgreSqlServersFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMPostgreSqlServersFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -249,7 +256,7 @@ class AzureRMPostgreSqlServersFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMPostgreSqlServersFacts()
|
||||
AzureRMPostgreSqlServersInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,9 +16,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_publicipaddress_facts
|
||||
module: azure_rm_publicipaddress_info
|
||||
|
||||
version_added: "2.1"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get public IP facts
|
||||
|
||||
|
@ -46,12 +46,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one Public IP
|
||||
azure_rm_publicipaddress_facts:
|
||||
azure_rm_publicipaddress_info:
|
||||
resource_group: myResourceGroup
|
||||
name: publicip001
|
||||
|
||||
- name: Get facts for all Public IPs within a resource groups
|
||||
azure_rm_publicipaddress_facts:
|
||||
azure_rm_publicipaddress_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -195,7 +195,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
|||
AZURE_OBJECT_CLASS = 'PublicIp'
|
||||
|
||||
|
||||
class AzureRMPublicIPFacts(AzureRMModuleBase):
|
||||
class AzureRMPublicIPInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -207,18 +207,20 @@ class AzureRMPublicIPFacts(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(
|
||||
changed=False,
|
||||
ansible_facts=dict(azure_publicipaddresses=[])
|
||||
)
|
||||
|
||||
self.name = None
|
||||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMPublicIPFacts, self).__init__(self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True)
|
||||
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])
|
||||
|
@ -236,7 +238,10 @@ class AzureRMPublicIPFacts(AzureRMModuleBase):
|
|||
|
||||
raw = self.filter(result)
|
||||
|
||||
self.results['ansible_facts']['azure_publicipaddresses'] = self.serialize(raw)
|
||||
if is_old_facts:
|
||||
self.results['ansible_facts'] = {
|
||||
'azure_publicipaddresses': self.serialize(raw),
|
||||
}
|
||||
self.results['publicipaddresses'] = self.format(raw)
|
||||
|
||||
return self.results
|
||||
|
@ -309,7 +314,7 @@ class AzureRMPublicIPFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMPublicIPFacts()
|
||||
AzureRMPublicIPInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -14,9 +14,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_rediscache_facts
|
||||
module: azure_rm_rediscache_info
|
||||
|
||||
version_added: "2.8"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get Azure Cache for Redis instance facts
|
||||
|
||||
|
@ -49,18 +49,18 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get Azure Cache for Redis by name
|
||||
azure_rm_rediscache_facts:
|
||||
azure_rm_rediscache_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myRedis
|
||||
|
||||
- name: Get Azure Cache for Redis with access keys by name
|
||||
azure_rm_rediscache_facts:
|
||||
azure_rm_rediscache_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myRedis
|
||||
return_access_keys: true
|
||||
|
||||
- name: Get Azure Cache for Redis in specific resource group
|
||||
azure_rm_rediscache_facts:
|
||||
azure_rm_rediscache_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -202,7 +202,7 @@ except ImportError:
|
|||
import re
|
||||
|
||||
|
||||
class AzureRMRedisCacheFacts(AzureRMModuleBase):
|
||||
class AzureRMRedisCacheInfo(AzureRMModuleBase):
|
||||
"""Utility class to get Azure Cache for Redis facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -232,13 +232,16 @@ class AzureRMRedisCacheFacts(AzureRMModuleBase):
|
|||
|
||||
self._client = None
|
||||
|
||||
super(AzureRMRedisCacheFacts, self).__init__(
|
||||
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])
|
||||
|
@ -344,7 +347,7 @@ class AzureRMRedisCacheFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMRedisCacheFacts()
|
||||
AzureRMRedisCacheInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_resource_facts
|
||||
version_added: "2.6"
|
||||
module: azure_rm_resource_info
|
||||
version_added: "2.9"
|
||||
short_description: Generic facts of Azure resources
|
||||
description:
|
||||
- Obtain facts of any resource using Azure REST API.
|
||||
|
@ -67,7 +67,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get scaleset info
|
||||
azure_rm_resource_facts:
|
||||
azure_rm_resource_info:
|
||||
resource_group: myResourceGroup
|
||||
provider: compute
|
||||
resource_type: virtualmachinescalesets
|
||||
|
@ -75,7 +75,7 @@ EXAMPLES = '''
|
|||
api_version: "2017-12-01"
|
||||
|
||||
- name: Query all the resources in the resource group
|
||||
azure_rm_resource_facts:
|
||||
azure_rm_resource_info:
|
||||
resource_group: "{{ resource_group }}"
|
||||
resource_type: resources
|
||||
'''
|
||||
|
@ -292,7 +292,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMResourceFacts(AzureRMModuleBase):
|
||||
class AzureRMResourceInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -331,9 +331,13 @@ class AzureRMResourceFacts(AzureRMModuleBase):
|
|||
self.resource_type = None
|
||||
self.resource_name = None
|
||||
self.subresource = []
|
||||
super(AzureRMResourceFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -420,7 +424,7 @@ class AzureRMResourceFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMResourceFacts()
|
||||
AzureRMResourceInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_roleassignment_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_roleassignment_info
|
||||
version_added: "2.9"
|
||||
short_description: Gets Azure Role Assignment facts
|
||||
description:
|
||||
- Gets facts of Azure Role Assignment.
|
||||
|
@ -50,11 +50,11 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get role assignments for specific service principal
|
||||
azure_rm_roleassignment_facts:
|
||||
azure_rm_roleassignment_info:
|
||||
assignee: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
|
||||
- name: Get role assignments for specific scope
|
||||
azure_rm_roleassignment_facts:
|
||||
azure_rm_roleassignment_info:
|
||||
scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
'''
|
||||
|
||||
|
@ -127,7 +127,7 @@ def roleassignment_to_dict(assignment):
|
|||
)
|
||||
|
||||
|
||||
class AzureRMRoleAssignmentFacts(AzureRMModuleBase):
|
||||
class AzureRMRoleAssignmentInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -158,12 +158,15 @@ class AzureRMRoleAssignmentFacts(AzureRMModuleBase):
|
|||
|
||||
mutually_exclusive = [['name', 'assignee']]
|
||||
|
||||
super(AzureRMRoleAssignmentFacts, self).__init__(derived_arg_spec=self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
mutually_exclusive=mutually_exclusive)
|
||||
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):
|
||||
|
@ -270,7 +273,7 @@ class AzureRMRoleAssignmentFacts(AzureRMModuleBase):
|
|||
|
||||
def main():
|
||||
"""Main execution"""
|
||||
AzureRMRoleAssignmentFacts()
|
||||
AzureRMRoleAssignmentInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_roledefinition_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_roledefinition_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Role Definition facts
|
||||
description:
|
||||
- Get facts of Azure Role Definition.
|
||||
|
@ -49,11 +49,11 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: List Role Definitions in scope
|
||||
azure_rm_roledefinition_facts:
|
||||
azure_rm_roledefinition_info:
|
||||
scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup
|
||||
|
||||
- name: Get Role Definition by name
|
||||
azure_rm_roledefinition_facts:
|
||||
azure_rm_roledefinition_info:
|
||||
scope: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup
|
||||
name: myRoleDefinition
|
||||
'''
|
||||
|
@ -152,7 +152,7 @@ def roledefinition_to_dict(role):
|
|||
return result
|
||||
|
||||
|
||||
class AzureRMRoleDefinitionFacts(AzureRMModuleBase):
|
||||
class AzureRMRoleDefinitionInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
self.module_arg_spec = dict(
|
||||
scope=dict(
|
||||
|
@ -177,11 +177,14 @@ class AzureRMRoleDefinitionFacts(AzureRMModuleBase):
|
|||
|
||||
self._client = None
|
||||
|
||||
super(AzureRMRoleDefinitionFacts, self).__init__(derived_arg_spec=self.module_arg_spec,
|
||||
supports_tags=False)
|
||||
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):
|
||||
|
@ -300,7 +303,7 @@ class AzureRMRoleDefinitionFacts(AzureRMModuleBase):
|
|||
|
||||
def main():
|
||||
"""Main execution"""
|
||||
AzureRMRoleDefinitionFacts()
|
||||
AzureRMRoleDefinitionInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,9 +15,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_routetable_facts
|
||||
module: azure_rm_routetable_info
|
||||
|
||||
version_added: "2.7"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get route table facts
|
||||
|
||||
|
@ -45,16 +45,16 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one route table
|
||||
azure_rm_routetable_facts:
|
||||
azure_rm_routetable_info:
|
||||
name: Testing
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all route tables
|
||||
azure_rm_routetable_facts:
|
||||
azure_rm_routetable_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_routetable_facts:
|
||||
azure_rm_routetable_info:
|
||||
tags:
|
||||
- testing
|
||||
- foo:bar
|
||||
|
@ -143,7 +143,7 @@ def instance_to_dict(table):
|
|||
)
|
||||
|
||||
|
||||
class AzureRMRouteTableFacts(AzureRMModuleBase):
|
||||
class AzureRMRouteTableInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -162,11 +162,14 @@ class AzureRMRouteTableFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMRouteTableFacts, self).__init__(self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True)
|
||||
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])
|
||||
|
@ -209,7 +212,7 @@ class AzureRMRouteTableFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMRouteTableFacts()
|
||||
AzureRMRouteTableInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,9 +16,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_securitygroup_facts
|
||||
module: azure_rm_securitygroup_info
|
||||
|
||||
version_added: "2.1"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get security group facts
|
||||
|
||||
|
@ -48,18 +48,18 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one security group
|
||||
azure_rm_securitygroup_facts:
|
||||
azure_rm_securitygroup_info:
|
||||
resource_group: myResourceGroup
|
||||
name: secgroup001
|
||||
|
||||
- name: Get facts for all security groups
|
||||
azure_rm_securitygroup_facts:
|
||||
azure_rm_securitygroup_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
azure_securitygroups:
|
||||
securitygroups:
|
||||
description:
|
||||
- List containing security group dicts.
|
||||
returned: always
|
||||
|
@ -235,7 +235,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
|||
AZURE_OBJECT_CLASS = 'NetworkSecurityGroup'
|
||||
|
||||
|
||||
class AzureRMSecurityGroupFacts(AzureRMModuleBase):
|
||||
class AzureRMSecurityGroupInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -247,25 +247,35 @@ class AzureRMSecurityGroupFacts(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(
|
||||
changed=False,
|
||||
ansible_facts=dict(azure_securitygroups=[])
|
||||
)
|
||||
|
||||
self.name = None
|
||||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMSecurityGroupFacts, self).__init__(self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True)
|
||||
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:
|
||||
self.results['ansible_facts']['azure_securitygroups'] = self.get_item()
|
||||
info = self.get_item()
|
||||
else:
|
||||
self.results['ansible_facts']['azure_securitygroups'] = self.list_items()
|
||||
info = self.list_items()
|
||||
|
||||
if is_old_facts:
|
||||
self.results['ansible_facts'] = {
|
||||
'azure_securitygroups': info
|
||||
}
|
||||
self.results['securitygroups'] = info
|
||||
|
||||
return self.results
|
||||
|
||||
|
@ -303,7 +313,7 @@ class AzureRMSecurityGroupFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMSecurityGroupFacts()
|
||||
AzureRMSecurityGroupInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,9 +15,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_servicebus_facts
|
||||
module: azure_rm_servicebus_info
|
||||
|
||||
version_added: "2.8"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get servicebus facts
|
||||
|
||||
|
@ -68,18 +68,18 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get all namespaces under a resource group
|
||||
azure_rm_servicebus_facts:
|
||||
azure_rm_servicebus_info:
|
||||
resource_group: myResourceGroup
|
||||
type: namespace
|
||||
|
||||
- name: Get all topics under a namespace
|
||||
azure_rm_servicebus_facts:
|
||||
azure_rm_servicebus_info:
|
||||
resource_group: myResourceGroup
|
||||
namespace: bar
|
||||
type: topic
|
||||
|
||||
- name: Get a single queue with SAS policies
|
||||
azure_rm_servicebus_facts:
|
||||
azure_rm_servicebus_info:
|
||||
resource_group: myResourceGroup
|
||||
namespace: bar
|
||||
type: queue
|
||||
|
@ -87,7 +87,7 @@ EXAMPLES = '''
|
|||
show_sas_policies: true
|
||||
|
||||
- name: Get all subscriptions under a resource group
|
||||
azure_rm_servicebus_facts:
|
||||
azure_rm_servicebus_info:
|
||||
resource_group: myResourceGroup
|
||||
type: subscription
|
||||
namespace: bar
|
||||
|
@ -402,7 +402,7 @@ def is_valid_timedelta(value):
|
|||
return value
|
||||
|
||||
|
||||
class AzureRMServiceBusFacts(AzureRMModuleBase):
|
||||
class AzureRMServiceBusInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -435,12 +435,15 @@ class AzureRMServiceBusFacts(AzureRMModuleBase):
|
|||
self.topic = None
|
||||
self.show_sas_policies = None
|
||||
|
||||
super(AzureRMServiceBusFacts, self).__init__(self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
required_if=required_if,
|
||||
facts_module=True)
|
||||
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])
|
||||
|
@ -574,7 +577,7 @@ class AzureRMServiceBusFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMServiceBusFacts()
|
||||
AzureRMServiceBusInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_sqldatabase_facts
|
||||
module: azure_rm_sqldatabase_info
|
||||
version_added: "2.8"
|
||||
short_description: Get Azure SQL Database facts
|
||||
description:
|
||||
|
@ -50,19 +50,19 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of SQL Database
|
||||
azure_rm_sqldatabase_facts:
|
||||
azure_rm_sqldatabase_info:
|
||||
resource_group: testrg
|
||||
server_name: testserver
|
||||
name: testdb
|
||||
|
||||
- name: List instances of SQL Database
|
||||
azure_rm_sqldatabase_facts:
|
||||
azure_rm_sqldatabase_info:
|
||||
resource_group: testrg
|
||||
server_name: testserver
|
||||
elastic_pool_name: testep
|
||||
|
||||
- name: List instances of SQL Database
|
||||
azure_rm_sqldatabase_facts:
|
||||
azure_rm_sqldatabase_info:
|
||||
resource_group: testrg
|
||||
server_name: testserver
|
||||
'''
|
||||
|
@ -159,7 +159,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMSqlDatabaseFacts(AzureRMModuleBase):
|
||||
class AzureRMSqlDatabaseInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -190,9 +190,13 @@ class AzureRMSqlDatabaseFacts(AzureRMModuleBase):
|
|||
self.name = None
|
||||
self.elastic_pool_name = None
|
||||
self.tags = None
|
||||
super(AzureRMSqlDatabaseFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -277,7 +281,7 @@ class AzureRMSqlDatabaseFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMSqlDatabaseFacts()
|
||||
AzureRMSqlDatabaseInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_sqlfirewallrule_facts
|
||||
module: azure_rm_sqlfirewallrule_info
|
||||
version_added: "2.8"
|
||||
short_description: Get Azure SQL Firewall Rule facts
|
||||
description:
|
||||
|
@ -44,13 +44,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of SQL Firewall Rule
|
||||
azure_rm_sqlfirewallrule_facts:
|
||||
azure_rm_sqlfirewallrule_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: testserver
|
||||
name: testrule
|
||||
|
||||
- name: List instances of SQL Firewall Rule
|
||||
azure_rm_sqlfirewallrule_facts:
|
||||
azure_rm_sqlfirewallrule_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: testserver
|
||||
'''
|
||||
|
@ -113,7 +113,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMSqlFirewallRuleFacts(AzureRMModuleBase):
|
||||
class AzureRMSqlFirewallRuleInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -136,9 +136,13 @@ class AzureRMSqlFirewallRuleFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.server_name = None
|
||||
self.name = None
|
||||
super(AzureRMSqlFirewallRuleFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -204,7 +208,7 @@ class AzureRMSqlFirewallRuleFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMSqlFirewallRuleFacts()
|
||||
AzureRMSqlFirewallRuleInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_sqlserver_facts
|
||||
version_added: "2.5"
|
||||
module: azure_rm_sqlserver_info
|
||||
version_added: "2.9"
|
||||
short_description: Get SQL Server facts
|
||||
description:
|
||||
- Get facts of SQL Server.
|
||||
|
@ -41,12 +41,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of SQL Server
|
||||
azure_rm_sqlserver_facts:
|
||||
azure_rm_sqlserver_info:
|
||||
resource_group: myResourceGroup
|
||||
server_name: server_name
|
||||
|
||||
- name: List instances of SQL Server
|
||||
azure_rm_sqlserver_facts:
|
||||
azure_rm_sqlserver_info:
|
||||
resource_group: myResourceGroup
|
||||
'''
|
||||
|
||||
|
@ -123,7 +123,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMSqlServerFacts(AzureRMModuleBase):
|
||||
class AzureRMSqlServerInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -142,9 +142,13 @@ class AzureRMSqlServerFacts(AzureRMModuleBase):
|
|||
)
|
||||
self.resource_group = None
|
||||
self.server_name = None
|
||||
super(AzureRMSqlServerFacts, self).__init__(self.module_arg_spec)
|
||||
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])
|
||||
|
||||
|
@ -197,7 +201,7 @@ class AzureRMSqlServerFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMSqlServerFacts()
|
||||
AzureRMSqlServerInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,9 +16,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_storageaccount_facts
|
||||
module: azure_rm_storageaccount_info
|
||||
|
||||
version_added: "2.1"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get storage account facts
|
||||
|
||||
|
@ -62,16 +62,16 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one account
|
||||
azure_rm_storageaccount_facts:
|
||||
azure_rm_storageaccount_info:
|
||||
resource_group: myResourceGroup
|
||||
name: clh0002
|
||||
|
||||
- name: Get facts for all accounts in a resource group
|
||||
azure_rm_storageaccount_facts:
|
||||
azure_rm_storageaccount_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all accounts by tags
|
||||
azure_rm_storageaccount_facts:
|
||||
azure_rm_storageaccount_info:
|
||||
tags:
|
||||
- testing
|
||||
- foo:bar
|
||||
|
@ -358,7 +358,7 @@ from ansible.module_utils._text import to_native
|
|||
AZURE_OBJECT_CLASS = 'StorageAccount'
|
||||
|
||||
|
||||
class AzureRMStorageAccountFacts(AzureRMModuleBase):
|
||||
class AzureRMStorageAccountInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -381,11 +381,14 @@ class AzureRMStorageAccountFacts(AzureRMModuleBase):
|
|||
self.show_connection_string = None
|
||||
self.show_blob_cors = None
|
||||
|
||||
super(AzureRMStorageAccountFacts, self).__init__(self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True)
|
||||
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])
|
||||
|
@ -403,8 +406,10 @@ class AzureRMStorageAccountFacts(AzureRMModuleBase):
|
|||
|
||||
filtered = self.filter_tag(results)
|
||||
|
||||
self.results['ansible_facts']['azure_storageaccounts'] = self.serialize(filtered)
|
||||
self.results['ansible_facts']['storageaccounts'] = self.format_to_dict(filtered)
|
||||
if is_old_facts:
|
||||
self.results['ansible_facts']['azure_storageaccounts'] = self.serialize(filtered)
|
||||
self.results['ansible_facts']['storageaccounts'] = self.format_to_dict(filtered)
|
||||
self.results['storageaccounts'] = self.format_to_dict(filtered)
|
||||
return self.results
|
||||
|
||||
def get_account(self):
|
||||
|
@ -544,7 +549,7 @@ class AzureRMStorageAccountFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMStorageAccountFacts()
|
||||
AzureRMStorageAccountInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_subnet_facts
|
||||
module: azure_rm_subnet_info
|
||||
version_added: "2.8"
|
||||
short_description: Get Azure Subnet facts
|
||||
description:
|
||||
|
@ -44,13 +44,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts of specific subnet
|
||||
azure_rm_subnet_facts:
|
||||
azure_rm_subnet_info:
|
||||
resource_group: myResourceGroup
|
||||
virtual_network_name: myVirtualNetwork
|
||||
name: mySubnet
|
||||
|
||||
- name: List facts for all subnets in virtual network
|
||||
azure_rm_subnet_facts:
|
||||
azure_rm_subnet_info:
|
||||
resource_group: myResourceGroup
|
||||
virtual_network_name: myVirtualNetwork
|
||||
name: mySubnet
|
||||
|
@ -151,7 +151,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMSubnetFacts(AzureRMModuleBase):
|
||||
class AzureRMSubnetInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -174,9 +174,13 @@ class AzureRMSubnetFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.virtual_network_name = None
|
||||
self.name = None
|
||||
super(AzureRMSubnetFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -236,7 +240,7 @@ class AzureRMSubnetFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMSubnetFacts()
|
||||
AzureRMSubnetInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -14,9 +14,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_trafficmanagerendpoint_facts
|
||||
module: azure_rm_trafficmanagerendpoint_info
|
||||
|
||||
version_added: "2.7"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get Azure Traffic Manager endpoint facts
|
||||
|
||||
|
@ -53,12 +53,12 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get endpoints facts of a Traffic Manager profile
|
||||
azure_rm_trafficmanagerendpoint_facts:
|
||||
azure_rm_trafficmanagerendpoint_info:
|
||||
resource_group: myResourceGroup
|
||||
profile_name: Testing
|
||||
|
||||
- name: Get specific endpoint of a Traffic Manager profile
|
||||
azure_rm_trafficmanager_facts:
|
||||
azure_rm_trafficmanager_info:
|
||||
resource_group: myResourceGroup
|
||||
profile_name: Testing
|
||||
name: test_external_endpoint
|
||||
|
@ -185,7 +185,7 @@ def serialize_endpoint(endpoint, resource_group):
|
|||
return result
|
||||
|
||||
|
||||
class AzureRMTrafficManagerEndpointFacts(AzureRMModuleBase):
|
||||
class AzureRMTrafficManagerEndpointInfo(AzureRMModuleBase):
|
||||
"""Utility class to get Azure Traffic Manager Endpoint facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -217,13 +217,17 @@ class AzureRMTrafficManagerEndpointFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.type = None
|
||||
|
||||
super(AzureRMTrafficManagerEndpointFacts, self).__init__(
|
||||
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])
|
||||
|
@ -300,7 +304,7 @@ class AzureRMTrafficManagerEndpointFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMTrafficManagerEndpointFacts()
|
||||
AzureRMTrafficManagerEndpointInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -14,9 +14,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_trafficmanagerprofile_facts
|
||||
module: azure_rm_trafficmanagerprofile_info
|
||||
|
||||
version_added: "2.7"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get Azure Traffic Manager profile facts
|
||||
|
||||
|
@ -44,15 +44,15 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one Traffic Manager profile
|
||||
azure_rm_trafficmanager_facts:
|
||||
azure_rm_trafficmanager_info:
|
||||
name: Testing
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all Traffic Manager profiles
|
||||
azure_rm_trafficmanager_facts:
|
||||
azure_rm_trafficmanager_info:
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_trafficmanager_facts:
|
||||
azure_rm_trafficmanager_info:
|
||||
tags:
|
||||
- Environment:Test
|
||||
'''
|
||||
|
@ -280,7 +280,7 @@ def serialize_endpoint(endpoint):
|
|||
return result
|
||||
|
||||
|
||||
class AzureRMTrafficManagerProfileFacts(AzureRMModuleBase):
|
||||
class AzureRMTrafficManagerProfileInfo(AzureRMModuleBase):
|
||||
"""Utility class to get Azure Traffic Manager profile facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -300,13 +300,16 @@ class AzureRMTrafficManagerProfileFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMTrafficManagerProfileFacts, self).__init__(
|
||||
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])
|
||||
|
@ -412,7 +415,7 @@ class AzureRMTrafficManagerProfileFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMTrafficManagerProfileFacts()
|
||||
AzureRMTrafficManagerProfileInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -17,9 +17,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_virtualmachine_facts
|
||||
module: azure_rm_virtualmachine_info
|
||||
|
||||
version_added: "2.7"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get virtual machine facts
|
||||
|
||||
|
@ -48,16 +48,16 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for all virtual machines of a resource group
|
||||
azure_rm_virtualmachine_facts:
|
||||
azure_rm_virtualmachine_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts by name
|
||||
azure_rm_virtualmachine_facts:
|
||||
azure_rm_virtualmachine_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myVm
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_virtualmachine_facts:
|
||||
azure_rm_virtualmachine_info:
|
||||
resource_group: myResourceGroup
|
||||
tags:
|
||||
- testing
|
||||
|
@ -264,7 +264,7 @@ AZURE_OBJECT_CLASS = 'VirtualMachine'
|
|||
AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
|
||||
|
||||
|
||||
class AzureRMVirtualMachineFacts(AzureRMModuleBase):
|
||||
class AzureRMVirtualMachineInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -283,11 +283,14 @@ class AzureRMVirtualMachineFacts(AzureRMModuleBase):
|
|||
self.name = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMVirtualMachineFacts, self).__init__(self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True)
|
||||
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])
|
||||
|
@ -446,7 +449,7 @@ class AzureRMVirtualMachineFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMVirtualMachineFacts()
|
||||
AzureRMVirtualMachineInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -890,7 +890,7 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
|
|||
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['managed_disk_type']
|
||||
storage_account_type=data_disk.get('managed_disk_type', None)
|
||||
),
|
||||
))
|
||||
vmss_resource.virtual_machine_profile.storage_profile.data_disks = data_disks
|
||||
|
|
|
@ -13,9 +13,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_virtualmachinescaleset_facts
|
||||
module: azure_rm_virtualmachinescaleset_info
|
||||
|
||||
version_added: "2.4"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get Virtual Machine Scale Set facts
|
||||
|
||||
|
@ -55,17 +55,17 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for a virtual machine scale set
|
||||
azure_rm_virtualmachinescaleset_facts:
|
||||
azure_rm_virtualmachinescaleset_info:
|
||||
resource_group: myResourceGroup
|
||||
name: testvmss001
|
||||
format: curated
|
||||
|
||||
- name: Get facts for all virtual networks
|
||||
azure_rm_virtualmachinescaleset_facts:
|
||||
azure_rm_virtualmachinescaleset_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_virtualmachinescaleset_facts:
|
||||
azure_rm_virtualmachinescaleset_info:
|
||||
resource_group: myResourceGroup
|
||||
tags:
|
||||
- testing
|
||||
|
@ -261,7 +261,7 @@ AZURE_OBJECT_CLASS = 'VirtualMachineScaleSet'
|
|||
AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
|
||||
|
||||
|
||||
class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
|
||||
class AzureRMVirtualMachineScaleSetInfo(AzureRMModuleBase):
|
||||
"""Utility class to get virtual machine scale set facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -290,27 +290,34 @@ class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
|
|||
self.format = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMVirtualMachineScaleSetFacts, self).__init__(
|
||||
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.module._name == 'azure_rm_virtualmachine_scaleset_facts':
|
||||
self.module.deprecate("The 'azure_rm_virtualmachine_scaleset_facts' module has been renamed to 'azure_rm_virtualmachinescaleset_facts'",
|
||||
version='2.12')
|
||||
|
||||
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_facts']['azure_vmss'] = self.get_item()
|
||||
|
||||
if is_old_facts:
|
||||
if self.name:
|
||||
self.results['ansible_facts']['azure_vmss'] = self.get_item()
|
||||
else:
|
||||
self.results['ansible_facts']['azure_vmss'] = self.list_items()
|
||||
else:
|
||||
self.results['ansible_facts']['azure_vmss'] = self.list_items()
|
||||
if self.name:
|
||||
self.results['vmss'] = self.get_item()
|
||||
else:
|
||||
self.results['vmss'] = self.list_items()
|
||||
|
||||
if self.format == 'curated':
|
||||
for index in range(len(self.results['ansible_facts']['azure_vmss'])):
|
||||
|
@ -383,6 +390,8 @@ class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
|
|||
# proper result format we want to support in the future
|
||||
# dropping 'ansible_facts' and shorter name 'vmss'
|
||||
self.results['vmss'] = self.results['ansible_facts']['azure_vmss']
|
||||
if not is_old_facts:
|
||||
self.results.pop('ansible_facts', None)
|
||||
|
||||
return self.results
|
||||
|
||||
|
@ -425,7 +434,7 @@ class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMVirtualMachineScaleSetFacts()
|
||||
AzureRMVirtualMachineScaleSetInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_virtualmachineextension_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_virtualmachineextension_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Virtual Machine Extension facts
|
||||
description:
|
||||
- Get facts of Azure Virtual Machine Extension.
|
||||
|
@ -47,13 +47,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get information on specific Virtual Machine Extension
|
||||
azure_rm_virtualmachineextension_facts:
|
||||
azure_rm_virtualmachineextension_info:
|
||||
resource_group: myResourceGroup
|
||||
virtual_machine_name: myvm
|
||||
name: myextension
|
||||
|
||||
- name: List installed Virtual Machine Extensions
|
||||
azure_rm_virtualmachineextension_facts:
|
||||
azure_rm_virtualmachineextension_info:
|
||||
resource_group: myResourceGroup
|
||||
virtual_machine_name: myvm
|
||||
'''
|
||||
|
@ -144,7 +144,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMVirtualMachineExtensionFacts(AzureRMModuleBase):
|
||||
class AzureRMVirtualMachineExtensionInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -171,9 +171,14 @@ class AzureRMVirtualMachineExtensionFacts(AzureRMModuleBase):
|
|||
self.virtual_machine_name = None
|
||||
self.name = None
|
||||
self.tags = None
|
||||
super(AzureRMVirtualMachineExtensionFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -236,7 +241,7 @@ class AzureRMVirtualMachineExtensionFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMVirtualMachineExtensionFacts()
|
||||
AzureRMVirtualMachineExtensionInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,9 +16,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_virtualmachineimage_facts
|
||||
module: azure_rm_virtualmachineimage_info
|
||||
|
||||
version_added: "2.1"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get virtual machine image facts
|
||||
|
||||
|
@ -55,7 +55,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for a specific image
|
||||
azure_rm_virtualmachineimage_facts:
|
||||
azure_rm_virtualmachineimage_info:
|
||||
location: eastus
|
||||
publisher: OpenLogic
|
||||
offer: CentOS
|
||||
|
@ -63,19 +63,19 @@ EXAMPLES = '''
|
|||
version: '7.1.20160308'
|
||||
|
||||
- name: List available versions
|
||||
azure_rm_virtualmachineimage_facts:
|
||||
azure_rm_virtualmachineimage_info:
|
||||
location: eastus
|
||||
publisher: OpenLogic
|
||||
offer: CentOS
|
||||
sku: '7.1'
|
||||
|
||||
- name: List available offers
|
||||
azure_rm_virtualmachineimage_facts:
|
||||
azure_rm_virtualmachineimage_info:
|
||||
location: eastus
|
||||
publisher: OpenLogic
|
||||
|
||||
- name: List available publishers
|
||||
azure_rm_virtualmachineimage_facts:
|
||||
azure_rm_virtualmachineimage_info:
|
||||
location: eastus
|
||||
|
||||
'''
|
||||
|
@ -125,7 +125,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
|||
AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
|
||||
|
||||
|
||||
class AzureRMVirtualMachineImageFacts(AzureRMModuleBase):
|
||||
class AzureRMVirtualMachineImageInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
||||
|
@ -148,21 +148,34 @@ class AzureRMVirtualMachineImageFacts(AzureRMModuleBase):
|
|||
self.sku = None
|
||||
self.version = None
|
||||
|
||||
super(AzureRMVirtualMachineImageFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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 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()
|
||||
if is_old_facts:
|
||||
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
|
||||
|
||||
|
@ -238,7 +251,7 @@ class AzureRMVirtualMachineImageFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMVirtualMachineImageFacts()
|
||||
AzureRMVirtualMachineImageInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -13,9 +13,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_virtualmachinescaleset_facts
|
||||
module: azure_rm_virtualmachinescaleset_info
|
||||
|
||||
version_added: "2.4"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get Virtual Machine Scale Set facts
|
||||
|
||||
|
@ -55,17 +55,17 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for a virtual machine scale set
|
||||
azure_rm_virtualmachinescaleset_facts:
|
||||
azure_rm_virtualmachinescaleset_info:
|
||||
resource_group: myResourceGroup
|
||||
name: testvmss001
|
||||
format: curated
|
||||
|
||||
- name: Get facts for all virtual networks
|
||||
azure_rm_virtualmachinescaleset_facts:
|
||||
azure_rm_virtualmachinescaleset_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_virtualmachinescaleset_facts:
|
||||
azure_rm_virtualmachinescaleset_info:
|
||||
resource_group: myResourceGroup
|
||||
tags:
|
||||
- testing
|
||||
|
@ -261,7 +261,7 @@ AZURE_OBJECT_CLASS = 'VirtualMachineScaleSet'
|
|||
AZURE_ENUM_MODULES = ['azure.mgmt.compute.models']
|
||||
|
||||
|
||||
class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
|
||||
class AzureRMVirtualMachineScaleSetInfo(AzureRMModuleBase):
|
||||
"""Utility class to get virtual machine scale set facts"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -290,27 +290,34 @@ class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
|
|||
self.format = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMVirtualMachineScaleSetFacts, self).__init__(
|
||||
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.module._name == 'azure_rm_virtualmachine_scaleset_facts':
|
||||
self.module.deprecate("The 'azure_rm_virtualmachine_scaleset_facts' module has been renamed to 'azure_rm_virtualmachinescaleset_facts'",
|
||||
version='2.12')
|
||||
|
||||
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_facts']['azure_vmss'] = self.get_item()
|
||||
|
||||
if is_old_facts:
|
||||
if self.name:
|
||||
self.results['ansible_facts']['azure_vmss'] = self.get_item()
|
||||
else:
|
||||
self.results['ansible_facts']['azure_vmss'] = self.list_items()
|
||||
else:
|
||||
self.results['ansible_facts']['azure_vmss'] = self.list_items()
|
||||
if self.name:
|
||||
self.results['vmss'] = self.get_item()
|
||||
else:
|
||||
self.results['vmss'] = self.list_items()
|
||||
|
||||
if self.format == 'curated':
|
||||
for index in range(len(self.results['ansible_facts']['azure_vmss'])):
|
||||
|
@ -383,6 +390,8 @@ class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
|
|||
# proper result format we want to support in the future
|
||||
# dropping 'ansible_facts' and shorter name 'vmss'
|
||||
self.results['vmss'] = self.results['ansible_facts']['azure_vmss']
|
||||
if not is_old_facts:
|
||||
self.results.pop('ansible_facts', None)
|
||||
|
||||
return self.results
|
||||
|
||||
|
@ -425,7 +434,7 @@ class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
|
|||
def main():
|
||||
"""Main module execution code path"""
|
||||
|
||||
AzureRMVirtualMachineScaleSetFacts()
|
||||
AzureRMVirtualMachineScaleSetInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_virtualmachinescalesetextension_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_virtualmachinescalesetextension_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Virtual Machine Scale Set Extension facts
|
||||
description:
|
||||
- Get facts of Azure Virtual Machine Scale Set Extension.
|
||||
|
@ -44,13 +44,13 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get information on specific Virtual Machine Scale Set Extension
|
||||
azure_rm_virtualmachineextension_facts:
|
||||
azure_rm_virtualmachineextension_info:
|
||||
resource_group: myResourceGroup
|
||||
vmss_name: myvmss
|
||||
name: myextension
|
||||
|
||||
- name: List installed Virtual Machine Scale Set Extensions
|
||||
azure_rm_virtualmachineextension_facts:
|
||||
azure_rm_virtualmachineextension_info:
|
||||
resource_group: myrg
|
||||
vmss_name: myvmss
|
||||
'''
|
||||
|
@ -129,7 +129,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMVirtualMachineScaleSetExtensionFacts(AzureRMModuleBase):
|
||||
class AzureRMVirtualMachineScaleSetExtensionInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -152,9 +152,15 @@ class AzureRMVirtualMachineScaleSetExtensionFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.vmss_name = None
|
||||
self.name = None
|
||||
super(AzureRMVirtualMachineScaleSetExtensionFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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])
|
||||
|
||||
|
@ -215,7 +221,7 @@ class AzureRMVirtualMachineScaleSetExtensionFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMVirtualMachineScaleSetExtensionFacts()
|
||||
AzureRMVirtualMachineScaleSetExtensionInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,8 +15,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_virtualmachinescalesetinstance_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_virtualmachinescalesetinstance_info
|
||||
version_added: "2.9"
|
||||
short_description: Get Azure Virtual Machine Scale Set Instance facts
|
||||
description:
|
||||
- Get facts of Azure Virtual Machine Scale Set VMs.
|
||||
|
@ -47,7 +47,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: List VM instances in Virtual Machine ScaleSet
|
||||
azure_rm_computevirtualmachinescalesetinstance_facts:
|
||||
azure_rm_computevirtualmachinescalesetinstance_info:
|
||||
resource_group: myResourceGroup
|
||||
vmss_name: myVMSS
|
||||
'''
|
||||
|
@ -121,7 +121,7 @@ except ImportError:
|
|||
pass
|
||||
|
||||
|
||||
class AzureRMVirtualMachineScaleSetVMFacts(AzureRMModuleBase):
|
||||
class AzureRMVirtualMachineScaleSetVMInfo(AzureRMModuleBase):
|
||||
def __init__(self):
|
||||
# define user inputs into argument
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -149,9 +149,15 @@ class AzureRMVirtualMachineScaleSetVMFacts(AzureRMModuleBase):
|
|||
self.vmss_name = None
|
||||
self.instance_id = None
|
||||
self.tags = None
|
||||
super(AzureRMVirtualMachineScaleSetVMFacts, self).__init__(self.module_arg_spec, supports_tags=False)
|
||||
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,
|
||||
|
@ -221,7 +227,7 @@ class AzureRMVirtualMachineScaleSetVMFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMVirtualMachineScaleSetVMFacts()
|
||||
AzureRMVirtualMachineScaleSetVMInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -16,9 +16,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_virtualnetwork_facts
|
||||
module: azure_rm_virtualnetwork_info
|
||||
|
||||
version_added: "2.1"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get virtual network facts
|
||||
|
||||
|
@ -47,16 +47,16 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one virtual network
|
||||
azure_rm_virtualnetwork_facts:
|
||||
azure_rm_virtualnetwork_info:
|
||||
resource_group: myResourceGroup
|
||||
name: secgroup001
|
||||
|
||||
- name: Get facts for all virtual networks
|
||||
azure_rm_virtualnetwork_facts:
|
||||
azure_rm_virtualnetwork_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts by tags
|
||||
azure_rm_virtualnetwork_facts:
|
||||
azure_rm_virtualnetwork_info:
|
||||
tags:
|
||||
- testing
|
||||
'''
|
||||
|
@ -202,7 +202,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
|||
AZURE_OBJECT_CLASS = 'VirtualNetwork'
|
||||
|
||||
|
||||
class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
|
||||
class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -222,11 +222,14 @@ class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
super(AzureRMNetworkInterfaceFacts, self).__init__(self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True)
|
||||
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])
|
||||
|
@ -238,7 +241,8 @@ class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
|
|||
else:
|
||||
results = self.list_items()
|
||||
|
||||
self.results['ansible_facts']['azure_virtualnetworks'] = self.serialize(results)
|
||||
if is_old_facts:
|
||||
self.results['ansible_facts']['azure_virtualnetworks'] = self.serialize(results)
|
||||
self.results['virtualnetworks'] = self.curated(results)
|
||||
|
||||
return self.results
|
||||
|
@ -326,7 +330,7 @@ class AzureRMNetworkInterfaceFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMNetworkInterfaceFacts()
|
||||
AzureRMNetworkInterfaceInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -13,8 +13,8 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_virtualnetworkpeering_facts
|
||||
version_added: "2.8"
|
||||
module: azure_rm_virtualnetworkpeering_info
|
||||
version_added: "2.9"
|
||||
short_description: Get facts of Azure Virtual Network Peering
|
||||
description:
|
||||
- Get facts of Azure Virtual Network Peering.
|
||||
|
@ -41,7 +41,7 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get virtual network peering by name
|
||||
azure_rm_virtualnetworkpeering_facts:
|
||||
azure_rm_virtualnetworkpeering_info:
|
||||
resource_group: myResourceGroup
|
||||
virtual_network: myVnet1
|
||||
name: myVnetPeer
|
||||
|
@ -158,7 +158,7 @@ def vnetpeering_to_dict(vnetpeering):
|
|||
return results
|
||||
|
||||
|
||||
class AzureRMVirtualNetworkPeeringFacts(AzureRMModuleBase):
|
||||
class AzureRMVirtualNetworkPeeringInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
self.module_arg_spec = dict(
|
||||
|
@ -181,11 +181,14 @@ class AzureRMVirtualNetworkPeeringFacts(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(changed=False)
|
||||
|
||||
super(AzureRMVirtualNetworkPeeringFacts, self).__init__(derived_arg_spec=self.module_arg_spec,
|
||||
supports_tags=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])
|
||||
|
@ -246,7 +249,7 @@ class AzureRMVirtualNetworkPeeringFacts(AzureRMModuleBase):
|
|||
|
||||
def main():
|
||||
"""Main execution"""
|
||||
AzureRMVirtualNetworkPeeringFacts()
|
||||
AzureRMVirtualNetworkPeeringInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -15,9 +15,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: azure_rm_webapp_facts
|
||||
module: azure_rm_webapp_info
|
||||
|
||||
version_added: "2.7"
|
||||
version_added: "2.9"
|
||||
|
||||
short_description: Get Azure web app facts
|
||||
|
||||
|
@ -49,16 +49,16 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for web app by name
|
||||
azure_rm_webapp_facts:
|
||||
azure_rm_webapp_info:
|
||||
resource_group: myResourceGroup
|
||||
name: winwebapp1
|
||||
|
||||
- name: Get facts for web apps in resource group
|
||||
azure_rm_webapp_facts:
|
||||
azure_rm_webapp_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for web apps with tags
|
||||
azure_rm_webapp_facts:
|
||||
azure_rm_webapp_info:
|
||||
tags:
|
||||
- testtag
|
||||
- foo:bar
|
||||
|
@ -235,7 +235,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
|||
AZURE_OBJECT_CLASS = 'WebApp'
|
||||
|
||||
|
||||
class AzureRMWebAppFacts(AzureRMModuleBase):
|
||||
class AzureRMWebAppInfo(AzureRMModuleBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -258,11 +258,14 @@ class AzureRMWebAppFacts(AzureRMModuleBase):
|
|||
|
||||
self.framework_names = ['net_framework', 'java', 'php', 'node', 'python', 'dotnetcore', 'ruby']
|
||||
|
||||
super(AzureRMWebAppFacts, self).__init__(self.module_arg_spec,
|
||||
supports_tags=False,
|
||||
facts_module=True)
|
||||
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])
|
||||
|
@ -478,7 +481,7 @@ class AzureRMWebAppFacts(AzureRMModuleBase):
|
|||
|
||||
|
||||
def main():
|
||||
AzureRMWebAppFacts()
|
||||
AzureRMWebAppInfo()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -71,7 +71,6 @@ azure_aks:
|
|||
type: list
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
try:
|
||||
|
@ -107,11 +106,6 @@ class AzureRMManagedClusterInfo(AzureRMModuleBase):
|
|||
self.tags = None
|
||||
self.show_kubeconfig = None
|
||||
|
||||
module = AnsibleModule(self.module_args)
|
||||
is_old_facts = module._name == 'azure_rm_aks_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_aks_facts' module has been renamed to 'azure_rm_aks_info'", version='2.13')
|
||||
|
||||
super(AzureRMManagedClusterInfo, self).__init__(
|
||||
derived_arg_spec=self.module_args,
|
||||
supports_tags=False,
|
||||
|
@ -120,6 +114,10 @@ class AzureRMManagedClusterInfo(AzureRMModuleBase):
|
|||
|
||||
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])
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ azure_aks_versions:
|
|||
type: list
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
try:
|
||||
|
@ -84,11 +83,6 @@ class AzureRMAKSVersion(AzureRMModuleBase):
|
|||
self.location = None
|
||||
self.version = None
|
||||
|
||||
module = AnsibleModule(self.module_args)
|
||||
is_old_facts = module._name == 'azure_rm_aksversion_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_aksversion_facts' module has been renamed to 'azure_rm_aksversion_info'", version='2.13')
|
||||
|
||||
super(AzureRMAKSVersion, self).__init__(
|
||||
derived_arg_spec=self.module_args,
|
||||
supports_tags=False,
|
||||
|
@ -97,6 +91,10 @@ class AzureRMAKSVersion(AzureRMModuleBase):
|
|||
|
||||
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])
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ applicationsecuritygroups:
|
|||
sample: Succeeded
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
try:
|
||||
|
@ -130,12 +129,6 @@ class AzureRMApplicationSecurityGroupInfo(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(changed=False)
|
||||
|
||||
module = AnsibleModule(self.module_arg_spec)
|
||||
is_old_facts = module._name == 'azure_rm_applicationsecuritygroup_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_applicationsecuritygroup_facts' module has been renamed to 'azure_rm_applicationsecuritygroup_info'",
|
||||
version='2.13')
|
||||
|
||||
super(AzureRMApplicationSecurityGroupInfo, self).__init__(derived_arg_spec=self.module_arg_spec,
|
||||
supports_check_mode=False,
|
||||
supports_tags=False)
|
||||
|
@ -143,6 +136,11 @@ class AzureRMApplicationSecurityGroupInfo(AzureRMModuleBase):
|
|||
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])
|
||||
|
|
|
@ -126,7 +126,6 @@ except Exception:
|
|||
# This is handled in azure_rm_common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
AZURE_OBJECT_CLASS = 'AppServicePlan'
|
||||
|
@ -149,17 +148,16 @@ class AzureRMAppServicePlanInfo(AzureRMModuleBase):
|
|||
self.tags = None
|
||||
self.info_level = None
|
||||
|
||||
module = AnsibleModule(self.module_arg_spec)
|
||||
is_old_facts = module._name == 'azure_rm_appserviceplan_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_appserviceplan_facts' module has been renamed to 'azure_rm_appserviceplan_info'", version='2.13')
|
||||
|
||||
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])
|
||||
|
||||
|
|
|
@ -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
|
||||
version_added: '2.9'
|
||||
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
|
||||
|
||||
author:
|
||||
- Yuwei Zhou (@yuwzho)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get details of an automation account
|
||||
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
|
||||
azure_rm_automationaccount_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: List automation account in a resource group
|
||||
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: long
|
||||
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.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()
|
|
@ -114,7 +114,6 @@ autoscales:
|
|||
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
|
@ -228,14 +227,14 @@ class AzureRMAutoScaleInfo(AzureRMModuleBase):
|
|||
self.name = None
|
||||
self.tags = None
|
||||
|
||||
module = AnsibleModule(self.module_arg_spec)
|
||||
is_old_facts = module._name == 'azure_rm_autoscale_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_autoscale_facts' module has been renamed to 'azure_rm_autoscale_info'", version='2.13')
|
||||
|
||||
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])
|
||||
|
||||
|
|
|
@ -105,7 +105,6 @@ azure_availabilityset:
|
|||
sample: { env: sandbox }
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
try:
|
||||
|
@ -130,7 +129,7 @@ class AzureRMAvailabilitySetInfo(AzureRMModuleBase):
|
|||
|
||||
self.results = dict(
|
||||
changed=False,
|
||||
ansible_facts=dict(
|
||||
ansible_info=dict(
|
||||
azure_availabilitysets=[]
|
||||
)
|
||||
)
|
||||
|
@ -139,11 +138,6 @@ class AzureRMAvailabilitySetInfo(AzureRMModuleBase):
|
|||
self.resource_group = None
|
||||
self.tags = None
|
||||
|
||||
module = AnsibleModule(self.module_args)
|
||||
is_old_facts = module._name == 'azure_rm_availabilityset_facts'
|
||||
if is_old_facts:
|
||||
module.deprecate("The 'azure_rm_availabilityset_facts' module has been renamed to 'azure_rm_availabilityset_info'", version='2.13')
|
||||
|
||||
super(AzureRMAvailabilitySetInfo, self).__init__(
|
||||
derived_arg_spec=self.module_args,
|
||||
supports_tags=False,
|
||||
|
@ -152,15 +146,19 @@ class AzureRMAvailabilitySetInfo(AzureRMModuleBase):
|
|||
|
||||
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_facts']['azure_availabilitysets'] = self.get_item()
|
||||
self.results['ansible_info']['azure_availabilitysets'] = self.get_item()
|
||||
else:
|
||||
self.results['ansible_facts']['azure_availabilitysets'] = self.list_items()
|
||||
self.results['ansible_info']['azure_availabilitysets'] = self.list_items()
|
||||
|
||||
return self.results
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
version_added: "2.9"
|
||||
|
||||
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
|
||||
|
||||
author:
|
||||
- Hai Cao (@caohai)
|
||||
- Yunge zhu (@yungezz)
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for all endpoints in CDN profile
|
||||
azure_rm_cdnendpoint_info:
|
||||
resource_group: myResourceGroup
|
||||
profile_name: myCDNProfile
|
||||
|
||||
- name: Get facts of specific CDN endpoint
|
||||
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 retreive content from.
|
||||
type: str
|
||||
sample: /pic/
|
||||
tags:
|
||||
description:
|
||||
- The tags of the Azure CDN endpoint.
|
||||
type: list
|
||||
sample: foo
|
||||
'''
|
||||
|
||||
from ansible.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()
|
|
@ -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
|
||||
|
||||
version_added: "2.9"
|
||||
|
||||
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
|
||||
|
||||
author:
|
||||
- Hai Cao (@caohai)
|
||||
- Yunge Zhu (@yungezz)
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one CDN profile
|
||||
azure_rm_cdnprofile_info:
|
||||
name: Testing
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all CDN profiles
|
||||
azure_rm_cdnprofile_info:
|
||||
|
||||
- name: Get facts by tags
|
||||
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.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()
|
|
@ -0,0 +1,321 @@
|
|||
#!/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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get specific Container Instance facts
|
||||
azure_rm_containerinstance_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myContainer
|
||||
|
||||
- name: List Container Instances in a specified resource group name
|
||||
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.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,
|
||||
ansible_facts=dict()
|
||||
)
|
||||
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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Registry
|
||||
azure_rm_containerregistry_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myRegistry
|
||||
|
||||
- name: List instances of Registry
|
||||
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.
|
||||
return: 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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Database Account
|
||||
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.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()
|
|
@ -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_deployment_info
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Deployment
|
||||
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/myD
|
||||
eployment"
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: List instances of DevTest Lab by resource group
|
||||
azure_rm_devtestlab_info:
|
||||
resource_group: testrg
|
||||
|
||||
- name: List instances of DevTest Lab in subscription
|
||||
azure_rm_devtestlab_info:
|
||||
|
||||
- name: Get instance of DevTest Lab
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get information on DevTest Lab ARM Template
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of DevTest Lab Artifact
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of DevTest Lab Artifact Source
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Custom Image
|
||||
azure_rm_devtestlabcustomimage_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
name: myImage
|
||||
|
||||
- name: List instances of Custom Image in the lab
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Environment
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Policy
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of Schedule
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of DTL Virtual Machine
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Zim Kalinowski (@zikalino)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get instance of DevTest Lab Virtual Network
|
||||
azure_rm_devtestlabvirtualnetwork_info:
|
||||
resource_group: myResourceGroup
|
||||
lab_name: myLab
|
||||
name: myVirtualNetwork
|
||||
|
||||
- name: List all Virtual Networks in DevTest Lab
|
||||
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.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()
|
|
@ -0,0 +1,293 @@
|
|||
#!/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
|
||||
|
||||
version_added: "2.9"
|
||||
|
||||
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
|
||||
- azure_tags
|
||||
|
||||
author:
|
||||
- Ozi Boms (@ozboms)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one Record Set
|
||||
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
|
||||
azure_rm_dnsrecordset_info:
|
||||
resource_group: myResourceGroup
|
||||
zone_name: example.com
|
||||
record_type: A
|
||||
- name: Get all record sets in one zone
|
||||
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(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.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,
|
||||
ansible_info=dict(azure_dnsrecordset=[])
|
||||
)
|
||||
|
||||
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()
|
|
@ -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
|
||||
|
||||
version_added: "2.9"
|
||||
|
||||
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
|
||||
- azure_tags
|
||||
|
||||
author:
|
||||
- Obezimnaka Boms (@ozboms)
|
||||
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one zone
|
||||
azure_rm_dnszone_info:
|
||||
resource_group: myResourceGroup
|
||||
name: foobar22
|
||||
|
||||
- name: Get facts for all zones in a resource group
|
||||
azure_rm_dnszone_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts by tags
|
||||
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.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()
|
|
@ -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
|
||||
version_added: "2.9"
|
||||
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
|
||||
|
||||
author:
|
||||
- Thomas Stringer (@trstringer)
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Get facts for one Function App
|
||||
azure_rm_functionapp_info:
|
||||
resource_group: myResourceGroup
|
||||
name: myfunctionapp
|
||||
|
||||
- name: Get facts for all Function Apps in a resource group
|
||||
azure_rm_functionapp_info:
|
||||
resource_group: myResourceGroup
|
||||
|
||||
- name: Get facts for all Function Apps by tags
|
||||
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.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()
|
|
@ -84,7 +84,10 @@ options:
|
|||
managed_image:
|
||||
description:
|
||||
- Managed image reference, could be resource id, or dictionary containing C(resource_group) and C(name)
|
||||
required: true
|
||||
type: raw
|
||||
snapshot:
|
||||
description:
|
||||
- Source snapshot to be used.
|
||||
type: raw
|
||||
replica_count:
|
||||
description:
|
||||
|
@ -243,6 +246,13 @@ class AzureRMGalleryImageVersions(AzureRMModuleBaseExt):
|
|||
'/images/{name}'),
|
||||
disposition='source/managedImage/id'
|
||||
),
|
||||
snapshot=dict(
|
||||
type='raw',
|
||||
pattern=('/subscriptions/{subscription_id}/resourceGroups'
|
||||
'/{resource_group}/providers/Microsoft.Compute'
|
||||
'/snapshots/{name}'),
|
||||
disposition='source/managedImage/id'
|
||||
),
|
||||
replica_count=dict(
|
||||
type='int',
|
||||
disposition='replicaCount'
|
||||
|
@ -353,6 +363,10 @@ class AzureRMGalleryImageVersions(AzureRMModuleBaseExt):
|
|||
if not self.default_compare(modifiers, self.body, old_response, '', self.results):
|
||||
self.to_do = Actions.Update
|
||||
|
||||
# fix leftovers (if empty structures were left)
|
||||
self.body.get('properties', {}).get('publishingProfile', {}).pop('snapshot', None)
|
||||
self.body.get('properties', {}).get('publishingProfile', {}).pop('managed_image', None)
|
||||
|
||||
if (self.to_do == Actions.Create) or (self.to_do == Actions.Update):
|
||||
self.log('Need to Create / Update the GalleryImageVersion instance')
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче