Skip to content

[FEED] incompatible and incomplete environment variables support for connection credentials #764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
penguincustodian opened this issue May 5, 2025 · 1 comment · May be fixed by #789
Assignees
Labels
feedback General feedback

Comments

@penguincustodian
Copy link

penguincustodian commented May 5, 2025

Provide your feedback
Currently only the lookup plugins from this collection support passing the connection credentials via environment variables, inventory and module plugins don't:

export ANSIBLE_LOOKUP_CHECKMK_SERVER_URL="https://myserver"
export ANSIBLE_LOOKUP_CHECKMK_SITE=mysite
export ANSIBLE_LOOKUP_CHECKMK_AUTOMATION_USER=automation
export ANSIBLE_LOOKUP_CHECKMK_AUTOMATION_SECRET=mysecret
export ANSIBLE_LOOKUP_CHECKMK_VALIDATE_CERTS=False

This was implemented in #546.

However, there is a problem with this implementation, when using AWX/Ansible Automation Platform: It is disallowed to create a custom Credential Type with "ANSIBLE_*" env-vars injector configurations:

Environment variable ANSIBLE_LOOKUP_CHECKMK_AUTOMATION_SECRET may affect Ansible configuration so its use is not allowed in credentials.

Which makes sense, as ANSIBLE_* env-vars are "traditionally" reserved for ansible-core configurations and not for third party collections. Judging from several other third party collections, the usual naming scheme seems to be just a prefix of the managed product/namespace, e.g. "CHECKMK_". For a transition period I would suggest adding env-vars with a compatible naming schema (e.g. CHECKMK_SERVER_URL, CHECKMK_SITE, CHECKMK_AUTOMATION_SECRET, etc) and keep the current names as fallbacks.

Additionally it would make sense to implement the support for the env-vars in inventory plugins and modules as well. Plugins all use the same way to parse enviroment variables for parameters (via DOCUMENTATION docstring, also able to externalize that via doc_fragments), modules use the argspec fallback option with env_fallback, as for example seen here: https://github.com/ansible-collections/community.vmware/blob/main/plugins/module_utils/_argument_spec.py

Collection Version
v5.8.0

@robin-checkmk
Copy link
Member

Hi @penguincustodian and thanks for bringing this to our attention!
Do you think you are up to the task of changing this yourself and creating a pull request?
We are usually pretty pressed for resources and have little time to work on these quality-of-life improvements.
So feel free to get started on a PR, otherwise someone will pick this up at some point.

@robin-checkmk robin-checkmk linked a pull request Jun 4, 2025 that will close this issue
8 tasks
@robin-checkmk robin-checkmk linked a pull request Jun 6, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback General feedback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants