first commit

This commit is contained in:
ace 2024-05-16 18:33:20 +03:00
commit 0af2f0071c
Signed by: ace
GPG Key ID: 2C08973DD37A76FD
4 changed files with 52 additions and 0 deletions

24
README.md Normal file
View File

@ -0,0 +1,24 @@
# Idempotent ansible role for luks
# Configuration example
luks_passphrase: ioxee2thoo4aiYoiThiochozaa1ishoo
luks_devices:
- name: "nvme0n1p1-decrypted"
device: "/dev/nvme0n1p1"
passphrase: "{{ luks_passphrase }}"
persistent: true
perf_no_read_workqueue: true
perf_no_write_workqueue: true
perf_same_cpu_crypt: true
allow_discards: true
- name: "nvme1n1p1-decrypted"
device: "/dev/nvme1n1p1"
passphrase: "{{ luks_passphrase }}"
persistent: true
perf_no_read_workqueue: true
perf_no_write_workqueue: true
perf_same_cpu_crypt: true
allow_discards: true

3
defaults/main.yaml Normal file
View File

@ -0,0 +1,3 @@
---
luks_type: luks2
luks_state: opened

0
meta/main.yaml Normal file
View File

25
tasks/main.yaml Normal file
View File

@ -0,0 +1,25 @@
- name: Install cryptsetup
package:
name: cryptsetup
state: present
- name: Open the LUKS container
community.crypto.luks_device:
device: "{{ item.device | default(omit) }}"
label: "{{ item.label | default(omit) }}"
uuid: "{{ item.uuid | default(omit) }}"
name: "{{ item.name | default(omit) }}"
state: "{{ item.state | default(luks_state) }}"
type: "{{ item.type | default(luks_type) }}"
keyfile: "{{ item.keyfile | default(omit) }}"
passphrase: "{{ item.passphrase | default(omit) }}"
persistent: "{{ item.persistent | default(omit) }}"
perf_no_read_workqueue: "{{ item.perf_no_read_workqueue | default(omit) }}"
perf_no_write_workqueue: "{{ item.perf_no_write_workqueue | default(omit) }}"
perf_same_cpu_crypt: "{{ item.perf_same_cpu_crypt | default(omit) }}"
perf_submit_from_crypt_cpus: "{{ item.perf_submit_from_crypt_cpus | default(omit) }}"
allow_discards: "{{ item.allow_discards | default(omit) }}"
sector_size: "{{ item.sector_size | default(omit) }}"
loop: "{{ luks_devices }}"
no_log: true
when: luks_devices is defined