--- - name: Get the networking-environment-definition from controller-0 delegate_to: controller-0 register: _net_conf ansible.builtin.slurp: path: /etc/ci/env/networking-environment-definition.yml - name: Configure CRC services delegate_to: crc-0 vars: _parsed: "{{ _net_conf.content | b64decode | from_yaml}}" _crc: "{{ _parsed.instances['crc-0'].networks.ctlplane }}" block: - name: Check which dnsmasq config we must edit register: _dnsmasq ansible.builtin.stat: path: '/srv/dnsmasq.conf' get_attributes: false get_checksum: false get_mime: false - name: Configure local DNS for CRC pod become: true vars: _config_file: >- {{ _dnsmasq.stat.exists | ternary(_dnsmasq.stat.path, '/etc/dnsmasq.d/crc-dnsmasq.conf') }} block: - name: Configure local DNS for CRC pod register: last_modification ansible.builtin.replace: path: "{{ _config_file }}" regexp: "192.168.130.11" replace: "{{ _crc.ip_v4 }}" - name: Ensure dnsmasq listens on correct interfaces ansible.builtin.replace: path: "{{ _config_file }}" regexp: "listen-address={{ _crc.ip_v4 }}" replace: "listen-address={{ _crc.ip_v4 }},127.0.0.1" - name: Restart DNS in CRC VM ansible.builtin.include_role: name: openshift_setup tasks_from: restart_dns.yml - name: Remove entry from /etc/hosts become: true vars: _parsed: "{{ _net_conf.content | b64decode | from_yaml}}" _crc: "{{ _parsed.instances['crc-0'].networks.ctlplane }}" ansible.builtin.blockinfile: state: absent path: "/etc/hosts" marker: "# {mark}" marker_begin: "Added by CRC" marker_end: "End of CRC section" - name: Inject our DNS in cifmw-dnsmasq vars: _parsed: "{{ _net_conf.content | b64decode | from_yaml}}" _crc: "{{ _parsed.instances['crc-0'].networks.ctlplane }}" _act: 'install' block: # Following official OCP-4.15 doc here: # https://docs.redhat.com/en/documentation/openshift_container_platform/4.15/html/installing/installing-on-a-single-node#install-sno-requirements-for-installing-on-a-single-node_install-sno-preparing - name: Inject wildcard A/AAAA record for apps-crc.testing when: - ip | length > 0 vars: cifmw_dnsmasq_address: - domains: - apps-crc.testing ipaddr: "{{ ip }}" state: present ansible.builtin.include_role: name: "dnsmasq" tasks_from: "manage_address.yml" loop: - "{{ _crc.ip_v4 | default('') }}" - "{{ _crc.ip_v6 | default('') }}" loop_control: loop_var: ip - name: Inject A/AAAA record for api/api-int.crc.testing vars: _ips: >- {% set output = [] -%} {% if _crc.ip_v4 is defined and _crc.ip_v4 | length > 0 -%} {% set _ = output.append(_crc.ip_v4) -%} {% endif -%} {% if _crc.ip_v6 is defined and _crc.ip_v6 | length > 0 -%} {% set _ = output.append(_crc.ip_v6) -%} {% endif -%} {{ output }} cifmw_dnsmasq_host_record: - names: - api.crc.testing - api-int.crc.testing ips: "{{ _ips }}" state: present ansible.builtin.include_role: name: "dnsmasq" tasks_from: "manage_host_record.yml" - name: Ensure "testing" domain is "local" become: true notify: "Restart dnsmasq" ansible.builtin.copy: dest: "{{ cifmw_dnsmasq_basedir }}/crc-local.conf" mode: "0644" content: | expand-hosts local=/testing/ domain=crc.testing - name: Flush handlers ansible.builtin.meta: flush_handlers