zfs: organize tasks by OS, remove unmaintained tasks

This commit is contained in:
Josh Lay 2020-04-19 01:04:02 -05:00
parent 9110a869a8
commit 7530feaff1
4 changed files with 46 additions and 52 deletions

8
roles/zfs/tasks/el.yml Normal file
View file

@ -0,0 +1,8 @@
---
- name: install zfs packages
package:
name: "{{ item }}"
state: present
with_items: "{{ EL_ZFS_PKGS | difference(ansible_facts.packages) }}"
register: zfs_installed

View file

@ -1,49 +1,16 @@
--- ---
# TODO: Split tasks into distribution appropriate files - name: include zfs-release tasks (CentOS/RHEL/Fedora)
# avoid running/skipping tasks entirely by not including them include_tasks: zfs-release-el.yml
when: ('zfs-release' not in ansible_facts.packages) and (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux" ])
# temporarily added to test zfs role by itself - name: include zfs installation tasks (Ubuntu)
#- name: check if atomic include_tasks: ubuntu.yml
# stat:
# path: /run/ostree-booted
# register: ostree
#
#- name: set fact (atomic state)
# set_fact:
# is_atomic: "{{ ostree.stat.exists }}"
# end temp additions
- name: install zfs-release package (EPEL 7)
yum:
name: "http://download.zfsonlinux.org/epel/zfs-release.el7_7.noarch.rpm"
state: present
when: ('zfs-release' not in ansible_facts.packages) and ((ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux" ]) and (ansible_distribution_major_version == "7"))
- name: install zfs-release package (EPEL 8)
yum:
name: "http://download.zfsonlinux.org/epel/zfs-release.el8_1.noarch.rpm"
state: present
when: ('zfs-release' not in ansible_facts.packages) and ((ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux" ]) and (ansible_distribution_major_version == "8"))
- name: install zfs-release package (Fedora)
dnf:
name: "http://download.zfsonlinux.org/fedora/zfs-release.fc31.noarch.rpm"
state: present
when: ('zfs-release' not in ansible_facts.packages) and (ansible_distribution in ["Fedora"] and not is_atomic)
- name: install ZFS (Ubuntu)
package:
name: "{{ UBUNTU_ZFS_PKGS | difference(ansible_facts.packages) }}"
state: present
when: ansible_distribution in ["Ubuntu"] when: ansible_distribution in ["Ubuntu"]
- name: install zfs and dkms - name: include zfs installation tasks (CentOS/RHEL/Fedora)
package: include_tasks: el.yml
name: "{{ EL_ZFS_PKGS | difference(ansible_facts.packages) }}" when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "Fedora" ] and not is_atomic)
state: present
register: zfs_installed
when: ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "Fedora" ] and not is_atomic
- name: load zfs module - name: load zfs module
modprobe: modprobe:
@ -65,15 +32,8 @@
line: 'options zfs zfs_arc_max="{{ zfs_arc_size_bytes }}"' line: 'options zfs zfs_arc_max="{{ zfs_arc_size_bytes }}"'
create: yes create: yes
- name: check for data pool
command: "zpool list"
register: pools
#ignore_errors: true
changed_when: pools.stdout.find('data') != -1
- zpool_facts: properties='all'
# really bad idempotence in here... # really bad idempotence in here...
- name: create zpool #- name: create zpool
command: "zpool create -f -O compression=lz4 data {{ zfs_disk }} -o ashift=13 -O secondarycache=all" # command: "zpool create -f -O compression=lz4 data {{ zfs_disk }} -o ashift=13 -O secondarycache=all"
when: not pools.changed and ('worker' in inventory_hostname) # args:
# creates: /etc/zvol/data/*

View file

@ -0,0 +1,7 @@
---
- name: install ZFS packages
package:
name: "{{ item }}"
state: present
with_items: "{{ UBUNTU_ZFS_PKGS | difference(ansible_facts.packages) }}"

View file

@ -0,0 +1,19 @@
---
- name: install zfs-release package (EPEL 7)
yum:
name: "http://download.zfsonlinux.org/epel/zfs-release.el7_7.noarch.rpm"
state: present
when: (ansible_distribution_major_version == "7")
- name: install zfs-release package (EPEL 8)
yum:
name: "http://download.zfsonlinux.org/epel/zfs-release.el8_1.noarch.rpm"
state: present
when: (ansible_distribution_major_version == "8")
- name: install zfs-release package (Fedora)
dnf:
name: "http://download.zfsonlinux.org/fedora/zfs-release.fc31.noarch.rpm"
state: present
when: (ansible_distribution in ["Fedora"] and not is_atomic)