From ff7051bab463d1bca127c110d4e1530b869c49fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Sat, 19 Nov 2016 11:50:02 +0100 Subject: [PATCH] cloudstack: fix distinguish VPC and other networks (#18515) --- lib/ansible/module_utils/cloudstack.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/module_utils/cloudstack.py b/lib/ansible/module_utils/cloudstack.py index c4295b95301..092ade2f0d2 100644 --- a/lib/ansible/module_utils/cloudstack.py +++ b/lib/ansible/module_utils/cloudstack.py @@ -259,6 +259,9 @@ class AnsibleCloudStack(object): self.module.fail_json(msg="No networks available.") for n in networks['network']: + # ignore any VPC network if vpc param is not given + if 'vpcid' in n and not self.get_vpc(key='id'): + continue if network in [n['displaytext'], n['name'], n['id']]: self.network = n return self._get_by_key(key, self.network)