Skip to content

[Feature]: Supports connection information environment variables for modules #1363

Open
@akira6592

Description

@akira6592

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 the nb_inventory inventory plugin.

Use case

The netbox_url and netbox_token options for each module will be no longer needed.

Example:

- name: "Test NetBox modules"
  connection: local
  hosts: localhost
  gather_facts: false
  environment:  # or export command or custom credential
    NETBOX_API: http://netbox.local
    NETBOX_TOKEN: thisIsMyToken

  tasks:
    - name: Create ASN within NetBox with only required information
      netbox.netbox.netbox_asn:
        data:
          asn: 1111111111
          rir: RFC1111
          description: test ASN
        state: present

    - name: Delete ASN within netbox
      netbox.netbox.netbox_asn:
        data:
          asn: 1111111111
        state: absent

I want to avoid duplicate settings it using a method other than module defaults.

External dependencies

N/A

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions