From 060484970dc1d14f3235261ca33f4b448dd1f216 Mon Sep 17 00:00:00 2001 From: David Passante Date: Thu, 29 Aug 2019 16:07:29 +0200 Subject: [PATCH] add tag functionality to cs_network (#61530) * add tag functionality to cs_network * fix version_added --- lib/ansible/modules/cloud/cloudstack/cs_network.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ansible/modules/cloud/cloudstack/cs_network.py b/lib/ansible/modules/cloud/cloudstack/cs_network.py index ee616daad40..42ea6020e9f 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_network.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_network.py @@ -148,6 +148,13 @@ options: - Poll async jobs until job has finished. default: yes type: bool + tags: + description: + - List of tags. Tags are a list of dictionaries having keys I(key) and I(value). + - "To delete all tags, set a empty list e.g. I(tags: [])." + type: list + aliases: [ tag ] + version_added: '2.9' extends_documentation_fragment: cloudstack ''' @@ -462,6 +469,10 @@ class AnsibleCloudStackNetwork(AnsibleCloudStack): network = self.create_network(network) else: network = self.update_network(network) + + if network: + network = self.ensure_tags(resource=network, resource_type='Network') + return network def update_network(self, network): @@ -597,6 +608,7 @@ def main(): domain=dict(), account=dict(), poll_async=dict(type='bool', default=True), + tags=dict(type='list', aliases=['tag']), )) required_together = cs_required_together() required_together.extend([