community.general.omapi_host module – Setup OMAPI hosts

Note

This module is part of the community.general collection (version 9.5.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.general.omapi_host.

Synopsis

  • Manage OMAPI hosts into compatible DHCPd servers

Requirements

The below requirements are needed on the host that executes this module.

  • pypureomapi

Parameters

Parameter

Comments

ddns

boolean

Enable dynamic DNS updates for this host.

Choices:

  • false ← (default)

  • true

host

string

Sets OMAPI server host to interact with.

Default: "localhost"

hostname

aliases: name

string

Sets the host lease hostname (mandatory if state=present).

ip

string

Sets the lease host IP address.

key

string / required

Sets the TSIG key content for authenticating against OMAPI server.

key_name

string / required

Sets the TSIG key name for authenticating against OMAPI server.

macaddr

string / required

Sets the lease host MAC address.

port

integer

Sets the OMAPI server port to interact with.

Default: 7911

state

string / required

Create or remove OMAPI host.

Choices:

  • "absent"

  • "present"

statements

list / elements=string

Attach a list of OMAPI DHCP statements with host lease (without ending semicolon).

Default: []

Attributes

Attribute

Support

Description

check_mode

Support: none

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Examples

- 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

- 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

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

lease

complex

dictionary containing host information

Returned: success

hardware-address

string

MAC address

Returned: success

Sample: "00:11:22:33:44:55"

hardware-type

integer

hardware type, generally ‘1’

Returned: success

Sample: 1

ip-address

string

IP address, if there is.

Returned: success

Sample: "192.168.1.5"

name

string

hostname

Returned: success

Sample: "mydesktop"

Authors

  • Loic Blot (@nerzhul)