netbox_community.ansible_modules.netbox_tenant (0.1.10) — module

Creates or removes tenants from Netbox

| "added in version" 0.1.0 of netbox_community.ansible_modules"

Authors: Amy Liebowitz (@amylieb)

preview | supported by community

Install collection

Install with ansible-galaxy collection install netbox_community.ansible_modules:==0.1.10


Add to requirements.yml

  collections:
    - name: netbox_community.ansible_modules
      version: 0.1.10

Description

Creates or removes tenants from Netbox


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Test Netbox module"
  connection: local
  hosts: localhost
  gather_facts: False
  tasks:
    - name: Create tenant within Netbox with only required information
      netbox_tenant:
        netbox_url: http://netbox.local
        netbox_token: thisIsMyToken
        data:
          name: Tenant ABC
        state: present

    - name: Delete tenant within netbox
      netbox_tenant:
        netbox_url: http://netbox.local
        netbox_token: thisIsMyToken
        data:
          name: Tenant ABC
        state: absent

    - name: Create tenant with all parameters
      netbox_tenant:
        netbox_url: http://netbox.local
        netbox_token: thisIsMyToken
        data:
          name: Tenant ABC
          group: Very Special Tenants
          description: ABC Incorporated
          comments: '### This tenant is super cool'
          slug: tenant_abc
          tags:
            - tagA
            - tagB
            - tagC
        state: present

Inputs

    
data:
    description:
    - Defines the tenant configuration
    required: true
    suboptions:
      comments:
        description:
        - Comments for the tenant. This can be markdown syntax
        type: str
      custom_fields:
        description:
        - must exist in Netbox
        type: dict
      description:
        description:
        - The description of the tenant
        type: str
      name:
        description:
        - Name of the tenant to be created
        required: true
        type: str
      slug:
        description:
        - URL-friendly unique shorthand
        type: str
      tags:
        description:
        - Any tags that the tenant may need to be associated with
        type: list
      tenant_group:
        description:
        - Tenant group this tenant should be in
        type: str
    type: dict

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

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

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

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
tenant:
  description: Serialized object as created or already existent within Netbox
  returned: on creation
  type: dict