netbox_community.ansible_modules.netbox_rack (0.1.10) — module

Create, update or delete racks within Netbox

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

Authors: Mikhail Yohman (@FragmentedPacket)

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, updates or removes racks 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 rack within Netbox with only required information
      netbox_rack:
        netbox_url: http://netbox.local
        netbox_token: thisIsMyToken
        data:
          name: Test rack
          site: Test Site
        state: present

    - name: Delete rack within netbox
      netbox_rack:
        netbox_url: http://netbox.local
        netbox_token: thisIsMyToken
        data:
          name: Test Rack 
        state: absent

Inputs

    
data:
    description:
    - Defines the rack configuration
    required: true
    suboptions:
      asset_tag:
        description:
        - Asset tag that is associated to the rack
      comments:
        description:
        - Comments that may include additional information in regards to the rack
      custom_fields:
        description:
        - must exist in Netbox
      desc_units:
        description:
        - Rack units will be numbered top-to-bottom
        type: bool
      facility_id:
        description:
        - The unique rack ID assigned by the facility
      name:
        description:
        - The name of the rack
        required: true
      outer_depth:
        description:
        - The outer depth of the rack
      outer_unit:
        choices:
        - Millimeters
        - Inches
        description:
        - Whether the rack unit is in Millimeters or Inches and is I(required) if outer_width/outer_depth
          is specified
      outer_width:
        description:
        - The outer width of the rack
      rack_group:
        description:
        - The rack group the rack will be associated to
      rack_role:
        description:
        - The rack role the rack will be associated to
      serial:
        description:
        - Serial number of the rack
      site:
        description:
        - Required if I(state=present) and the rack does not exist yet
      status:
        choices:
        - Active
        - Planned
        - Reserved
        - Available
        - Deprecated
        description:
        - The status of the rack
      tags:
        description:
        - Any tags that the rack may need to be associated with
      tenant:
        description:
        - The tenant that the device will be assigned to
      type:
        choices:
        - 2-post frame
        - 4-post frame
        - 4-post cabinet
        - Wall-mounted frame
        - Wall-mounted cabinet
        description:
        - The type of rack
      u_height:
        description:
        - The height of the rack in rack units
      width:
        choices:
        - 19
        - 23
        description:
        - The rail-to-rail width

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
rack:
  description: Serialized object as created or already existent within Netbox
  returned: success (when I(state=present))
  type: dict