|
|
@ -89,8 +89,8 @@ options:
|
|
|
|
default: false
|
|
|
|
default: false
|
|
|
|
cross_zones:
|
|
|
|
cross_zones:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Whether the template should be syned across zones.
|
|
|
|
- Whether the template should be syned or removed across zones.
|
|
|
|
- Only used if C(state) is present.
|
|
|
|
- Only used if C(state) is present or absent.
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: false
|
|
|
|
default: false
|
|
|
|
project:
|
|
|
|
project:
|
|
|
@ -168,7 +168,7 @@ options:
|
|
|
|
display_text:
|
|
|
|
display_text:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Display text of the template.
|
|
|
|
- Display text of the template.
|
|
|
|
required: true
|
|
|
|
required: false
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -220,6 +220,7 @@ EXAMPLES = '''
|
|
|
|
- local_action:
|
|
|
|
- local_action:
|
|
|
|
module: cs_template
|
|
|
|
module: cs_template
|
|
|
|
name: systemvm-4.2
|
|
|
|
name: systemvm-4.2
|
|
|
|
|
|
|
|
cross_zones: yes
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
@ -469,6 +470,12 @@ class AnsibleCloudStackTemplate(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def register_template(self):
|
|
|
|
def register_template(self):
|
|
|
|
|
|
|
|
required_params = [
|
|
|
|
|
|
|
|
'format',
|
|
|
|
|
|
|
|
'url',
|
|
|
|
|
|
|
|
'hypervisor',
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
self.module.fail_on_missing_params(required_params=required_params)
|
|
|
|
template = self.get_template()
|
|
|
|
template = self.get_template()
|
|
|
|
if not template:
|
|
|
|
if not template:
|
|
|
|
self.result['changed'] = True
|
|
|
|
self.result['changed'] = True
|
|
|
@ -536,9 +543,6 @@ class AnsibleCloudStackTemplate(AnsibleCloudStack):
|
|
|
|
args['mode'] = self.module.params.get('mode')
|
|
|
|
args['mode'] = self.module.params.get('mode')
|
|
|
|
args['zoneid'] = self.get_zone(key='id')
|
|
|
|
args['zoneid'] = self.get_zone(key='id')
|
|
|
|
|
|
|
|
|
|
|
|
if not args['url']:
|
|
|
|
|
|
|
|
self.module.fail_json(msg="Missing required arguments: url")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.result['changed'] = True
|
|
|
|
self.result['changed'] = True
|
|
|
|
|
|
|
|
|
|
|
|
if not self.module.check_mode:
|
|
|
|
if not self.module.check_mode:
|
|
|
@ -560,6 +564,8 @@ class AnsibleCloudStackTemplate(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
|
|
args = {}
|
|
|
|
args = {}
|
|
|
|
args['id'] = template['id']
|
|
|
|
args['id'] = template['id']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not self.module.params.get('cross_zones'):
|
|
|
|
args['zoneid'] = self.get_zone(key='id')
|
|
|
|
args['zoneid'] = self.get_zone(key='id')
|
|
|
|
|
|
|
|
|
|
|
|
if not self.module.check_mode:
|
|
|
|
if not self.module.check_mode:
|
|
|
@ -610,16 +616,12 @@ def main():
|
|
|
|
poll_async = dict(type='bool', default=True),
|
|
|
|
poll_async = dict(type='bool', default=True),
|
|
|
|
))
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
|
required_together = cs_required_together()
|
|
|
|
|
|
|
|
required_together.extend([
|
|
|
|
|
|
|
|
['format', 'url', 'hypervisor'],
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
argument_spec=argument_spec,
|
|
|
|
required_together=required_together,
|
|
|
|
required_together=cs_required_together(),
|
|
|
|
mutually_exclusive = (
|
|
|
|
mutually_exclusive = (
|
|
|
|
['url', 'vm'],
|
|
|
|
['url', 'vm'],
|
|
|
|
|
|
|
|
['zone', 'cross_zones'],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
supports_check_mode=True
|
|
|
|
supports_check_mode=True
|
|
|
|
)
|
|
|
|
)
|
|
|
|