ansible/roles/cryptoraid/tasks/alpine.yml

63 lines
1.2 KiB
YAML

---
- name: install packages
apk:
name:
- btrfs-progs
- cryptsetup
- gnupg
- gptfdisk
- sgdisk
- zstd
- name: load btrfs module
modprobe:
name: btrfs
state: present
- name: btrfs module on startup
lineinfile:
path: /etc/modules
line: btrfs
insertafter: EOF
- name: make directory for dmcrypt keys
file:
path: /etc/dmcrypt
state: directory
- name: copy luks key file
copy:
src: "host_files/luks/{{ ansible_hostname }}/key.bin"
dest: /etc/dmcrypt/key.bin
mode: '0600'
owner: root
- name: add drive block to dmcrypt config
blockinfile:
insertbefore: leave this comment last
path: /etc/conf.d/dmcrypt
block: "{{ lookup('template', 'dmcrypt_block.j2') }}"
- name: enable dmcrypt at boot
service:
name: dmcrypt
enabled: true
runlevel: boot
- name: copy btrfs-scan init script
copy:
dest: /etc/init.d/btrfs-scan
src: btrfs-scan
mode: '0755'
- name: add btrfs-scan init script to lbu
lbu:
include: /etc/init.d/btrfs-scan
when: alpine_mode in ["diskless", "data"]
- name: enable btrfs-scan at boot
service:
name: btrfs-scan
enabled: true
runlevel: boot