# How to read automatic environment variables such as DO\_CLIENT\_ID in digtal\_ocean module?

**URL:** <https://forum.ansible.com/t/how-to-read-automatic-environment-variables-such-as-do-client-id-in-digtal-ocean-module/15917>\
**Category:** Ansible Project\
**Created:** [August 12, 2014, 5:24am UTC](https://forum.ansible.com/t/how-to-read-automatic-environment-variables-such-as-do-client-id-in-digtal-ocean-module/15917 "2014-08-12T05:24:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_VanGundy](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@Ryan\_VanGundy](https://forum.ansible.com/u/Ryan_VanGundy)\
**Post date:** [August 12, 2014, 5:24am UTC](https://forum.ansible.com/t/how-to-read-automatic-environment-variables-such-as-do-client-id-in-digtal-ocean-module/15917/1 "2014-08-12T05:24:35Z")

</div>

I’m attempting to implement a deployment playbook that deploys to digital ocean. In the ansible docs on the digital\_ocean module it states,

“Two environment variables can be used, DO\_CLIENT\_ID and DO\_API\_KEY”

I haven’t yet written a task or playbook that uses environment variables that are already set. I’ve tried setting these in the current process manually as well as adding these environment variables in the current users ~/.bash\_profile. In both cases I get the following message:

msg: Unable to load DO\_CLIENT\_ID

I’ve also tried setting these variables in the digital\_ocean task using client\_id={{ lookup(‘env’,‘DO\_CLIENT\_ID’) }} and still get the above message. Any tips on what I’m doing wrong?

Thanks!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 12, 2014, 11:28am UTC](https://forum.ansible.com/t/how-to-read-automatic-environment-variables-such-as-do-client-id-in-digtal-ocean-module/15917/2 "2014-08-12T11:28:18Z")

</div>

Typically a provisioning play that talks to the cloud is run locally.

If you’ve added them to ~./bash\_profile, be sure to source ~/.bash\_profile.

(Do not run your provisioning play via a remote host, as Ansible will otherwise avoid loading this file to ensure repeatability in centralized management)

If setting them with the DO module parameters, it’s not intended you extract them again through the environment, it will either use the environmental parameters or the ones passed to the module.

---

<div class="post-metadata">

**Author:** ![Ryan\_VanGundy](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@Ryan\_VanGundy](https://forum.ansible.com/u/Ryan_VanGundy)\
**Post date:** [August 12, 2014, 3:52pm UTC](https://forum.ansible.com/t/how-to-read-automatic-environment-variables-such-as-do-client-id-in-digtal-ocean-module/15917/3 "2014-08-12T15:52:01Z")

</div>

OK, it’s working now. I was running with --connection=local. What’s odd is I was double-checking that the variables were set using ‘echo’, and even opened up a new terminal tab (I’m running on OS X)… for whatever reason restarting my terminal entirely did the trick. Guessing running it with ‘source’ would have had a similar effect. Thanks!
