|
43 | 43 | # Managed by ansible/cifmw
|
44 | 44 | nameserver {{ _crc.ip_v4 }}
|
45 | 45 |
|
| 46 | + - name: Reload NetworkManager to ensure it read the conf changes |
| 47 | + become: true |
| 48 | + ansible.builtin.service: |
| 49 | + name: NetworkManager |
| 50 | + state: "reloaded" |
| 51 | + |
46 | 52 | - name: Check which dnsmasq config we must edit
|
47 | 53 | register: _dnsmasq
|
48 | 54 | ansible.builtin.stat:
|
|
84 | 90 | regexp: "listen-address={{ _crc.ip_v4 }}"
|
85 | 91 | replace: "listen-address={{ _crc.ip_v4 }},127.0.0.1"
|
86 | 92 |
|
87 |
| - - name: Reboot CRC node |
| 93 | + - name: Restart dnsmasq service when available |
| 94 | + when: not _dnsmasq.stat.exists |
88 | 95 | become: true
|
89 |
| - ansible.builtin.reboot: |
| 96 | + ansible.builtin.service: |
| 97 | + name: dnsmasq |
| 98 | + state: "restarted" |
| 99 | + |
| 100 | + - name: Restart dnsmasq container for older crc versions |
| 101 | + when: _dnsmasq.stat.exists |
| 102 | + become: true |
| 103 | + block: |
| 104 | + # taken from |
| 105 | + # https://github.com/openstack-k8s-operators/ci-framework/blob/73e5170693c18f5d244c91f83ad240f6804cbec9/ci/playbooks/multinode-customizations.yml#L111 |
| 106 | + # Avoid 'state: restarted' due to issues with IP not |
| 107 | + # available when crc-dnsmasq starts |
| 108 | + - name: Stop dnsmasq |
| 109 | + become: true |
| 110 | + ansible.builtin.systemd: |
| 111 | + state: stopped |
| 112 | + name: crc-dnsmasq |
| 113 | + |
| 114 | + - name: Make sure that crc-dnsmasq is not running |
| 115 | + containers.podman.podman_container: |
| 116 | + name: crc-dnsmasq |
| 117 | + state: absent |
| 118 | + |
| 119 | + - name: Start dnsmasq |
| 120 | + become: true |
| 121 | + ansible.builtin.systemd: |
| 122 | + state: started |
| 123 | + name: crc-dnsmasq |
| 124 | + register: _dnsmasq_start_reg |
| 125 | + retries: 15 |
| 126 | + delay: 20 |
| 127 | + until: |
| 128 | + - _dnsmasq_start_reg.failed is false |
| 129 | + - _dnsmasq_start_reg.status is defined |
| 130 | + - _dnsmasq_start_reg.status.ActiveState == "active" |
90 | 131 |
|
91 | 132 | - name: Ensure hypervisor has the right CRC IP
|
92 | 133 | become: true
|
|
0 commit comments