ansible-role-luks/tasks/main.yml

51 lines
1.2 KiB
YAML
Raw Normal View History

2019-03-16 22:51:50 +00:00
---
- name: Install packages
2021-09-12 22:05:09 +00:00
ansible.builtin.package:
name:
2019-03-16 22:51:50 +00:00
- cryptsetup
- util-linux
tags: luks
- name: Create luks device
community.crypto.luks_device:
device: "{{ item.device }}"
cipher: "{{ item.cipher | default(omit) }}"
hash: "{{ item.hash | default(omit) }}"
passphrase: "{{ item.passphrase }}"
loop: "{{ luks_devices }}"
2021-09-12 22:13:15 +00:00
loop_control:
label: "{{ item.name }} - {{ item.device }}"
2019-03-16 22:51:50 +00:00
tags: luks
- name: Opened luks device
community.crypto.luks_device:
device: "{{ item.device }}"
name: "{{ item.name }}"
passphrase: "{{ item.passphrase }}"
state: opened
loop: "{{ luks_devices }}"
2021-09-12 22:13:15 +00:00
loop_control:
label: "{{ item.name }} - {{ item.device }}"
2019-03-16 22:51:50 +00:00
tags: luks
- name: Format partition
community.general.filesystem:
fstype: "{{ item.fstype }}"
dev: "/dev/mapper/{{ item.name }}"
loop: "{{ luks_devices }}"
2021-09-12 22:13:15 +00:00
loop_control:
label: "{{ item.name }} - {{ item.device }}"
2019-03-16 22:51:50 +00:00
tags: luks
- name: Mount partition
ansible.posix.mount:
src: "/dev/mapper/{{ item.name }}"
path: "{{ item.mount_point }}"
fstype: "{{ item.fstype }}"
opts: defaults,noauto
2019-03-16 22:51:50 +00:00
state: mounted
loop: "{{ luks_devices }}"
2021-09-12 22:13:15 +00:00
loop_control:
label: "{{ item.name }} - {{ item.device }}"
2019-03-16 22:51:50 +00:00
tags: luks