Merge branch 'zfs'
This commit is contained in:
commit
7fe4de0081
@ -5,6 +5,7 @@
|
||||
- sudo
|
||||
- users
|
||||
- package_manager
|
||||
- zfs
|
||||
- zrepl
|
||||
- zsh
|
||||
- network
|
||||
|
@ -43,24 +43,6 @@
|
||||
vars:
|
||||
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
|
||||
copy:
|
||||
src: "files/{{ item }}"
|
||||
@ -70,7 +52,6 @@
|
||||
group: root
|
||||
loop:
|
||||
- freeze_firefox.conf
|
||||
- archzfs.conf
|
||||
|
||||
- name: Install packages
|
||||
package:
|
||||
|
1
ansible/roles/zfs/defaults/main.yaml
Normal file
1
ansible/roles/zfs/defaults/main.yaml
Normal file
@ -0,0 +1 @@
|
||||
install_zfs: true
|
15
ansible/roles/zfs/tasks/common.yaml
Normal file
15
ansible/roles/zfs/tasks/common.yaml
Normal 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
|
5
ansible/roles/zfs/tasks/freebsd.yaml
Normal file
5
ansible/roles/zfs/tasks/freebsd.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
# - name: Install packages
|
||||
# package:
|
||||
# name:
|
||||
# - foo
|
||||
# state: present
|
52
ansible/roles/zfs/tasks/linux.yaml
Normal file
52
ansible/roles/zfs/tasks/linux.yaml
Normal 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
|
2
ansible/roles/zfs/tasks/main.yaml
Normal file
2
ansible/roles/zfs/tasks/main.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
- import_tasks: tasks/common.yaml
|
||||
when: install_zfs
|
29
ansible/roles/zfs/tasks/peruser.yaml
Normal file
29
ansible/roles/zfs/tasks/peruser.yaml
Normal 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"'
|
0
ansible/roles/zfs/tasks/peruser_freebsd.yaml
Normal file
0
ansible/roles/zfs/tasks/peruser_freebsd.yaml
Normal file
0
ansible/roles/zfs/tasks/peruser_linux.yaml
Normal file
0
ansible/roles/zfs/tasks/peruser_linux.yaml
Normal file
Loading…
x
Reference in New Issue
Block a user