netbox_community.ansible_modules.netbox_service (0.1.10) — module

Creates or removes service from Netbox

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

Authors: Kulakov Ilya (@TawR1024)

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 service from Netbox


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create netbox service"
  connection: local
  hosts: all
  gather_facts: False

  tasks:
    - name: Create service
      netbox_service:
        netbox_url: netbox_url
        netbox_token: netbox_token
        data:
          device: Test666
          name: node-exporter
          port: 9100
          protocol: 6
        state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Delete netbox service"
  connection: local
  hosts: all
  gather_facts: False

  tasks:
    - name: Delete service
      netbox_service:
        netbox_url: netbox_url  
        netbox_token: netbox_token
        data:
          device: Test666
          name: node-exporter
          port: 9100
          protocol: 6
        state: absent

Inputs

    
data:
    description:
    - Defines the service configuration
    required: true
    suboptions:
      custom_fields:
        description:
        - Must exist in Netbox and in key/value format
        type: dict
      description:
        description:
        - Service description
        type: str
      device:
        description:
        - Specifies on which device the service is running
        type: raw
      ipaddress:
        description:
        - VRF that prefix is associated with
        type: str
      port:
        description:
        - Specifies which port used by service
        type: int
      protocol:
        choices:
        - 6 TCP
        - 17 UDP
        description:
        - Specifies which protocol used by service
        type: int
      virtual_machine:
        description: null
        type: raw

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
    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