48 lines
1.1 KiB
YAML
48 lines
1.1 KiB
YAML
# vim: ft=yaml.ansible
|
|
---
|
|
- name: (Create and) open LUKS containers
|
|
luks_device:
|
|
uuid: "{{ item.disk.uuid }}"
|
|
passphrase: "{{ item.disk.luks_pw }}"
|
|
name: "{{ item.name }}"
|
|
type: luks2
|
|
state: opened
|
|
loop:
|
|
- disk: "{{ secrets.hdd }}"
|
|
name: "{{ hdd_name }}"
|
|
- disk: "{{ secrets.ssd }}"
|
|
name: "{{ ssd_name }}"
|
|
|
|
- name: Create filesystems if they do not exist
|
|
filesystem:
|
|
dev: "/dev/mapper/{{ item }}"
|
|
fstype: ext4
|
|
state: present
|
|
loop:
|
|
- "{{ hdd_name }}"
|
|
- "{{ ssd_name }}"
|
|
|
|
- name: Mount filesystems
|
|
mount:
|
|
src: "/dev/disk/by-uuid/{{ item.uuid }}"
|
|
path: "{{ item.path }}"
|
|
fstype: ext4
|
|
state: ephemeral
|
|
loop:
|
|
- uuid: "{{ secrets.hdd.uuid }}"
|
|
path: "{{ hdd_mount_point }}"
|
|
- uuid: "{{ secrets.ssd.uuid }}"
|
|
path: "{{ ssd_mount_point }}"
|
|
|
|
- name: Create swapfile
|
|
community.general.filesize:
|
|
path: "{{ ssd_mount_point }}/swapfile"
|
|
size: 8G
|
|
owner: root
|
|
mode: 0600
|
|
|
|
- name: Mount swapfile
|
|
shell: |
|
|
mkswap {{ ssd_mount_point }}/swapfile
|
|
swapon {{ ssd_mount_point }}/swapfile
|