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
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ec141d3e-b3da-40cc-adde-bec977aa06c2n%40googlegroups.com.