fragmentedpacket.netbox_modules.netbox_provider (0.1.4) — module

Create, update or delete providers within Netbox

| "added in version" 0.1.0 of fragmentedpacket.netbox_modules"

Authors: Mikhail Yohman (@FragmentedPacket)

preview | supported by community

Install collection

Install with ansible-galaxy collection install fragmentedpacket.netbox_modules:==0.1.4


Add to requirements.yml

  collections:
    - name: fragmentedpacket.netbox_modules
      version: 0.1.4

Description

Creates, updates or removes providers from Netbox


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Test Netbox modules"
  connection: local
  hosts: localhost
  gather_facts: False

  tasks:
    - name: Create provider within Netbox with only required information
      netbox_provider:
        netbox_url: http://netbox.local
        netbox_token: thisIsMyToken
        data:
          name: Test Provider
        state: present

    - name: Update provider with other fields
      netbox_provider:
        netbox_url: http://netbox.local
        netbox_token: thisIsMyToken
        data:
          name: Test Provider
          asn: 65001
          account: 200129104
          portal_url: http://provider.net
          noc_contact: noc@provider.net
          admin_contact: admin@provider.net
          comments: "BAD PROVIDER"
        state: present

    - name: Delete provider within netbox
      netbox_provider:
        netbox_url: http://netbox.local
        netbox_token: thisIsMyToken
        data:
          name: Test Provider
        state: absent

Inputs

    
data:
    description:
    - Defines the provider configuration
    suboptions:
      account:
        description:
        - The account number of the provider
      admin_contact:
        description:
        - The admin contact of the provider
      asn:
        description:
        - The provider ASN
      comments:
        description:
        - Comments related to the provider
      custom_fields:
        description:
        - must exist in Netbox
      name:
        description:
        - The name of the provider
        required: true
      noc_contact:
        description:
        - The NOC contact of the provider
      portal_url:
        description:
        - The URL of the provider
      tags:
        description:
        - Any tags that the device may need to be associated with

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Use C(present) or C(absent) for adding or removing.

netbox_url:
    description:
    - URL of the Netbox instance resolvable by Ansible control host
    required: true

netbox_token:
    description:
    - The token created within Netbox to authorize API access
    required: true

validate_certs:
    default: 'yes'
    description:
    - If C(no), SSL certificates will not be validated. This should only be used on personally
      controlled sites using self-signed certificates.
    type: bool

Outputs

msg:
  description: Message indicating failure or info about what has been achieved
  returned: always
  type: str
provider:
  description: Serialized object as created or already existent within Netbox
  returned: success (when I(state=present))
  type: dict