Skip to content

Commit 995aa99

Browse files
danpawlikpraveenkumar
authored andcommitted
Add alternative domain into dnsmasq if set
The deployment will fail if the altnernative domain would not be found.
1 parent c826d9c commit 995aa99

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ansible/roles/deploy-crc-cloud/tasks/dnsmasq.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@
4141
dest: "{{ dnsmasq_conf_path }}"
4242
register: _dnsmasq_conf
4343

44+
- name: Add domains into crc-dnsmasq.conf when alternative_domain
45+
when: alternative_domain
46+
become: true
47+
ansible.builtin.blockinfile:
48+
path: "{{ dnsmasq_conf_path }}"
49+
block: |
50+
address=/apps.{{ eip }}.{{ alternative_domain }}/{{ ansible_default_ipv4.address }}
51+
address=/api.{{ eip }}.{{ alternative_domain }}/{{ ansible_default_ipv4.address }}
52+
address=/api-int.{{ eip }}.{{ alternative_domain }}/{{ ansible_default_ipv4.address }}
53+
4454
- name: Set this host as first nameserver in /etc/resolv.conf
4555
become: true
4656
ansible.builtin.lineinfile:
@@ -49,10 +59,9 @@
4959
line: "nameserver {{ item }}"
5060
create: true
5161
loop: "{{ [ansible_default_ipv4.address] + ansible_facts['dns']['nameservers'] | flatten }}"
52-
register: _etc_resolv
5362

5463
- name: Restart dnsmasq
55-
when: _etc_resolv.changed
64+
when: _dnsmasq_conf.changed
5665
become: true
5766
ansible.builtin.systemd:
5867
name: dnsmasq

0 commit comments

Comments
 (0)