From a192336b4cf1b1645e6545032aa3249f746c1cc9 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Tue, 2 Jan 2024 20:55:55 -0700 Subject: [PATCH] [pfsense_dns_resolver] Fixup defaults; Add wiki link --- README.md | 2 +- plugins/modules/pfsense_dns_resolver.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index af87ffbe..9991c21d 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ The following modules are currently available: * [pfsense_cert](https://github.com/pfsensible/core/wiki/pfsense_cert) for Certificates * [pfsense_default_gateway](https://github.com/pfsensible/core/wiki/pfsense_default_gateway) for setting the default gateways * [pfsense_dhcp_static](https://github.com/pfsensible/core/wiki/pfsense_dhcp_static) for static DHCP entries -* pfsense_dns_resolver for DNS resolver (unbound) settings +* [pfsense_dns_resolver](https://github.com/pfsensible/core/wiki/pfsense_dns_resolver) for DNS resolver (unbound) settings * [pfsense_gateway](https://github.com/pfsensible/core/wiki/pfsense_gateway) for routing gateways * [pfsense_group](https://github.com/pfsensible/core/wiki/pfsense_group) for user groups * [pfsense_interface](https://github.com/pfsensible/core/wiki/pfsense_interface) for interfaces diff --git a/plugins/modules/pfsense_dns_resolver.py b/plugins/modules/pfsense_dns_resolver.py index 90002b5d..ba218925 100644 --- a/plugins/modules/pfsense_dns_resolver.py +++ b/plugins/modules/pfsense_dns_resolver.py @@ -122,10 +122,12 @@ descr: description: A description may be entered here for administrative reference. required: false + default: "" type: str aliases: description: Additional names for this host. required: false + default: [] type: list elements: dict suboptions: @@ -144,7 +146,6 @@ domainoverrides: description: Domains for which the resolver's standard DNS lookup should be overridden. required: false - default: [] type: list elements: dict suboptions: @@ -216,7 +217,7 @@ edns_buffer_size: description: Number of bytes to advertise as the EDNS reassembly buffer size. required: false - default: "4096" + default: "auto" choices: [ "auto", "512", "1220", "1232", "1432", "1480", "4096" ] type: str num_queries_per_thread: @@ -303,7 +304,7 @@ DNS_RESOLVER_DOMAIN_OVERRIDE_SPEC = dict( domain=dict(required=True, type='str'), ip=dict(required=True, type='str'), - descr=dict(default='', type='str'), + descr=dict(type='str'), tls_hostname=dict(default='', type='str'), forward_tls_upstream=dict(default='', type='str'), ) @@ -347,7 +348,7 @@ regovpnclients=dict(default=False, type='bool'), custom_options=dict(default="", type='str'), hosts=dict(default=[], type='list', elements='dict', options=DNS_RESOLVER_HOST_SPEC), - domainoverrides=dict(default=[], type='list', elements='dict', options=DNS_RESOLVER_DOMAIN_OVERRIDE_SPEC), + domainoverrides=dict(type='list', elements='dict', options=DNS_RESOLVER_DOMAIN_OVERRIDE_SPEC), # Advanced Settings hideidentity=dict(default=True, type='bool'), hideversion=dict(default=True, type='bool'), @@ -361,7 +362,7 @@ msgcachesize=dict(default=4, type='int', choices=[4, 10, 20, 50, 100, 250, 512]), outgoing_num_tcp=dict(default=10, type='int', choices=[0, 10, 20, 30, 50]), incoming_num_tcp=dict(default=10, type='int', choices=[0, 10, 20, 30, 50]), - edns_buffer_size=dict(default="4096", type='str', choices=["auto", "512", "1220", "1232", "1432", "1480", "4096"]), + edns_buffer_size=dict(default="auto", type='str', choices=["auto", "512", "1220", "1232", "1432", "1480", "4096"]), num_queries_per_thread=dict(default=512, type='int', choices=[512, 1024, 2048]), jostle_timeout=dict(default=200, type='int', choices=[100, 200, 500, 1000]), cache_max_ttl=dict(default=86400, type='int'), @@ -462,6 +463,9 @@ def _params_to_obj(self): host["aliases"] = { "item": tmp_aliases } + else: + # Default is an empty element + host["aliases"] = "\n\t\t\t" return obj