summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Moser <mail@renemoser.net>2016-11-11 14:03:43 +0100
committerGitHub <noreply@github.com>2016-11-11 14:03:43 +0100
commit80af46117876dad8f9598027e380b4d76dffc31c (patch)
treea0843bdc602aa26a27480b5099ace1564fe40038
parent3f785ee1733003d79a74decfabdeb903b99a7c3a (diff)
downloadansible-80af46117876dad8f9598027e380b4d76dffc31c.tar.gz
cloudstack: add additional CLOUDSTACK_VPC env var (#18467)
-rw-r--r--docsite/rst/guide_cloudstack.rst2
-rw-r--r--lib/ansible/module_utils/cloudstack.py2
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 = {