diff options
-rw-r--r-- | docsite/rst/guide_cloudstack.rst | 2 | ||||
-rw-r--r-- | lib/ansible/module_utils/cloudstack.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/docsite/rst/guide_cloudstack.rst b/docsite/rst/guide_cloudstack.rst index d3e72e3b23..ac293f8ee1 100644 --- a/docsite/rst/guide_cloudstack.rst +++ b/docsite/rst/guide_cloudstack.rst @@ -101,7 +101,7 @@ Environment Variables ````````````````````` .. versionadded:: 2.3 -Since Ansible 2.3 it is possible to use environment variables for domain (``CLOUDSTACK_DOMAIN``), account (``CLOUDSTACK_ACCOUNT``), project (``CLOUDSTACK_PROJECT``) and zone (``CLOUDSTACK_ZONE``). This simplifies the tasks by not repeating the arguments for every tasks. +Since Ansible 2.3 it is possible to use environment variables for domain (``CLOUDSTACK_DOMAIN``), account (``CLOUDSTACK_ACCOUNT``), project (``CLOUDSTACK_PROJECT``), VPC (``CLOUDSTACK_VPC``) and zone (``CLOUDSTACK_ZONE``). This simplifies the tasks by not repeating the arguments for every tasks. Below you see an example how it can be used in combination with Ansible's block feature: diff --git a/lib/ansible/module_utils/cloudstack.py b/lib/ansible/module_utils/cloudstack.py index 6a6f4dd527..a2535877a5 100644 --- a/lib/ansible/module_utils/cloudstack.py +++ b/lib/ansible/module_utils/cloudstack.py @@ -217,6 +217,8 @@ class AnsibleCloudStack(object): vpc = self.module.params.get('vpc') if not vpc: + vpc = os.environ.get('CLOUDSTACK_VPC') + if not vpc: return None args = { |