machine_setup/ansible/roles/zfs/tasks/linux.yaml

87 lines
1.9 KiB
YAML
Raw Normal View History

2023-04-14 21:33:29 +00:00
- name: Install packages
package:
name:
- linux-lts-headers
2023-04-14 21:33:29 +00:00
state: present
2023-03-03 17:20:47 +00:00
2023-10-27 00:40:12 +00:00
- 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"
2023-11-26 14:31:32 +00:00
- "6AD860EED4598027"
2023-10-27 00:40:12 +00:00
2023-04-14 21:33:29 +00:00
- name: Build aur packages
register: buildaur
become_user: "{{ build_user.name }}"
command: "aurutils-sync --no-view {{ item }}"
2023-03-03 17:20:47 +00:00
args:
2023-04-14 21:33:29 +00:00
creates: "/var/cache/pacman/custom/{{ item }}-*.pkg.tar.*"
2023-03-03 17:20:47 +00:00
loop:
2023-04-14 21:33:29 +00:00
- zfs-dkms
- zfs-utils
2023-03-03 17:20:47 +00:00
- name: Update cache
2023-04-14 21:33:29 +00:00
when: buildaur.changed
2023-03-03 17:20:47 +00:00
pacman:
name: []
state: present
update_cache: true
2023-04-14 21:33:29 +00:00
2023-03-03 17:20:47 +00:00
- name: Install packages
package:
name:
2023-04-14 21:33:29 +00:00
- zfs-dkms
- zfs-utils
2023-03-03 17:20:47 +00:00
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 }}"
- name: Create directories
when: periodic_scrub_pools is defined
file:
name: "{{ item }}"
state: directory
mode: 0755
owner: root
group: wheel # Normally it is "root"
loop:
- /etc/systemd/system/zfs-scrub-weekly@.timer.d
- name: Install Configuration
when: periodic_scrub_pools is defined
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0644
owner: root
group: wheel # Normally it is "root"
loop:
- src: linux_scrub_when_plugged_in.conf
dest: /etc/systemd/system/zfs-scrub-weekly@.timer.d/override.conf