Merge branch 'zfs'

This commit is contained in:
Tom Alexander 2023-03-03 17:30:21 -05:00
commit 7fe4de0081
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
11 changed files with 105 additions and 19 deletions

View File

@ -5,6 +5,7 @@
- sudo - sudo
- users - users
- package_manager - package_manager
- zfs
- zrepl - zrepl
- zsh - zsh
- network - network

View File

@ -43,24 +43,6 @@
vars: vars:
sub_query: "results[?stat.path=='{{ item }}'].stat.exists" sub_query: "results[?stat.path=='{{ item }}'].stat.exists"
- name: Check trusted gpg keys
command: pacman-key -l
register: pacmankeys
changed_when: false
check_mode: no
no_log: true
- name: Trust archzfs signing key
command: pacman-key -a -
args:
stdin: "{{ lookup('file', 'archzfs.gpg') }}"
when: '"DDF7DB817396A49B2A2723F7403BD972F75D9D76" not in pacmankeys.stdout'
register: archzfs_key_imported
- name: Sign archzfs signing key
command: pacman-key --lsign-key "DDF7DB817396A49B2A2723F7403BD972F75D9D76"
when: archzfs_key_imported.changed
- name: Additional pacman configs - name: Additional pacman configs
copy: copy:
src: "files/{{ item }}" src: "files/{{ item }}"
@ -70,7 +52,6 @@
group: root group: root
loop: loop:
- freeze_firefox.conf - freeze_firefox.conf
- archzfs.conf
- name: Install packages - name: Install packages
package: package:

View File

@ -0,0 +1 @@
install_zfs: true

View File

@ -0,0 +1,15 @@
- import_tasks: tasks/freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/linux.yaml
when: 'os_flavor == "linux"'
- include_tasks:
file: tasks/peruser.yaml
apply:
become: yes
become_user: "{{ initialize_user }}"
when: users is defined
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}"
loop_control:
loop_var: initialize_user

View File

@ -0,0 +1,5 @@
# - name: Install packages
# package:
# name:
# - foo
# state: present

View File

@ -0,0 +1,52 @@
- name: Check trusted gpg keys
command: pacman-key -l
register: pacmankeys
changed_when: false
check_mode: no
no_log: true
- name: Trust archzfs signing key
command: pacman-key -a -
args:
stdin: "{{ lookup('file', 'archzfs.gpg') }}"
when: '"DDF7DB817396A49B2A2723F7403BD972F75D9D76" not in pacmankeys.stdout'
register: archzfs_key_imported
- name: Sign archzfs signing key
command: pacman-key --lsign-key "DDF7DB817396A49B2A2723F7403BD972F75D9D76"
when: archzfs_key_imported.changed
- name: Additional pacman configs
register: updatepacman
copy:
src: "files/{{ item }}"
dest: /etc/pacman.d/conf.d/
mode: 0644
owner: root
group: root
loop:
- archzfs.conf
- name: Update cache
when: updatepacman.changed
pacman:
name: []
state: present
update_cache: true
- name: Install packages
package:
name:
- archzfs-linux
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

View File

@ -0,0 +1,2 @@
- import_tasks: tasks/common.yaml
when: install_zfs

View File

@ -0,0 +1,29 @@
- include_role:
name: per_user
# - name: Create directories
# file:
# name: "{{ account_homedir.stdout }}/{{ item }}"
# state: directory
# mode: 0700
# owner: "{{ account_name.stdout }}"
# group: "{{ group_name.stdout }}"
# loop:
# - ".config/foo"
# - name: Copy files
# copy:
# src: "files/{{ item.src }}"
# dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
# mode: 0600
# owner: "{{ account_name.stdout }}"
# group: "{{ group_name.stdout }}"
# loop:
# - src: foo.conf
# dest: .config/foo/foo.conf
- import_tasks: tasks/peruser_freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/peruser_linux.yaml
when: 'os_flavor == "linux"'