Skip to content

Commit f398f62

Browse files
author
Lewis Denny
committed
Add additional listen-address to CRC dnsmasq service
Due to this change [1] introduced in CRC 2.32.0[2] the dnsmasq service is now running as a systemd service rather than in a container. The behavior of the dnsmasq listen-address has now changed, the CRC dnsmasq only listens on the default address provided by Zuul. The Ansible controller is configured to query the interface we control on CRC, `ci-private-network`. This breaks domain name resolution as dns queries are blocked. This patch: - Updates the CRC dnsmasq listen-address configuration to include the `ci-private-network` address allowing the Ansible controller to query it. - Removes the hard coded `ci-private-network` address from the Ansible controllers default connection dns configuration to ensure they always match. [1] crc-org/crc@5f49891 [2] https://github.com/crc-org/crc/releases/tag/v2.32.0
1 parent a1e6798 commit f398f62

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

ci/playbooks/multinode-customizations.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@
100100
replace: >-
101101
{{ _crc_default_net_ip | ansible.utils.ipaddr('address') }}
102102
103+
- name: Configure dnsmasq listen-address to listen on both br-ex and ci-private-network
104+
become: true
105+
vars:
106+
_original_listen_address: "listen-address={{ hostvars['crc'].ansible_host }}"
107+
ansible.builtin.replace:
108+
path: "{{ _dnsmasq_config }}"
109+
regexp: "{{ _original_listen_address }}"
110+
replace: "{{ _original_listen_address }},{{ _crc_default_net_ip | ansible.utils.ipaddr('address') }}"
111+
103112
- name: Restart dnsmasq service if used
104113
become: true
105114
when:
@@ -196,6 +205,11 @@
196205
ansible.builtin.set_fact:
197206
persistent_ssh_key: "{{ pub_key_slurp['content'] | b64decode }}"
198207

208+
- name: Load network parameters
209+
register: _cifmw_multinode_customizations_crc_net_env_slurp
210+
ansible.builtin.slurp:
211+
src: "/etc/ci/env/networking-info.yml"
212+
199213
- name: Check if cloud-init is overriding NM settings
200214
become: true
201215
ansible.builtin.stat:
@@ -223,13 +237,26 @@
223237
ansible.builtin.command:
224238
cmd: "nmcli -g general.connection device show eth0"
225239

226-
- name: Add the deployment DNS in the controller resolv.conf
240+
- name: Prepend CRC DNS server in the controllers default Network Manager connection configuation
227241
vars:
228-
dns_servers_string: "192.168.122.10 {{ ansible_facts['dns']['nameservers'][0:1] | join(' ') }}"
242+
_decoded_net_env: >-
243+
{{
244+
_cifmw_multinode_customizations_crc_net_env_slurp['content'] |
245+
b64decode | from_yaml
246+
}}
247+
_crc_default_net_ip: >-
248+
{{
249+
_decoded_net_env.crc_ci_bootstrap_networks_out.crc.default.ip |
250+
ansible.utils.ipaddr('address')
251+
}}
252+
dns_servers_string: >-
253+
{{
254+
( _crc_default_net_ip, ansible_facts['dns']['nameservers'][0:1] | join(' ') ) | list
255+
}}
229256
become: true
230257
ansible.builtin.shell:
231258
cmd: |-
232-
nmcli con mod '{{ controller_default_connection_out.stdout | trim }}' ipv4.dns '{{ dns_servers_string }}' ipv4.route-metric 100;
259+
nmcli con mod '{{ controller_default_connection_out.stdout | trim }}' ipv4.dns '{{ dns_servers_string | join(' ') }}' ipv4.route-metric 100;
233260
nmcli con up '{{ controller_default_connection_out.stdout | trim }}';
234261
235262
- name: "Ensure persistent SSH access"

0 commit comments

Comments
 (0)