community.general.kea_command module – Submits generic command to ISC KEA server on target
Note
This module is part of the community.general collection (version 12.0.0).
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.
To use it in a playbook, specify: community.general.kea_command.
New in community.general 12.0.0
Synopsis
Submits a command to the JSON API of an ISC KEA server running on the target and obtains the result.
This module supports sending arbitrary commands and returns the server response unchecked; while it would be possible to write individual modules for specific KEA service commands, that approach would not scale, as the FOSS hooks alone provide dozens of commands.
Between sending the command and parsing the result status,
changedwill register astrueif an error occurs, to err on the safe side.
Parameters
Parameter |
Comments |
|---|---|
The arguments sent along with the command, if any. Use |
|
The name of the command to send, for example |
|
A list of Omit this for most acquisition commands. Set it to Any
Default: |
|
A list of Set this to Use Any
Default: |
|
The full pathname of the Unix Domain Socket to connect to. The default value is suitable for This module directly interfacees via UDS; the HTTP wrappers are not supported. Default: |
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: none |
Can run in |
|
Support: none |
Returns details on what has changed (or possibly needs changing in |
|
Platform: posix |
Target OS/families that can be operated against. |
Examples
vars:
ipaddr: "192.168.123.45"
hwaddr: "00:00:5E:00:53:00"
tasks:
# an example for a request acquiring information
- name: Get KEA DHCP6 status
kea_command:
command: status-get
rv_unchanged: [0]
socket: /run/kea/kea6-ctrl-socket
register: kea6_status
- name: Display registered status result
ansible.builtin.debug:
msg: KEA DHCP6 running on PID {{ kea6_status.response.arguments.pid }}
# an example for requests modifying state
- name: Remove existing leases for {{ ipaddr }}, if any
kea_command:
command: lease4-del
arguments:
ip-address: "{{ ipaddr }}"
rv_changed: [0]
rv_unchanged: [3]
- name: Add DHCP lease for {{ ipaddr }}
kea_command:
command: lease4-add
arguments:
ip-address: "{{ ipaddr }}"
hw-address: "{{ hwaddr }}"
rv_changed: [0]
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The server JSON response. Returned: when available |