2021-09-12 21:58:11 +00:00
|
|
|
---
|
|
|
|
- name: Converge
|
|
|
|
hosts: all
|
|
|
|
become: true
|
|
|
|
roles:
|
|
|
|
- ansible-role-luks
|
|
|
|
vars:
|
|
|
|
luks_devices:
|
|
|
|
- name: data_encrypted
|
2024-07-05 08:02:39 +00:00
|
|
|
device: /dev/loop0
|
2021-09-12 21:58:11 +00:00
|
|
|
fstype: ext4
|
|
|
|
mount_point: /mnt/data_decrypted
|
2024-07-05 08:02:39 +00:00
|
|
|
passphrase: secret
|
2021-09-12 21:58:11 +00:00
|
|
|
|
|
|
|
pre_tasks:
|
2024-07-05 08:02:39 +00:00
|
|
|
- name: Update apt cache
|
2021-09-12 21:58:11 +00:00
|
|
|
ansible.builtin.apt:
|
|
|
|
update_cache: true
|
|
|
|
|
2024-07-05 08:02:39 +00:00
|
|
|
- name: Check if test.img exists
|
2021-09-12 21:58:11 +00:00
|
|
|
ansible.builtin.stat:
|
|
|
|
path: /tmp/test.img
|
|
|
|
register: st
|
|
|
|
|
2024-07-05 08:02:39 +00:00
|
|
|
- name: Create test.img
|
2021-09-12 21:58:11 +00:00
|
|
|
ansible.builtin.command: dd if=/dev/zero of=/tmp/test.img bs=1M count=100
|
|
|
|
when: not st.stat.exists
|
2024-07-05 08:02:39 +00:00
|
|
|
|
|
|
|
- name: Create loop device
|
|
|
|
ansible.builtin.command: losetup -fP /tmp/test.img
|
|
|
|
when: not st.stat.exists
|