# Reading custom values from ansible.cfg in an action plugin

**URL:** <https://forum.ansible.com/t/reading-custom-values-from-ansible-cfg-in-an-action-plugin/35216>\
**Category:** Ansible Project\
**Created:** [May 24, 2021, 11:54am UTC](https://forum.ansible.com/t/reading-custom-values-from-ansible-cfg-in-an-action-plugin/35216 "2021-05-24T11:54:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Gration](https://avatars.discourse-cdn.com/v4/letter/r/49beb7/32.png) [@Richard\_Gration](https://forum.ansible.com/u/Richard_Gration)\
**Post date:** [May 24, 2021, 11:54am UTC](https://forum.ansible.com/t/reading-custom-values-from-ansible-cfg-in-an-action-plugin/35216/1 "2021-05-24T11:54:49Z")

</div>

Hi group!

I wrote a custom inventory plugin and defined a bunch of custom options in the DOCUMENTATION string, for example

approle\_role\_id:  
description: Vault approle role\_id.  
env:

- name: VAULT\_APPROLE\_ROLE\_ID  
ini:
- section: inventory  
key: vault\_approle\_role\_id  
required: true  
type: string  
version\_added: “2.10”

I call self.\_read\_config\_data in my InventoryModule and then I can use self.get\_option(“approle\_role\_id”) to read my custom option.

I want to read a different option in my custom Action plugin, but so far I have not found a way to do it. I tried self.get\_option but get an error saying the method is no defined on ActionBase object. I have looked through the source code for Action plugins and have not seen a way to do what I want.

This section of the docs ([Plugin configuration & documentation standards](https://docs.ansible.com/ansible/latest/dev_guide/developing_plugins.html#id5)) seems to suggest that what I want to do is possible, to wit:

“To define configurable options for your plugin, describe them in the DOCUMENTATION section of the python file. Callback and connection plugins have declared configuration requirements this way since Ansible version 2.4; most plugin types now do the same.”

It says “most plugin types” though. Maybe it’s not available to action plugins, but I hope it’s just me missing something.

I could think of a few other ways I get the custom info to my Action plugin, but I really want to do it in the same way I use for my inventory plugin.

Any help gratefully received!

Cheers,  
Rich

---

<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:** [May 24, 2021, 1:48pm UTC](https://forum.ansible.com/t/reading-custom-values-from-ansible-cfg-in-an-action-plugin/35216/2 "2021-05-24T13:48:43Z")

</div>

Action plugins are not part of the 'configurable plugins', currently  
there is no common argument interface to use (though we are plannign  
one) and their documentation would be in a module of the same name.

list of configurable plugins  
[https://github.com/ansible/ansible/blob/devel/lib/ansible/constants.py#L109](https://github.com/ansible/ansible/blob/devel/lib/ansible/constants.py#L109)
