|
190 | 190 | # update its view, then set up the new mounts. Otherwise, |
191 | 191 | # systemd will forcibly prevent mounting a new volume to an |
192 | 192 | # existing mount point. |
193 | | -# ansible 2.9 (ansible-engine) uses the vendored mount_ansible_29 module, |
194 | | -# since ansible.posix cannot be installed there; other systems use the bare |
195 | | -# mount name, which redirects to the latest ansible.posix.mount. |
196 | | -- name: Remove obsolete mounts - ansible 2.9 |
197 | | - mount_ansible_29: |
| 193 | +# On managed nodes with python 2 (EL7 with ansible 2.9, where the |
| 194 | +# ansible.posix collection cannot be installed), use the dependency-free |
| 195 | +# vendored mount_python_27 module, which retains python 2 support. |
| 196 | +- name: Remove obsolete mounts - python 2 |
| 197 | + mount_python_27: |
198 | 198 | src: "{{ mount_info['src'] | default(omit) }}" |
199 | 199 | path: "{{ mount_info['path'] }}" |
200 | 200 | fstype: "{{ mount_info['fstype'] | default(omit) }}" |
|
204 | 204 | selectattr('state', 'match', '^absent$') | list }}" |
205 | 205 | loop_control: |
206 | 206 | loop_var: mount_info |
207 | | - when: ansible_version.full is version('2.10', '<') |
| 207 | + when: ansible_facts['python_version'] is version('3', '<') |
208 | 208 |
|
209 | | -# Bare module name (not FQCN): on ansible 2.9 the collection is not |
210 | | -# installable and an unresolvable FQCN aborts play parsing even for a task |
211 | | -# skipped by "when". The bare name resolves to the ansible 2.9 builtin |
212 | | -# (skipped here) and redirects to the latest collection module elsewhere. |
| 209 | +# Bare module name (not FQCN): an unresolvable FQCN aborts play parsing on |
| 210 | +# ansible 2.9 even for a task skipped by "when", so the bare name is used. |
| 211 | +# This runs only on managed nodes with python 3, where the bare name resolves |
| 212 | +# to the latest ansible.posix.mount. |
213 | 213 | - name: Remove obsolete mounts |
214 | 214 | mount: # noqa fqcn |
215 | 215 | src: "{{ mount_info['src'] | default(omit) }}" |
|
221 | 221 | selectattr('state', 'match', '^absent$') | list }}" |
222 | 222 | loop_control: |
223 | 223 | loop_var: mount_info |
224 | | - when: ansible_version.full is version('2.10', '>=') |
| 224 | + when: ansible_facts['python_version'] is version('3', '>=') |
225 | 225 |
|
226 | 226 | - name: Tell systemd to refresh its view of /etc/fstab |
227 | 227 | systemd: |
228 | 228 | daemon_reload: true |
229 | 229 | when: blivet_output['mounts'] | length > 0 |
230 | 230 |
|
231 | | -# ansible 2.9 (ansible-engine) uses the vendored mount_ansible_29 module, |
232 | | -# since ansible.posix cannot be installed there; other systems use the bare |
233 | | -# mount name, which redirects to the latest ansible.posix.mount. |
234 | | -- name: Set up new/current mounts - ansible 2.9 |
235 | | - mount_ansible_29: |
| 231 | +# On managed nodes with python 2 (EL7 with ansible 2.9, where the |
| 232 | +# ansible.posix collection cannot be installed), use the dependency-free |
| 233 | +# vendored mount_python_27 module, which retains python 2 support. |
| 234 | +- name: Set up new/current mounts - python 2 |
| 235 | + mount_python_27: |
236 | 236 | src: "{{ mount_info['src'] | default(omit) }}" |
237 | 237 | path: "{{ mount_info['path'] }}" |
238 | 238 | fstype: "{{ mount_info['fstype'] | default(omit) }}" |
|
242 | 242 | rejectattr('state', 'match', '^absent$') | list }}" |
243 | 243 | loop_control: |
244 | 244 | loop_var: mount_info |
245 | | - when: ansible_version.full is version('2.10', '<') |
| 245 | + when: ansible_facts['python_version'] is version('3', '<') |
246 | 246 |
|
247 | | -# Bare module name (not FQCN): on ansible 2.9 the collection is not |
248 | | -# installable and an unresolvable FQCN aborts play parsing even for a task |
249 | | -# skipped by "when". The bare name resolves to the ansible 2.9 builtin |
250 | | -# (skipped here) and redirects to the latest collection module elsewhere. |
| 247 | +# Bare module name (not FQCN): an unresolvable FQCN aborts play parsing on |
| 248 | +# ansible 2.9 even for a task skipped by "when", so the bare name is used. |
| 249 | +# This runs only on managed nodes with python 3, where the bare name resolves |
| 250 | +# to the latest ansible.posix.mount. |
251 | 251 | - name: Set up new/current mounts |
252 | 252 | mount: # noqa fqcn |
253 | 253 | src: "{{ mount_info['src'] | default(omit) }}" |
|
259 | 259 | rejectattr('state', 'match', '^absent$') | list }}" |
260 | 260 | loop_control: |
261 | 261 | loop_var: mount_info |
262 | | - when: ansible_version.full is version('2.10', '>=') |
| 262 | + when: ansible_facts['python_version'] is version('3', '>=') |
263 | 263 |
|
264 | 264 | - name: Manage mount ownership/permissions |
265 | 265 | file: |
|
0 commit comments