zfs: optimize packages, invoke pkg manager only when required
This commit is contained in:
parent
3cda795476
commit
fad0a40eff
2 changed files with 11 additions and 10 deletions
|
@ -1,6 +1,10 @@
|
||||||
---
|
---
|
||||||
ZFS_PKGS:
|
EL_ZFS_PKGS:
|
||||||
- kernel-devel
|
- kernel-devel
|
||||||
- "@Development tools"
|
- "@Development tools"
|
||||||
- dkms
|
- dkms
|
||||||
- zfs
|
- zfs
|
||||||
|
|
||||||
|
UBUNTU_ZFS_PKGS:
|
||||||
|
- zfsutils-linux
|
||||||
|
- zfs-initramfs
|
||||||
|
|
|
@ -18,32 +18,29 @@
|
||||||
yum:
|
yum:
|
||||||
name: "http://download.zfsonlinux.org/epel/zfs-release.el7_7.noarch.rpm"
|
name: "http://download.zfsonlinux.org/epel/zfs-release.el7_7.noarch.rpm"
|
||||||
state: present
|
state: present
|
||||||
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux" ]) and (ansible_distribution_major_version == "7")
|
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)
|
- name: install zfs-release package (EPEL 8)
|
||||||
yum:
|
yum:
|
||||||
name: "http://download.zfsonlinux.org/epel/zfs-release.el8_1.noarch.rpm"
|
name: "http://download.zfsonlinux.org/epel/zfs-release.el8_1.noarch.rpm"
|
||||||
state: present
|
state: present
|
||||||
when: (ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux" ]) and (ansible_distribution_major_version == "8")
|
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)
|
- name: install zfs-release package (Fedora)
|
||||||
dnf:
|
dnf:
|
||||||
name: "http://download.zfsonlinux.org/fedora/zfs-release.fc31.noarch.rpm"
|
name: "http://download.zfsonlinux.org/fedora/zfs-release.fc31.noarch.rpm"
|
||||||
state: present
|
state: present
|
||||||
when: ansible_distribution in ["Fedora"] and not is_atomic
|
when: ('zfs-release' not in ansible_facts.packages) and (ansible_distribution in ["Fedora"] and not is_atomic)
|
||||||
|
|
||||||
- name: install zfs utils (Ubuntu)
|
- name: install ZFS (Ubuntu)
|
||||||
package:
|
package:
|
||||||
name: "{{ item }}"
|
name: "{{ UBUNTU_ZFS_PKGS | difference(ansible_facts.packages) }}"
|
||||||
state: present
|
state: present
|
||||||
with_items:
|
|
||||||
- zfsutils-linux
|
|
||||||
- zfs-initramfs
|
|
||||||
when: ansible_distribution in ["Ubuntu"]
|
when: ansible_distribution in ["Ubuntu"]
|
||||||
|
|
||||||
- name: install zfs and dkms
|
- name: install zfs and dkms
|
||||||
package:
|
package:
|
||||||
name: "{{ ZFS_PKGS | difference(ansible_facts.packages) }}"
|
name: "{{ EL_ZFS_PKGS | difference(ansible_facts.packages) }}"
|
||||||
state: present
|
state: present
|
||||||
register: zfs_installed
|
register: zfs_installed
|
||||||
when: ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "Fedora" ] and not is_atomic
|
when: ansible_distribution in ["CentOS" , "Red Hat Enterprise Linux", "Fedora" ] and not is_atomic
|
||||||
|
|
Loading…
Reference in a new issue