Update CHANGELOG for v1.3.4 release; add new features and bug fixes
Some checks failed
Test Collection / Sanity Tests (Ansible devel) (push) Failing after 12s
Test Collection / Sanity Tests (Ansible stable-2.15) (push) Failing after 28s
Test Collection / Sanity Tests (Ansible stable-2.16) (push) Failing after 27s
Test Collection / Sanity Tests (Ansible stable-2.17) (push) Failing after 28s
Test Collection / Python Syntax Check (push) Failing after 6s
Test Collection / Build Collection (push) Failing after 10s
Test Collection / YAML and Ansible Lint (push) Successful in 10s
Test Collection / Documentation Check (push) Successful in 7s
Test Collection / Unit Tests (push) Successful in 8s

Add example playbooks for filtering and updating DNS zones
Enhance nsupdate_zone module with default_ttl handling and improved diff output
This commit is contained in:
Daniel Akulenok
2026-01-29 22:28:35 +01:00
parent c46a17748a
commit 212e2c42a8
7 changed files with 227 additions and 6 deletions

View File

@@ -388,6 +388,12 @@ class DNSZoneManager:
self.current_zone = None
self.soa_minimum_ttl = 3600 # Default, will be updated from SOA
self.default_ttl = module.params.get('default_ttl') # User-specified default, or None to use SOA minimum
def _get_default_ttl(self) -> int:
"""Get the effective default TTL, preferring user-specified over SOA minimum."""
if self.default_ttl is not None:
return self.default_ttl
return self.soa_minimum_ttl
def _resolve_server(self) -> list[str]:
"""Resolve DNS server FQDN to IP addresses."""
@@ -506,7 +512,7 @@ class DNSZoneManager:
record_name = record_config['record']
record_type = record_config['type'].upper()
record_values = record_config['value']
record_ttl = record_config.get('ttl', self.soa_minimum_ttl)
record_ttl = record_config.get('ttl', self._get_default_ttl())
record_state = record_config.get('state', 'present')
# Normalize record name
@@ -880,7 +886,7 @@ class DNSZoneManager:
for record in sorted(changes['deletes'], key=lambda r: (r['name'].to_text(), r['type'])):
record_name = record['name'].to_text().rstrip('.')
record_type = record['type']
ttl = record.get('ttl', self.soa_minimum_ttl)
ttl = record.get(\'ttl\', self._get_default_ttl())
values = sorted(str(v) for v in record['values'])
for value in values:
before_lines.append(f"-{record_name:<34} {ttl:<10} {record_type:<10} {value}")
@@ -889,7 +895,7 @@ class DNSZoneManager:
for record in sorted(changes['adds'], key=lambda r: (r['name'].to_text(), r['type'])):
record_name = record['name'].to_text().rstrip('.')
record_type = record['type']
ttl = record.get('ttl', self.soa_minimum_ttl)
ttl = record.get(\'ttl\', self._get_default_ttl())
values = sorted(str(v) for v in record['values'])
for value in values:
after_lines.append(f"+{record_name:<34} {ttl:<10} {record_type:<10} {value}")
@@ -898,8 +904,8 @@ class DNSZoneManager:
for record in sorted(changes['updates'], key=lambda r: (r['name'].to_text(), r['type'])):
record_name = record['name'].to_text().rstrip('.')
record_type = record['type']
old_ttl = record.get('old_ttl', self.soa_minimum_ttl)
new_ttl = record.get('new_ttl', self.soa_minimum_ttl)
old_ttl = record.get(\'old_ttl\', self._get_default_ttl())
new_ttl = record.get(\'new_ttl\', self._get_default_ttl())
old_values = sorted(str(v) for v in record['old_values'])
new_values = sorted(str(v) for v in record['new_values'])