diff --git a/lib/ansible/module_utils/cloudstack.py b/lib/ansible/module_utils/cloudstack.py index b4b3b1b53f7..fa05426db80 100644 --- a/lib/ansible/module_utils/cloudstack.py +++ b/lib/ansible/module_utils/cloudstack.py @@ -344,6 +344,9 @@ class AnsibleCloudStack(object): zone = self.module.params.get('zone') zones = self.cs.listZones() + if not zones: + self.module.fail_json(msg="No zones available. Please create a zone first") + # use the first zone if no zone param given if not zone: self.zone = zones['zone'][0]