ansible-role-basic-system-s.../tasks/additional_disks.yml

46 lines
1.4 KiB
YAML
Raw Normal View History

2020-10-29 18:29:49 +01:00
---
- block:
- name: Install the NFS client utilities when we are going to mount a NFS file system
ansible.builtin.apt:
pkg: nfs-common
state: present
update_cache: true
cache_valid_time: 1800
loop: '{{ disks_and_mountpoints_list }}'
2020-10-29 18:29:49 +01:00
when: item.fstype == 'nfs'
- name: Install the NFS 4 acl tools if we are going to mount a NFS file system
ansible.builtin.apt:
pkg: nfs4-acl-tools
state: present
update_cache: true
cache_valid_time: 1800
loop: '{{ disks_and_mountpoints_list }}'
2020-10-29 18:29:49 +01:00
when: item.fstype == 'nfs'
when: ansible_distribution_file_variety == "Debian"
tags: [ 'data_disk', 'mountpoint' ]
- block:
- name: Create a file system on the new disks
ansible.builtin.filesystem:
dev: '{{ item.root_device | default('/dev/') }}{{ item.device }}'
fstype: '{{ item.fstype }}'
force: false
loop: '{{ disks_and_mountpoints_list }}'
2020-10-29 18:29:49 +01:00
when:
- additional_disks
- item.create_filesystem
2021-02-16 16:10:13 +01:00
- item.fstype != 'nfs'
2020-10-29 18:29:49 +01:00
- name: Manage the additional file systems
ansible.posix.mount:
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 }}'
2020-10-29 18:29:49 +01:00
tags: [ 'data_disk', 'mountpoint' ]