updated tasks so they are only run once

This commit is contained in:
Matthew Stobbs
2025-03-03 12:04:09 -07:00
parent a2718521a5
commit 2ce49c9b85
117 changed files with 2129 additions and 991 deletions

View File

@@ -1,58 +1,70 @@
# vim: set filetype=yaml.ansible :
---
- name: Linux based installation
- name: Add zfs
when:
- ansible_system == 'Linux'
- zfs_configured is undefined
block:
- name: RedHat based configuration
- name: Load zfs config
ansible.builtin.include_tasks:
file: config/zfs.yml
- name: Linux based installation
when:
- ansible_os_family == 'RedHat'
- ansible_system == 'Linux'
block:
- name: Add openzfs gpg_key
become: "{{ sys_pkg_become }}"
ansible.builtin.rpm_key:
key: "{{ zfs.gpg_key }}"
fingerprint: "{{ zfs.gpg_fp }}"
state: present
- name: RedHat based configuration
when:
- ansible_os_family == 'RedHat'
block:
- name: Add openzfs gpg_key
become: "{{ sys_pkg_become }}"
ansible.builtin.rpm_key:
key: "{{ zfs.gpg_key }}"
fingerprint: "{{ zfs.gpg_fp }}"
state: present
- name: Enable openzfs repository
become: "{{ sys_pkg_become }}"
ansible.builtin.dnf:
name: "{{ zfs.repo_pkg }}"
disable_gpg_check: "{{ zfs.skip_gpg_check }}"
state: present
- name: Enable openzfs repository
become: "{{ sys_pkg_become }}"
ansible.builtin.dnf:
name: "{{ zfs.repo_pkg }}"
disable_gpg_check: "{{ zfs.skip_gpg_check }}"
state: present
- name: Debian configuration
- name: Debian configuration
when:
- ansible_os_family == 'Debian'
block:
- name: Enable openzfs repository
become: "{{ sys_pkg_become }}"
ansible.builtin.apt_repository:
repo: |
deb http://deb.debian.org/debian {{ zfs.release }}-backports main contrib
deb-src http://deb.debian.org/debian {{ zfs.release }}-backports main contrib
filename: "{{ zfs.release }}-backports"
state: present
update_cache: false
- name: Pin zfs package to backports
become: "{{ sys_pkg_become }}"
ansible.builtin.copy:
dest: /etc/apt/preferences.d/90_zfs
state: file
mode: '0644'
content: |
Package: src:zfs-linux
Pin: release n={{ zfs.release }}-backports
Pin-Priority: 990
- name: Append to pkgs
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + zfs.deps + zfs.pkgs }}"
- name: Append to caskpkgs
when:
- ansible_os_family == 'Debian'
block:
- name: Enable openzfs repository
become: "{{ sys_pkg_become }}"
ansible.builtin.apt_repository:
repo: |
deb http://deb.debian.org/debian {{ zfs.release }}-backports main contrib
deb-src http://deb.debian.org/debian {{ zfs.release }}-backports main contrib
filename: "{{ zfs.release }}-backports"
state: present
update_cache: false
- name: Pin zfs package to backports
become: "{{ sys_pkg_become }}"
ansible.builtin.file:
dest: /etc/apt/preferences.d/90_zfs
state: file
mode: '0644'
content: |
Package: src:zfs-linux
Pin: release n={{ zfs.release }}-backports
Pin-Priority: 990
- name: Append to pkgs
- ansible_os_family == 'Darwin'
ansible.builtin.set_fact:
pkg_sys: "{{ pkg_sys + zfs.deps + zfs.pkgs }}"
pkg_cask: "{{ pkg_cask + ['openzfs'] }}"
- name: Append to caskpkgs
when:
- ansible_os_family == 'Darwin'
ansible.builtin.set_fact:
pkg_cask: "{{ pkg_cask + ['openzfs'] }}"
- name: Set zfs_configured
ansible.builtin.set_fact:
zfs_configured: true