# OS\_TOKEN environment variable with os\_\* modules

**URL:** <https://forum.ansible.com/t/os-token-environment-variable-with-os-modules/20754>\
**Category:** Ansible Project\
**Created:** [March 2, 2016, 7:14pm UTC](https://forum.ansible.com/t/os-token-environment-variable-with-os-modules/20754 "2016-03-02T19:14:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Curtis](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@Curtis](https://forum.ansible.com/u/Curtis)\
**Post date:** [March 2, 2016, 7:14pm UTC](https://forum.ansible.com/t/os-token-environment-variable-with-os-modules/20754/1 "2016-03-02T19:14:14Z")

</div>

Hi,

I'm having a hard time getting the os\_user (and I would imagine other  
modules) to work just using a service token, ie. there are no users in  
keystone yet, so need to create them using the service token.

How would I do that with the os\_\* modules? I can get the openstack  
python client to work with just OS\_TOKEN and OS\_URL environment  
variables also using V3 of the identity API, but can't get the os\_user  
module to work with the same, setting environment variables in the  
playbook.

I'm on ansible 2.0.1.0.

Thanks for any help,  
Curtis.

---

<div class="post-metadata">

**Author:** ![Martins\_Balodis](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@Martins\_Balodis](https://forum.ansible.com/u/Martins_Balodis)\
**Post date:** [May 16, 2016, 12:32pm UTC](https://forum.ansible.com/t/os-token-environment-variable-with-os-modules/20754/2 "2016-05-16T12:32:29Z")

</div>

I have the same problem. The docs state that auth configuration could be read from environment via OS\_\* variables but it seems that doesn’t use the “OS\_TOKEN” environment variable. Right now I am running a bunch of commands like this:

- name: Create keystone domains with cli client  
command: openstack domain create --description “{{ item.description }}” {{ item.name }}  
environment: “{{ os\_keystone\_auth\_env }}”  
register: command\_result  
failed\_when: “‘two projects acting as domains with the same name’ not in command\_result.stderr and command\_result.stderr != ‘’”  
with\_items: “{{ keystone\_domains }}”
