diff --git a/lib/ansible/module_utils/cloudstack.py b/lib/ansible/module_utils/cloudstack.py index c4295b9530..092ade2f0d 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)