Updated per PR comments

pull/18777/head
chouseknecht 9 years ago committed by Matt Clay
parent 1d7a109867
commit ff624f9ef4

@ -32,6 +32,7 @@ options:
description: description:
- The resource group name to use or create to host the deployed template - The resource group name to use or create to host the deployed template
required: true required: true
default: null
location: location:
description: description:
- The geo-locations in which the resource group will be located. - The geo-locations in which the resource group will be located.
@ -42,6 +43,7 @@ options:
- If state is "present", template will be created. If state is "present" and if deployment exists, it will be - If state is "present", template will be created. If state is "present" and if deployment exists, it will be
updated. If state is "absent", stack will be removed. updated. If state is "absent", stack will be removed.
default: present default: present
required: true
choices: choices:
- present - present
- absent - absent
@ -50,25 +52,25 @@ options:
- A hash containing the templates inline. This parameter is mutually exclusive with 'template_link'. - A hash containing the templates inline. This parameter is mutually exclusive with 'template_link'.
Either one of them is required if "state" parameter is "present". Either one of them is required if "state" parameter is "present".
required: false required: false
default: None default: null
template_link: template_link:
description: description:
- Uri of file containing the template body. This parameter is mutually exclusive with 'template'. Either one - Uri of file containing the template body. This parameter is mutually exclusive with 'template'. Either one
of them is required if "state" parameter is "present". of them is required if "state" parameter is "present".
required: false required: false
default: None default: null
parameters: parameters:
description: description:
- A hash of all the required template variables for the deployment template. This parameter is mutually exclusive - A hash of all the required template variables for the deployment template. This parameter is mutually exclusive
with 'parameters_link'. Either one of them is required if "state" parameter is "present". with 'parameters_link'. Either one of them is required if "state" parameter is "present".
required: false required: false
default: None default: null
parameters_link: parameters_link:
description: description:
- Uri of file containing the parameters body. This parameter is mutually exclusive with 'parameters'. Either - Uri of file containing the parameters body. This parameter is mutually exclusive with 'parameters'. Either
one of them is required if "state" parameter is "present". one of them is required if "state" parameter is "present".
required: false required: false
default: None default: null
extends_documentation_fragment: extends_documentation_fragment:
- azure - azure
@ -314,51 +316,40 @@ EXAMPLES = '''
''' '''
RETURN = ''' RETURN = '''
msg:
description: String indicating if the deployment was created or deleted
returned: always
type: string
sample: "deployment created"
deployment: deployment:
description: Deployment details description: Deployment details
type: dict type: dict
returned: always returned: always
sample:{ sample:
"group_name": "Test_Deployment", group_name:
"id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Test_Deployment/providers/Microsoft.Resources/deployments/ansible-arm", description: Name of the resource group
"instances": [ type: string
{ returned: always
"ips": [ id:
{ description: The Azure ID of the deployment
"dns_settings": { type: string
"domain_name_label": "testvm9910001", returned: always
"fqdn": "testvm9910001.westus.cloudapp.azure.com" instances:
}, description: Provides the public IP addresses for each VM instance.
"id": "/subscriptions/3f7e29ba-24e0-42f6-8d9c-5149a14bda37/resourceGroups/Test_Deployment/providers/Microsoft.Network/publicIPAddresses/myPublicIP", type: list
"name": "myPublicIP", returned: always
"public_ip": "13.91.99.232", name:
"public_ip_allocation_method": "IPAllocationMethod.dynamic" description: Name of the deployment
} type: string
], returned: always
"vm_name": "MyUbuntuVM" outputs:
} description: Dictionary of outputs received from the deployment
], type: dict
"name": "ansible-arm", returned: always
"outputs": {
"hostname": {
"type": "String",
"value": "testvm9910001.westus.cloudapp.azure.com"
},
"sshCommand": {
"type": "String",
"value": "ssh chouseknecht@testvm9910001.westus.cloudapp.azure.com"
}
}
}
''' '''
PREREQ_IMPORT_ERROR = None
try:
import time import time
import yaml import yaml
except ImportError as exc:
IMPORT_ERROR = "Error importing module prerequisites: %s" % exc
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
from ansible.module_utils.azure_rm_common import * from ansible.module_utils.azure_rm_common import *
@ -427,6 +418,9 @@ class AzureRMDeploymentManager(AzureRMModuleBase):
def exec_module(self, **kwargs): def exec_module(self, **kwargs):
if PREREQ_IMPORT_ERROR:
self.fail(PREREQ_IMPORT_ERROR)
for key in self.module_arg_spec.keys() + ['tags']: for key in self.module_arg_spec.keys() + ['tags']:
setattr(self, key, kwargs[key]) setattr(self, key, kwargs[key])
@ -440,7 +434,7 @@ class AzureRMDeploymentManager(AzureRMModuleBase):
instances=self._get_instances(deployment) instances=self._get_instances(deployment)
) )
self.results['changed'] = True self.results['changed'] = True
self.results['msg'] = 'deployment created' self.results['msg'] = 'deployment succeeded'
else: else:
if self.resource_group_exists(self.resource_group_name): if self.resource_group_exists(self.resource_group_name):
self.destroy_resource_group() self.destroy_resource_group()

Loading…
Cancel
Save