blob: c0422bb36664f122a363d7c5215f608dc54727dc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
---
- name: install cryptsetup packages
apt:
name:
- cryptsetup-bin
state: present
- name: Create temporary build directory
tempfile:
state: directory
register: keyfile_dir
changed_when: False
check_mode: False
- name: create cryptdisk volumes
block:
- name: write passphrases into temporary keyfiles
loop: "{{ cryptdisk_volumes | dict2items }}"
loop_control:
label: "{{ item.key }}"
copy:
dest: "{{ keyfile_dir.path }}/{{ item.key }}"
content: "{{ item.value.passphrase }}"
mode: 0600
changed_when: False
check_mode: False
- name: create/open luks volumes
loop: "{{ cryptdisk_volumes | dict2items }}"
loop_control:
label: "{{ item.key }} ({{ item.value.device }})"
luks_device:
name: "{{ item.key }}"
device: "{{ item.value.device }}"
keyfile: "{{ keyfile_dir.path }}/{{ item.key }}"
state: opened
always:
- name: remove base-directory for keyfiles
file:
path: "{{ keyfile_dir.path }}"
state: absent
changed_when: False
check_mode: False
|