Cleanup the tasks so that we can use UUIDs.

This commit is contained in:
Andrea Dell'Amico 2022-11-07 18:03:12 +01:00
parent 01f0da6c99
commit d14557e763
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
1 changed files with 24 additions and 8 deletions

View File

@ -1,13 +1,21 @@
--- ---
- block: - block:
- name: Install the NFS client utilities when we are going to mount a NFS file system - name: Install the NFS client utilities when we are going to mount a NFS file system
apt: pkg=nfs-common state=present update_cache=yes cache_valid_time=1800 ansible.builtin.apt:
with_items: '{{ disks_and_mountpoints_list }}' pkg: nfs-common
state: present
update_cache: true
cache_valid_time: 1800
loop: '{{ disks_and_mountpoints_list }}'
when: item.fstype == 'nfs' when: item.fstype == 'nfs'
- name: Install the NFS 4 acl tools if we are going to mount a NFS file system - name: Install the NFS 4 acl tools if we are going to mount a NFS file system
apt: pkg=nfs4-acl-tools state=present update_cache=yes cache_valid_time=1800 ansible.builtin.apt:
with_items: '{{ disks_and_mountpoints_list }}' pkg: nfs4-acl-tools
state: present
update_cache: true
cache_valid_time: 1800
loop: '{{ disks_and_mountpoints_list }}'
when: item.fstype == 'nfs' when: item.fstype == 'nfs'
when: ansible_distribution_file_variety == "Debian" when: ansible_distribution_file_variety == "Debian"
@ -15,15 +23,23 @@
- block: - block:
- name: Create a file system on the new disks - name: Create a file system on the new disks
filesystem: dev=/dev/{{ item.device }} fstype={{ item.fstype }} force=no ansible.builtin.filesystem:
with_items: '{{ disks_and_mountpoints_list }}' dev: '{{ item.root_device | default('/dev/') }}{{ item.device }}'
fstype: '{{ item.fstype }}'
force: false
loop: '{{ disks_and_mountpoints_list }}'
when: when:
- additional_disks - additional_disks
- item.create_filesystem - item.create_filesystem
- item.fstype != 'nfs' - item.fstype != 'nfs'
- name: Manage the additional file systems - name: Manage the additional file systems
mount: name={{ item.mountpoint }} src={{ item.root_device | default('/dev') }}/{{ item.device }} fstype={{ item.fstype }} opts={{ item.opts }} state={{ item.state }} ansible.posix.mount:
with_items: '{{ disks_and_mountpoints_list }}' name: '{{ item.mountpoint }}'
src: '{{ item.root_device | default('/dev/') }}{{ item.device }}'
fstype: '{{ item.fstype }}'
opts: '{{ item.opts }}'
state: '{{ item.state }}'
loop: '{{ disks_and_mountpoints_list }}'
tags: [ 'data_disk', 'mountpoint' ] tags: [ 'data_disk', 'mountpoint' ]