-
Notifications
You must be signed in to change notification settings - Fork 218
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
[Feature]: Supports connection information environment variables for modules #1363
Comments
It can probably be achieved using netbox_url=dict(type="str", required=True, fallback=(env_fallback, ["NETBOX_API"])), If there is no problem with the method, I will submit a PR. |
Why don't you use module defaults? https://netbox-ansible-collection.readthedocs.io/en/latest/getting_started/how-to-use/advanced.html#using-module-defaults-groups |
I think perhaps the module defaults should always consult the existing - hosts: all
module_defaults:
group/netbox.netbox.netbox:
netbox_url: "{{ lookup('ansible.builtin.env', 'NETBOX_API') }}"
netbox_token: "{{ lookup('ansible.builtin.env', 'NETBOX_TOKEN') }}" Alternatively, we could update the documentation for module defaults to have this. |
I want to separate connection options from playbooks and roles. For example, the |
NetBox version
v3.20.0
Feature type
Change to existing Module
Proposed functionality
I want to use
NETBOX_API
,NETBOX_TOKEN
,NETBOX_API_KEY
environment variables in modules. Like thenb_inventory
inventory plugin.Use case
The
netbox_url
andnetbox_token
options for each module will be no longer needed.Example:
I want to avoid duplicate settings it using a method other than
module defaults
.External dependencies
N/A
The text was updated successfully, but these errors were encountered: