Open stephan2012 opened 2 years ago
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @nerzhul click here for bot help
I don't think this is a bug. This behavior is what's documented and what I would expect from using this module (disclaimer: I never used it). Allowing to only add entries (instead of replacing) would be a new feature.
The name force
for such an option is a bad choice; force
usually has different meanings for modules. I guess merge
or update
(boolean) would be better.
Agree, this is a feature request not a bug.
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
I was just looking at the code and tested a bit, the place the change would probably need to be made is around here.
Also from my testing the behavior of the module is actually bad/wrong because if multiple records already exist it will notice this and delete all leaving you with a single record.
Having multiple A/AAAA/MX/SRV/TXT records with different values is a fairly standard thing and though there are records for which the adage "there can only be one" applies this is not always the case.
Steps to reproduce:
server [dns server]
zone [your zone]
update add multirecordtest.[your domain]. A 10.0.0.1
update add multirecordtest.[your domain]. A 10.0.0.2
update add multirecordtest.[your domain]. A 10.0.0.3
send
Expected result - 4 A records 10.0.0.1-10.0.0.4 Actual results - only record 10.0.0.4
I realize that this does add some more complication to the nsupdate module but I do think it is a change that needs to happen.
IMHO the state
should be expanded to be {present|absent|update}
where:
Based on some conversations on IRC with @flowerysong and zoredache I would suggest an alternative solution:
Add another parameter that controls whether the module treats the tuple(record+type) or the triple(record+type+data) as the unique key.
This would be close to the solution @felixfontein proposed also.
Summary
Cannot add multiple SRV records because latter updates remove all previous. Multiple values for a single invocation of
nsupdate
allows multiple values but this is not idiomatic for Ansible.Here is how it looks like from the DNS server’s perspective:
nsupdate
currently allows records to be either present or absent. Maybe aforce
option is missing that allows changing the behavior from replace to merge.Issue Type
Bug Report
Component Name
nsupdate
Ansible Version
Community.general Version
Tested with Ansible v2.9 only, but the nsupdate code does not have changed for this particular topic.
Configuration
OS / Environment
Ubuntu 18.04.6 LTS, Ansible installed via
pip
Steps to Reproduce
Run this task in a playbook with two or more hosts.
Expected Results
nsupdate
should delete resouce records only if requested or sensible (e.g., PTR records).Actual Results
Code of Conduct