community.general
community.general copied to clipboard
nmcli: Allow appending DNS nameserver (nmcli conn modify +ipv4.dns / +ipv6.dns)
Summary
In recent nmcli it's possible to issue a command which only appends new nameservers, as in the example:
nmcli con mod my-con-em1 +ipv4.dns 1.2.3.4
https://man.archlinux.org/man/nmcli-examples.7.en
It would be nice for the nmcli module to be able to issue that command with a slight extension of the existing syntax like:
- name: Add two IPv4 DNS server addresses, remove one
nmcli:
conn_name: my-eth1
type: ethernet
dns4:
- +1.2.3.4
- +5.6.7.8
- -9.8.7.6
state: present
Issue Type
Feature Idea
Component Name
nmcli
Additional Information
I want to add extra nameservers to a connection on a virtual machine which is configured through cloud-init and dhcpclient (which makes it unwise to touch /etc/resolv.conf and /etc/dhcp/dhclient.conf ).
The dns4 / dns6 parameter works fine, as per https://docs.ansible.com/ansible/2.9/modules/nmcli_module.html#parameter-dns4 , but completely removes the pre-existing nameserver, which I'd like to keep.
Moved from https://github.com/ansible/ansible/issues/78184
Code of Conduct
- [X] I agree to follow the Ansible Code of Conduct
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 @alcamie101 click here for bot help
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.