mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Added Tag functionality to Volume,Template,FWRule,PF Rule,ISO,Snapshot (#23141)
* Added Tag functionality to Volume,Template,FWRule,PF Rule,ISO,Snapshot * Update cs_firewall.py Fixed whitespace * Added doc for Cloudstack Tags in Volume,Template,FWRule,PF Rule,ISO,Snapshot
This commit is contained in:
parent
9713abe9f7
commit
e4206d8ef5
6 changed files with 79 additions and 0 deletions
|
@ -115,6 +115,14 @@ options:
|
|||
- Poll async jobs until job has finished.
|
||||
required: false
|
||||
default: true
|
||||
tags:
|
||||
description:
|
||||
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
|
||||
- "To delete all tags, set a empty list e.g. C(tags: [])."
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'tag' ]
|
||||
version_added: "2.4"
|
||||
extends_documentation_fragment: cloudstack
|
||||
'''
|
||||
|
||||
|
@ -345,6 +353,11 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack):
|
|||
poll_async = self.module.params.get('poll_async')
|
||||
if poll_async:
|
||||
firewall_rule = self.poll_job(res, 'firewallrule')
|
||||
|
||||
if firewall_rule:
|
||||
firewall_rule = self.ensure_tags(resource=firewall_rule, resource_type='Firewallrule')
|
||||
self.firewall_rule = firewall_rule
|
||||
|
||||
return firewall_rule
|
||||
|
||||
def remove_firewall_rule(self):
|
||||
|
@ -398,6 +411,7 @@ def main():
|
|||
account=dict(),
|
||||
project=dict(),
|
||||
poll_async=dict(type='bool', default=True),
|
||||
tags=dict(type='list', aliases=['tag'], default=None),
|
||||
))
|
||||
|
||||
required_together = cs_required_together()
|
||||
|
|
|
@ -117,6 +117,14 @@ options:
|
|||
required: false
|
||||
default: true
|
||||
version_added: "2.3"
|
||||
tags:
|
||||
description:
|
||||
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
|
||||
- "To delete all tags, set a empty list e.g. C(tags: [])."
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'tag' ]
|
||||
version_added: "2.4"
|
||||
extends_documentation_fragment: cloudstack
|
||||
'''
|
||||
|
||||
|
@ -255,6 +263,11 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
|||
if 'errortext' in res:
|
||||
self.module.fail_json(msg="Failed: '%s'" % res['errortext'])
|
||||
iso = res['iso'][0]
|
||||
|
||||
if iso:
|
||||
iso = self.ensure_tags(resource=iso, resource_type='ISO')
|
||||
self.iso=iso
|
||||
|
||||
return iso
|
||||
|
||||
|
||||
|
@ -325,6 +338,7 @@ def main():
|
|||
is_dynamically_scalable = dict(type='bool', default=False),
|
||||
state = dict(choices=['present', 'absent'], default='present'),
|
||||
poll_async = dict(type='bool', default=True),
|
||||
tags=dict(type='list', aliases=['tag'], default=None),
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
|
|
@ -123,6 +123,14 @@ options:
|
|||
- Poll async jobs until job has finished.
|
||||
required: false
|
||||
default: true
|
||||
tags:
|
||||
description:
|
||||
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
|
||||
- "To delete all tags, set a empty list e.g. C(tags: [])."
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'tag' ]
|
||||
version_added: "2.4"
|
||||
extends_documentation_fragment: cloudstack
|
||||
'''
|
||||
|
||||
|
@ -288,6 +296,11 @@ class AnsibleCloudStackPortforwarding(AnsibleCloudStack):
|
|||
portforwarding_rule = self.update_portforwarding_rule(portforwarding_rule)
|
||||
else:
|
||||
portforwarding_rule = self.create_portforwarding_rule()
|
||||
|
||||
if portforwarding_rule:
|
||||
portforwarding_rule = self.ensure_tags(resource=portforwarding_rule, resource_type='PortForwardingRule')
|
||||
self.portforwarding_rule=portforwarding_rule
|
||||
|
||||
return portforwarding_rule
|
||||
|
||||
|
||||
|
@ -395,6 +408,7 @@ def main():
|
|||
account = dict(default=None),
|
||||
project = dict(default=None),
|
||||
poll_async = dict(type='bool', default=True),
|
||||
tags=dict(type='list', aliases=['tag'], default=None),
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
|
|
@ -203,6 +203,14 @@ options:
|
|||
- Poll async jobs until job has finished.
|
||||
required: false
|
||||
default: true
|
||||
tags:
|
||||
description:
|
||||
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
|
||||
- "To delete all tags, set a empty list e.g. C(tags: [])."
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'tag' ]
|
||||
version_added: "2.4"
|
||||
extends_documentation_fragment: cloudstack
|
||||
'''
|
||||
|
||||
|
@ -482,6 +490,9 @@ class AnsibleCloudStackTemplate(AnsibleCloudStack):
|
|||
poll_async = self.module.params.get('poll_async')
|
||||
if poll_async:
|
||||
template = self.poll_job(template, 'template')
|
||||
if template:
|
||||
template = self.ensure_tags(resource=template, resource_type='Template')
|
||||
|
||||
return template
|
||||
|
||||
|
||||
|
@ -630,6 +641,7 @@ def main():
|
|||
account = dict(default=None),
|
||||
project = dict(default=None),
|
||||
poll_async = dict(type='bool', default=True),
|
||||
tags=dict(type='list', aliases=['tag'], default=None),
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
|
|
@ -82,6 +82,14 @@ options:
|
|||
- Poll async jobs until job has finished.
|
||||
required: false
|
||||
default: true
|
||||
tags:
|
||||
description:
|
||||
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
|
||||
- "To delete all tags, set a empty list e.g. C(tags: [])."
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'tag' ]
|
||||
version_added: "2.4"
|
||||
extends_documentation_fragment: cloudstack
|
||||
'''
|
||||
|
||||
|
@ -216,6 +224,9 @@ class AnsibleCloudStackVmSnapshot(AnsibleCloudStack):
|
|||
if res and poll_async:
|
||||
snapshot = self.poll_job(res, 'vmsnapshot')
|
||||
|
||||
if snapshot:
|
||||
snapshot = self.ensure_tags(resource=snapshot, resource_type='Snapshot')
|
||||
|
||||
return snapshot
|
||||
|
||||
|
||||
|
@ -268,6 +279,7 @@ def main():
|
|||
account = dict(default=None),
|
||||
project = dict(default=None),
|
||||
poll_async = dict(type='bool', default=True),
|
||||
tags=dict(type='list', aliases=['tag'], default=None),
|
||||
))
|
||||
|
||||
required_together = cs_required_together()
|
||||
|
|
|
@ -127,6 +127,14 @@ options:
|
|||
- Poll async jobs until job has finished.
|
||||
required: false
|
||||
default: true
|
||||
tags:
|
||||
description:
|
||||
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
|
||||
- "To delete all tags, set a empty list e.g. C(tags: [])."
|
||||
required: false
|
||||
default: null
|
||||
aliases: [ 'tag' ]
|
||||
version_added: "2.4"
|
||||
extends_documentation_fragment: cloudstack
|
||||
'''
|
||||
|
||||
|
@ -338,6 +346,10 @@ class AnsibleCloudStackVolume(AnsibleCloudStack):
|
|||
poll_async = self.module.params.get('poll_async')
|
||||
if poll_async:
|
||||
volume = self.poll_job(res, 'volume')
|
||||
if volume:
|
||||
volume = self.ensure_tags(resource=volume, resource_type='Volume')
|
||||
self.volume=volume
|
||||
|
||||
return volume
|
||||
|
||||
|
||||
|
@ -458,6 +470,7 @@ def main():
|
|||
account = dict(default=None),
|
||||
project = dict(default=None),
|
||||
poll_async = dict(type='bool', default=True),
|
||||
tags=dict(type='list', aliases=['tag'], default=None),
|
||||
))
|
||||
|
||||
module = AnsibleModule(
|
||||
|
|
Loading…
Reference in a new issue