# get\_config in Ansible 2.5.0 API

**URL:** <https://forum.ansible.com/t/get-config-in-ansible-2-5-0-api/27097>\
**Category:** Ansible Developer\
**Created:** [March 23, 2018, 5:46pm UTC](https://forum.ansible.com/t/get-config-in-ansible-2-5-0-api/27097 "2018-03-23T17:46:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [March 23, 2018, 5:46pm UTC](https://forum.ansible.com/t/get-config-in-ansible-2-5-0-api/27097/1 "2018-03-23T17:46:15Z")

</div>

I have some lookup plugins that I’d like to move to Ansible 2.5.0.

Parts of the code:  
imports:

```auto
from ansible.constants import p, get_config

```

and then in the code I can do:

```auto
passwordstate_uri = get_config(p, passwordstate_config, "passwordstate_uri", "PASSWORDSTATE_URI","")

```

This would read the "passwordstate\_uri from ansible config, or optionally the PASSWORDSTATE\_URI envvar. However, in Ansible 2.5.0 all of this is gone.  
What’s the recommended way to read from ansible.cfg in Ansible 2.5.0?

I’m assuming that this is related: [https://github.com/ansible/ansible/issues/25820](https://github.com/ansible/ansible/issues/25820)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 23, 2018, 5:51pm UTC](https://forum.ansible.com/t/get-config-in-ansible-2-5-0-api/27097/2 "2018-03-23T17:51:00Z")

</div>

I'm writing the new docs, but the short, DONT use get\_config, use  
self.get\_option('passwordstate\_uri') after you define the option in  
the DOCUMENTATION variable inside the lookup

in this example  
[https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/redis.py#L7](https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/redis.py#L7)

you can see how to define ini entries and env vars that the lookup can consume.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [March 23, 2018, 6:02pm UTC](https://forum.ansible.com/t/get-config-in-ansible-2-5-0-api/27097/3 "2018-03-23T18:02:59Z")

</div>

awesome, thanks for the quick reply!!

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [March 23, 2018, 6:04pm UTC](https://forum.ansible.com/t/get-config-in-ansible-2-5-0-api/27097/4 "2018-03-23T18:04:10Z")

</div>

the new api looks super-clean btw, sweet!
