Debian Codegraph @

ansible_collections/community/crypto/tests/ee/roles/luks_device/tasks/main.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - name: Run cryptsetup (smoke test)
7 ansible.builtin.command: cryptsetup --version
8
9 - name: Determine cryptfile path
10 ansible.builtin.set_fact:
11 cryptfile_path: "{{ output_path }}/cryptfile"
12 keyfile_path: "{{ output_path }}/keyfile"
13
14 - name: Create cryptfile
15 ansible.builtin.command: dd if=/dev/zero of={{ cryptfile_path }} bs=1M count=32
16
17 - name: Create keyfile
18 ansible.builtin.copy:
19 dest: "{{ keyfile_path }}"
20 content: hunter2
21
22 - # Creating devices doesn't work well. We will have to try this again when luks_device
23 # supports working with container files directly.
24 when: false
25 block:
26 - name: Create lookback device
27 ansible.builtin.command: losetup -f {{ cryptfile_path }}
28
29 - name: Determine loop device name
30 ansible.builtin.command: losetup -j {{ cryptfile_path }} --output name
31 register: cryptfile_device_output
32
33 - ansible.builtin.set_fact:
34 cryptfile_device: "{{ cryptfile_device_output.stdout_lines[1] }}"
35
36 - name: Create LUKS container
37 community.crypto.luks_device:
38 device: "{{ cryptfile_device }}"
39 # device: "{{ cryptfile_path }}"
40 state: present
41 keyfile: "{{ keyfile_path }}"
42 pbkdf:
43 iteration_time: 0.1
44
45 - name: Destroy LUKS container
46 community.crypto.luks_device:
47 device: "{{ cryptfile_device }}"
48 # device: "{{ cryptfile_path }}"
49 state: absent