|
83 | 83 | - reload systemd
|
84 | 84 | - restart libvirt
|
85 | 85 |
|
86 |
| -- name: Create directory for TLS certificates and keys |
| 86 | +- name: Create directory for Libvirt TLS certificates and keys |
87 | 87 | file:
|
88 | 88 | path: "{{ item }}"
|
89 | 89 | state: directory
|
|
100 | 100 | when:
|
101 | 101 | - libvirt_host_tls_listen | bool
|
102 | 102 |
|
103 |
| -- name: Copy TLS certificates and keys |
| 103 | +- name: Copy Libvirt TLS certificates and keys |
104 | 104 | copy:
|
105 | 105 | content: "{{ _libvirt_loop_item.content }}"
|
106 | 106 | dest: "{{ _libvirt_loop_item.dest }}"
|
|
131 | 131 | loop: "{{ libvirt_host_sasl_credentials }}"
|
132 | 132 | when: libvirt_host_enable_sasl_support | bool
|
133 | 133 |
|
| 134 | +- name: Create directory for QEMU TLS certificates and keys |
| 135 | + file: |
| 136 | + path: "{{ item }}" |
| 137 | + state: directory |
| 138 | + owner: "{{ libvirt_host_qemu_user }}" |
| 139 | + group: "{{ libvirt_host_qemu_group }}" |
| 140 | + mode: 0700 |
| 141 | + become: true |
| 142 | + loop: >- |
| 143 | + {{ _libvirt_host_qemu_tls_certs.values() | |
| 144 | + selectattr('content') | |
| 145 | + map(attribute='dest') | |
| 146 | + map('dirname') | |
| 147 | + unique }} |
| 148 | + when: |
| 149 | + - libvirt_host_qemu_tls_enabled | bool |
| 150 | + |
| 151 | +- name: Copy QEMU TLS certificates and keys |
| 152 | + copy: |
| 153 | + content: "{{ _libvirt_host_qemu_loop_item.content }}" |
| 154 | + dest: "{{ _libvirt_host_qemu_loop_item.dest }}" |
| 155 | + owner: "{{ libvirt_host_qemu_user }}" |
| 156 | + group: "{{ libvirt_host_qemu_group }}" |
| 157 | + mode: "{{ _libvirt_host_qemu_loop_item.mode }}" |
| 158 | + become: true |
| 159 | + # NOTE: Loop over keys of _libvirt_host_qemu_tls_certs to avoid leaking the key |
| 160 | + # contents. |
| 161 | + loop: "{{ _libvirt_host_qemu_tls_certs.keys() }}" |
| 162 | + when: |
| 163 | + - libvirt_host_qemu_tls_enabled | bool |
| 164 | + - _libvirt_host_qemu_loop_item.content |
| 165 | + vars: |
| 166 | + _libvirt_host_qemu_loop_item: "{{ _libvirt_host_qemu_tls_certs[item] }}" |
| 167 | + notify: restart libvirt |
| 168 | + |
| 169 | +- name: Create directory for Libvirt VNC TLS certificates and keys |
| 170 | + file: |
| 171 | + path: "{{ item }}" |
| 172 | + state: directory |
| 173 | + owner: "{{ libvirt_host_qemu_user }}" |
| 174 | + group: "{{ libvirt_host_qemu_group }}" |
| 175 | + mode: 0700 |
| 176 | + become: true |
| 177 | + loop: >- |
| 178 | + {{ _libvirt_host_vnc_tls_certs.values() | |
| 179 | + selectattr('content') | |
| 180 | + map(attribute='dest') | |
| 181 | + map('dirname') | |
| 182 | + unique }} |
| 183 | + when: |
| 184 | + - libvirt_host_vnc_tls_enabled | bool |
| 185 | + |
| 186 | +- name: Copy Libvirt VNC TLS certificates and keys |
| 187 | + copy: |
| 188 | + content: "{{ _libvirt_host_vnc_loop_item.content }}" |
| 189 | + dest: "{{ _libvirt_host_vnc_loop_item.dest }}" |
| 190 | + owner: "{{ libvirt_host_qemu_user }}" |
| 191 | + group: "{{ libvirt_host_qemu_group }}" |
| 192 | + mode: "{{ _libvirt_host_vnc_loop_item.mode }}" |
| 193 | + become: true |
| 194 | + # NOTE: Loop over keys of _libvirt_host_vnc_tls_certs to avoid leaking the key |
| 195 | + # contents. |
| 196 | + loop: "{{ _libvirt_host_vnc_tls_certs.keys() }}" |
| 197 | + when: |
| 198 | + - libvirt_host_vnc_tls_enabled | bool |
| 199 | + - _libvirt_host_vnc_loop_item.content |
| 200 | + vars: |
| 201 | + _libvirt_host_vnc_loop_item: "{{ _libvirt_host_vnc_tls_certs[item] }}" |
| 202 | + notify: restart libvirt |
| 203 | + |
134 | 204 | - name: Flush handlers
|
135 | 205 | meta: flush_handlers
|
136 | 206 |
|
|
0 commit comments