machine_setup/ansible/roles/zfs/tasks/linux.yaml
2024-04-28 15:08:36 -04:00

64 lines
1.3 KiB
YAML

- name: Install packages
package:
name:
- linux-lts-headers
state: present
- name: Check trusted gpg keys
become_user: "{{ build_user.name }}"
command: gpg --list-public-keys --keyid-format LONG
register: gpgkeys
changed_when: false
check_mode: no
- name: Trust ZFS key
when: "item not in gpgkeys.stdout"
become_user: "{{ build_user.name }}"
command: "gpg --recv-key '{{ item }}'"
loop:
- "0AB9E991C6AF658B"
- "6AD860EED4598027"
- name: Build aur packages
register: buildaur
become_user: "{{ build_user.name }}"
command: "aurutils-sync --no-view {{ item }}"
args:
creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
loop:
- zfs-dkms
- zfs-utils
- name: Update cache
when: buildaur.changed
pacman:
name: []
state: present
update_cache: true
- name: Install packages
package:
name:
- zfs-dkms
- zfs-utils
state: present
- name: Enable services
systemd:
enabled: yes
name: "{{ item }}"
daemon_reload: yes
loop:
- zfs-import-cache.service
- zfs-mount.service
- zfs.target
- zfs-import.target
- name: Enable periodic scrub
when: periodic_scrub_pools is defined
systemd:
enabled: yes
name: "zfs-scrub-weekly@{{ item }}.timer"
daemon_reload: yes
loop: "{{ periodic_scrub_pools }}"