summaryrefslogtreecommitdiffstats
path: root/deployment/playbooks/roles/setup-custom-domain-names/tasks/main.yaml
blob: d53fa43f650bb930796aabfb2b71d9b4ce397190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
- name: Import role with update of /etc/hosts file
  import_role:
    name: setup-custom-domain-names-for-ansible-runner

- name: Create directory for dnsmasq config file if absent
  file:
    dest: /etc/dnsmasq.d
    state: directory
    mode: 0644

- name: Create custom dnsmasq config file for current cluster
  file:
    dest: '/etc/dnsmasq.d/openshift-cluster-{{ cluster_id }}.conf'
    state: touch

- name: Remove stale data from custom dnsmasq config file is exist
  lineinfile:
    dest: '/etc/dnsmasq.d/openshift-cluster-{{ cluster_id }}.conf'
    regexp: "{{ item.value.0 }}"
    state: absent
  with_dict: "{{ current_cluster_ips }}"

- name: Write data to custom dnsmasq config file
  lineinfile:
    dest: '/etc/dnsmasq.d/openshift-cluster-{{ cluster_id }}.conf'
    line: "address=/{{ item.value.0 }}/{{ item.key }}\naddress=/{{ item.value.1 }}/{{ item.key }}"
    state: present
  with_dict: "{{ current_cluster_ips }}"