From 9d63be35e3d860c0e8764e3b3cd9c04dcea1a547 Mon Sep 17 00:00:00 2001 From: Rath Pascal Date: Tue, 7 Jan 2025 21:18:52 +0100 Subject: [PATCH] add kea-dhcp to service and reload modules (fix #137) --- docs/source/modules/2_reload.rst | 2 +- docs/source/modules/service.rst | 2 +- plugins/modules/reload.py | 5 +++++ plugins/modules/service.py | 2 +- tests/reload.yml | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/source/modules/2_reload.rst b/docs/source/modules/2_reload.rst index ae1f9b52..1515e6fa 100644 --- a/docs/source/modules/2_reload.rst +++ b/docs/source/modules/2_reload.rst @@ -26,7 +26,7 @@ Definition :header: "Parameter", "Type", "Required", "Default", "Aliases", "Comment" :widths: 15 10 10 10 10 45 - "target","string","true","\-","tgt, t","What part of the running config should be reloaded. One of: 'alias', 'rule', 'route', 'cron', 'unbound', 'syslog', 'ipsec', 'ipsec_legacy', 'shaper', 'monit', 'wireguard', 'interface_vlan', 'interface_vxlan', 'interface_vip', 'interface_lagg', 'frr', 'webproxy', 'bind', 'ids', 'dhcrelay'" + "target","string","true","\-","tgt, t","What part of the running config should be reloaded. One of: 'alias', 'rule', 'route', 'cron', 'unbound', 'syslog', 'ipsec', 'ipsec_legacy', 'shaper', 'monit', 'wireguard', 'interface_vlan', 'interface_vxlan', 'interface_vip', 'interface_lagg', 'frr', 'webproxy', 'bind', 'ids', 'dhcrelay', 'dhcp', 'kea'" .. include:: ../_include/param_basic.rst diff --git a/docs/source/modules/service.rst b/docs/source/modules/service.rst index 3da74505..d59acd56 100644 --- a/docs/source/modules/service.rst +++ b/docs/source/modules/service.rst @@ -22,7 +22,7 @@ Definition :header: "Parameter", "Type", "Required", "Default", "Aliases", "Comment" :widths: 15 10 10 10 10 45 - "name","string","true","\-","service, target, svc, n","Pretty name of the service to interact with. One of: 'acme_client', 'apcupsd', 'bind', 'captive_portal', 'chrony', 'cicap', 'clamav', 'collectd', 'cron', 'crowdsec', 'dns_crypt_proxy', 'dyndns', 'fetchmail', 'freeradius', 'frr', 'ftp_proxy', 'haproxy', 'hwprobe', 'ids', 'iperf', 'ipsec', 'ipsec_legacy', 'lldpd', 'maltrail', 'mdns_repeater', 'monit', 'munin_node', 'netdata', 'netsnmp', 'nginx', 'node_exporter', 'nrpe', 'ntopng', 'nut', 'openconnect', 'openvpn', 'postfix', 'proxy', 'proxysso', 'puppet_agent', 'qemu_guest_agent', 'radsec_proxy', 'redis', 'relayd', 'rspamd', 'shadowsocks', 'shaper', 'siproxd', 'softether', 'sslh', 'stunnel', 'syslog', 'tayga', 'telegraf', 'tftp', 'tinc', 'tor', 'udp_broadcast_relay', 'unbound', 'vnstat', 'wireguard', 'zabbix_agent', 'zabbix_proxy'" + "name","string","true","\-","service, target, svc, n","Pretty name of the service to interact with. One of: 'acme_client', 'apcupsd', 'bind', 'captive_portal', 'chrony', 'cicap', 'clamav', 'collectd', 'cron', 'crowdsec', 'dns_crypt_proxy', 'dyndns', 'fetchmail', 'freeradius', 'frr', 'ftp_proxy', 'haproxy', 'hwprobe', 'ids', 'iperf', 'ipsec', 'ipsec_legacy', 'lldpd', 'maltrail', 'mdns_repeater', 'monit', 'munin_node', 'netdata', 'netsnmp', 'nginx', 'node_exporter', 'nrpe', 'ntopng', 'nut', 'openconnect', 'openvpn', 'postfix', 'proxy', 'proxysso', 'puppet_agent', 'qemu_guest_agent', 'radsec_proxy', 'redis', 'relayd', 'rspamd', 'shadowsocks', 'shaper', 'siproxd', 'softether', 'sslh', 'stunnel', 'syslog', 'tayga', 'telegraf', 'tftp', 'tinc', 'tor', 'udp_broadcast_relay', 'unbound', 'vnstat', 'wireguard', 'zabbix_agent', 'zabbix_proxy', 'kea' (dhcp)" "action","string","true","\-","do, a","What action to execute. Some services may not support all of these actions (*the module will inform you in that case*). One of: 'status', 'start', 'reload', 'restart', 'stop'" .. include:: ../_include/param_basic.rst diff --git a/plugins/modules/reload.py b/plugins/modules/reload.py index f3977e5f..fc8a342f 100644 --- a/plugins/modules/reload.py +++ b/plugins/modules/reload.py @@ -50,6 +50,7 @@ def run_module(): 'ids', 'openvpn', 'dhcrelay', + 'dhcp', 'kea', ], description='What part of the running config should be reloaded' ), @@ -162,6 +163,10 @@ def run_module(): from ansible_collections.ansibleguy.opnsense.plugins.module_utils.main.dhcrelay_relay import \ DhcRelayRelay as Target_Obj + elif target in ['dhcp', 'kea']: + from ansible_collections.ansibleguy.opnsense.plugins.module_utils.main.dhcp_reservation_v4 import \ + ReservationV4 as Target_Obj + except MODULE_EXCEPTIONS: module_dependency_error() diff --git a/plugins/modules/service.py b/plugins/modules/service.py index 1f5f350d..bc4f66de 100644 --- a/plugins/modules/service.py +++ b/plugins/modules/service.py @@ -43,7 +43,7 @@ }, }, # note: these would support more actions: - 'ids': {}, 'proxy': {}, 'unbound': {}, + 'ids': {}, 'proxy': {}, 'unbound': {}, 'kea': {}, # plugins 'ftp_proxy': {'c': 'ftpproxy'}, 'iperf': {'a': ['reload', 'status', 'start', 'restart']}, diff --git a/tests/reload.yml b/tests/reload.yml index 59eaf585..e0fa6437 100644 --- a/tests/reload.yml +++ b/tests/reload.yml @@ -37,4 +37,5 @@ - 'ids' - 'openvpn' - 'dhcrelay' + - 'dhcp' # - 'gateway' # issue 88