infra/deprecated/playbooks/atlas/init/perma-mount-drives.yml

51 lines
1.3 KiB
YAML
Raw Permalink Normal View History

# This ensures that the mount points for our docker volumes are present and
# populated correctly
---
- hosts: atlas
become: yes
vars:
filesystem: ext4
tasks:
- name: Fetch vars for getting mount points
include_vars:
file: ../vars/drives.yml
- name: Creat mountpoints for mounted volumes
file:
path: "{{ item }}"
state: directory
owner: ubuntu
loop:
- "{{ CLIPPABLE_MOUNT_POINT }}"
- "{{ FILEBROWSER_MOUNT_POINT }}"
- name: Partition Devices
community.general.parted:
device: "{{ item }}"
number: 1
label: gpt
part_start: 0%
part_end: 100%
name: data
loop:
- "{{ FILEBROWSER_DRIVE }}"
- "{{ CLIPPABLE_DRIVE }}"
- name: Format the drive for use
community.general.filesystem:
dev: "{{ item }}"
fstype: "{{ filesystem }}"
loop:
- "{{ FILEBROWSER_DRIVE }}"
- "{{ CLIPPABLE_DRIVE }}"
- name: Permanently Mount Drives
mount:
state: mounted
path: "{{ item.dst }}"
src: "{{ item.src }}"
fstype: "{{ filesystem }}"
loop:
- { src: "{{ FILEBROWSER_DRIVE }}", dst: "{{ FILEBROWSER_MOUNT_POINT }}" }
- { src: "{{ CLIPPABLE_DRIVE }}", dst: "{{ CLIPPABLE_MOUNT_POINT }}" }