Manage additional disks
This commit is contained in:
parent
39e191f0fb
commit
9dad2511bd
|
@ -11,6 +11,12 @@ locales_list:
|
|||
- { name: 'it_IT.UTF-8' }
|
||||
- { name: 'it_IT' }
|
||||
|
||||
#
|
||||
# Define the following variables to manage additional disks and mount points
|
||||
additional_disks: False
|
||||
disks_and_mountpoints_list: []
|
||||
# - { mountpoint: '/data', device: 'xvda3', fstype: 'xfs', opts: 'noatime', state: 'mounted', create_filesystem: True }
|
||||
|
||||
# tmpreaper
|
||||
tmpreaper_install: False
|
||||
tmpreaper_protect_extra: ''
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- block:
|
||||
- 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
|
||||
with_items: '{{ disks_and_mountpoints_list }}'
|
||||
when: item.fstype == 'nfs'
|
||||
|
||||
- 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
|
||||
with_items: '{{ disks_and_mountpoints_list }}'
|
||||
when: item.fstype == 'nfs'
|
||||
|
||||
when: ansible_distribution_file_variety == "Debian"
|
||||
tags: [ 'data_disk', 'mountpoint' ]
|
||||
|
||||
- block:
|
||||
- name: Create a file system on the new disks
|
||||
filesystem: dev=/dev/{{ item.device }} fstype={{ item.fstype }} force=no
|
||||
with_items: '{{ disks_and_mountpoints_list }}'
|
||||
when:
|
||||
- additional_disks
|
||||
- item.create_filesystem
|
||||
|
||||
- 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 }}
|
||||
with_items: '{{ disks_and_mountpoints_list }}'
|
||||
|
||||
tags: [ 'data_disk', 'mountpoint' ]
|
|
@ -3,4 +3,6 @@
|
|||
- import_tasks: locale.yml
|
||||
- import_tasks: timezone.yml
|
||||
- import_tasks: http_client_proxy.yml
|
||||
- import_tasks: additional_disks.yml
|
||||
when: additional_disks
|
||||
- import_tasks: tmpreaper.yml
|
||||
|
|
Loading…
Reference in New Issue