community.general.omapi_host (8.5.0) — module

Setup OMAPI hosts

Authors: Loic Blot (@nerzhul)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manage OMAPI hosts into compatible DHCPd servers


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add a host using OMAPI
  community.general.omapi_host:
    key_name: defomapi
    key: +bFQtBCta6j2vWkjPkNFtgA==
    host: 10.98.4.55
    macaddr: 44:dd:ab:dd:11:44
    name: server01
    ip: 192.168.88.99
    ddns: true
    statements:
    - filename "pxelinux.0"
    - next-server 1.1.1.1
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a host using OMAPI
  community.general.omapi_host:
    key_name: defomapi
    key: +bFQtBCta6j2vWkjPkNFtgA==
    host: 10.1.1.1
    macaddr: 00:66:ab:dd:11:44
    state: absent

Inputs

    
ip:
    description:
    - Sets the lease host IP address.
    type: str

key:
    description:
    - Sets the TSIG key content for authenticating against OMAPI server.
    required: true
    type: str

ddns:
    default: false
    description:
    - Enable dynamic DNS updates for this host.
    type: bool

host:
    default: localhost
    description:
    - Sets OMAPI server host to interact with.
    type: str

port:
    default: 7911
    description:
    - Sets the OMAPI server port to interact with.
    type: int

state:
    choices:
    - absent
    - present
    description:
    - Create or remove OMAPI host.
    required: true
    type: str

macaddr:
    description:
    - Sets the lease host MAC address.
    required: true
    type: str

hostname:
    aliases:
    - name
    description:
    - Sets the host lease hostname (mandatory if state=present).
    type: str

key_name:
    description:
    - Sets the TSIG key name for authenticating against OMAPI server.
    required: true
    type: str

statements:
    default: []
    description:
    - Attach a list of OMAPI DHCP statements with host lease (without ending semicolon).
    elements: str
    type: list

Outputs

lease:
  contains:
    hardware-address:
      description: MAC address
      returned: success
      sample: 00:11:22:33:44:55
      type: str
    hardware-type:
      description: hardware type, generally '1'
      returned: success
      sample: 1
      type: int
    ip-address:
      description: IP address, if there is.
      returned: success
      sample: 192.168.1.5
      type: str
    name:
      description: hostname
      returned: success
      sample: mydesktop
      type: str
  description: dictionary containing host information
  returned: success
  type: complex