-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DSOS-2749: add filesystems role (#725)
* DSOS-2749: add role for managing filesystems * tweaks * updated readme
- Loading branch information
1 parent
b2c3df9
commit 17ef823
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Role for managing file shares | ||
|
||
## Mount EFS file shares | ||
|
||
In appropriate `group_vars`, e.g. | ||
|
||
Multi-AZ: | ||
``` | ||
filesystems_mount: | ||
- dir: /test | ||
fstype: nfs | ||
opts: nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,nofail | ||
src: "{{ ansible_ec2_placement_availability_zone }}.fs-0a170471eea499c2c.efs.eu-west-2.amazonaws.com:/" | ||
``` | ||
|
||
Single-AZ, e.g. in eu-west-2a | ||
``` | ||
filesystems_mount: | ||
- dir: /test | ||
fstype: nfs | ||
opts: nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,nofail | ||
src: "eu-west-2a.fs-0a170471eea499c2c.efs.eu-west-2.amazonaws.com:/" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
# Define list of filesystems to mount using `filesystems_mount` list. | ||
|
||
# Example Multi-AZ EFS mount | ||
#filesystems_mount: | ||
# - dir: /test | ||
# fstype: nfs | ||
# opts: nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,nofail | ||
# src: "{{ ansible_ec2_placement_availability_zone }}.fs-0a170471eea499c2c.efs.eu-west-2.amazonaws.com:/" | ||
|
||
# Example Single-AZ EFS mount in eu-west-2a | ||
#filesystems_mount: | ||
# - dir: /test | ||
# fstype: nfs | ||
# opts: nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,nofail | ||
# src: "eu-west-2a.fs-0a170471eea499c2c.efs.eu-west-2.amazonaws.com:/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- role: get-ec2-facts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- import_tasks: mount.yml | ||
tags: | ||
- amibuild | ||
- ec2provision | ||
- ec2patch | ||
when: filesystems_mount is defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
- name: Install packages | ||
ansible.builtin.package: | ||
name: "{{ item }}" | ||
state: present | ||
loop: | ||
- nfs-utils | ||
- cifs-utils | ||
|
||
- name: Create mount point | ||
ansible.builtin.file: | ||
path: "{{ item.dir }}" | ||
state: "directory" | ||
loop_control: | ||
label: "{{ item.dir }}" | ||
loop: "{{ filesystems_mount }}" | ||
|
||
- name: Mount filesystem | ||
ansible.posix.mount: | ||
fstype: "{{ item.fstype }}" | ||
opts: "{{ item.opts | default('defaults,nofail') }}" | ||
path: "{{ item.dir }}" | ||
src: "{{ item.src }}" | ||
state: "{{ item.state | default('mounted') }}" | ||
loop_control: | ||
label: "{{ item.dir }}" | ||
loop: "{{ filesystems_mount }}" |