Skip to content
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]: nb_inventory - allowing api_endpoint to be a variable #1300

Open
bookshark13 opened this issue Aug 15, 2024 · 0 comments
Open

[Feature]: nb_inventory - allowing api_endpoint to be a variable #1300

bookshark13 opened this issue Aug 15, 2024 · 0 comments

Comments

@bookshark13
Copy link

NetBox version

v3.19.1

Feature type

Change to existing Plugin

Proposed functionality

Not a big change to code if you add:
self.api_endpoint = self.templar.template( self.get_option("api_endpoint"), fail_on_undefined=False)
to the nb_inventory plugin at
this will allow for the api_endpoint the option of being a variable all while maintaining it's ability to be a string.

Use case

In current Netbox Module the api_endpoint variable can only be a string. Ex: "https://netbox.at.your.domain.com"
If you try to inject a variable for api_endpoint like so api_endpoint: "{{ lookup('ansible.builtin.env', 'NETBOX_URL') }}"
The plugin will output that "{{ lookup('ansible.builtin.env', 'NETBOX_URL') }}"/api/status is not valid.

If you manage multiple environments with possibly different domain names this is quite useful. It allows you to define once in the code and carry it over to multiple environments while maintaining a credential with things like Ansible Controller vs changing your code.

External dependencies

N/A

bookshark13 added a commit to bookshark13/ansible_modules that referenced this issue Aug 15, 2024
Fixes issue-netbox-community#1300
allows api_endpoint to be a variable and string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant