mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
34 lines
1,006 B
YAML
34 lines
1,006 B
YAML
|
---
|
||
|
- name: Make sure cryptsetup is installed
|
||
|
package:
|
||
|
name: cryptsetup
|
||
|
state: present
|
||
|
become: yes
|
||
|
- name: Create cryptfile
|
||
|
command: dd if=/dev/zero of={{ output_dir.replace('~', ansible_env.HOME) }}/cryptfile bs=1M count=32
|
||
|
- name: Create lookback device
|
||
|
command: losetup -f {{ output_dir.replace('~', ansible_env.HOME) }}/cryptfile
|
||
|
become: yes
|
||
|
- name: Determine loop device name
|
||
|
command: losetup -j {{ output_dir.replace('~', ansible_env.HOME) }}/cryptfile --output name
|
||
|
become: yes
|
||
|
register: cryptfile_device_output
|
||
|
- set_fact:
|
||
|
cryptfile_device: "{{ cryptfile_device_output.stdout_lines[1] }}"
|
||
|
- block:
|
||
|
- include_tasks: run-test.yml
|
||
|
with_fileglob:
|
||
|
- "tests/*.yml"
|
||
|
always:
|
||
|
- name: Make sure LUKS device is gone
|
||
|
luks_device:
|
||
|
device: "{{ cryptfile_device }}"
|
||
|
state: absent
|
||
|
become: yes
|
||
|
ignore_errors: yes
|
||
|
- command: losetup -d "{{ cryptfile_device }}"
|
||
|
become: yes
|
||
|
- file:
|
||
|
dest: "{{ output_dir }}/cryptfile"
|
||
|
state: absent
|