Add package installation and management role
Manages dracut patch, upgrades packages, and installs standard packages
This commit is contained in:
parent
1caa880cc1
commit
079e642b98
65
roles/packages/tasks/centos-dracut.yml
Normal file
65
roles/packages/tasks/centos-dracut.yml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
# The dracut patch is an issue uniquely bound to the fact that I'm using several
|
||||||
|
# old-as-shit hardware RAID cards. Specifically the Dell PERC H200 and the Dell PERC
|
||||||
|
# H310, both of which had their hardware drivers dropped in Cent8 (despite the drivers
|
||||||
|
# being included in the upstream fedora kernel, but whatever). OS installation and the
|
||||||
|
# process in this set of tasks is based off of this blog post:
|
||||||
|
# https://www.centos.org/forums/viewtopic.php?t=71862#p302447
|
||||||
|
#
|
||||||
|
# TODO: Host the RPMs locally. The internet may never forget, but it's also never there
|
||||||
|
# when you need it
|
||||||
|
|
||||||
|
- name: Determine dracut version
|
||||||
|
shell:
|
||||||
|
cmd: rpm -qa | grep dracut-[0-9]
|
||||||
|
warn: false
|
||||||
|
register: dracut_version_check
|
||||||
|
|
||||||
|
- name: Install patched version of dracut
|
||||||
|
when: dracut_version_check.stdout != "dracut-049-13.git20190614.p1.el8_0.elrepo.x86_64"
|
||||||
|
block:
|
||||||
|
- name: Create temporary download directory
|
||||||
|
file:
|
||||||
|
path: /tmp/dracut-patch
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Download patched dracut tool RPMs
|
||||||
|
get_url:
|
||||||
|
url: "{{ item.source }}"
|
||||||
|
dest: /tmp/dracut-patch/{{ item.dest }}
|
||||||
|
loop:
|
||||||
|
- source: http://elrepo.org/people/akemi/testing/el8/dracut/dracut-049-13.git20190614.p1.el8_0.elrepo.x86_64.rpm
|
||||||
|
dest: dracut.rpm
|
||||||
|
- source: http://elrepo.org/people/akemi/testing/el8/dracut/dracut-caps-049-13.git20190614.p1.el8_0.elrepo.x86_64.rpm
|
||||||
|
dest: dracut-caps.rpm
|
||||||
|
- source: http://elrepo.org/people/akemi/testing/el8/dracut/dracut-config-generic-049-13.git20190614.p1.el8_0.elrepo.x86_64.rpm
|
||||||
|
dest: dracut-config-generic.rpm
|
||||||
|
- source: http://elrepo.org/people/akemi/testing/el8/dracut/dracut-config-rescue-049-13.git20190614.p1.el8_0.elrepo.x86_64.rpm
|
||||||
|
dest: dracut-config-rescue.rpm
|
||||||
|
- source: http://elrepo.org/people/akemi/testing/el8/dracut/dracut-live-049-13.git20190614.p1.el8_0.elrepo.x86_64.rpm
|
||||||
|
dest: dracut-live.rpm
|
||||||
|
- source: http://elrepo.org/people/akemi/testing/el8/dracut/dracut-network-049-13.git20190614.p1.el8_0.elrepo.x86_64.rpm
|
||||||
|
dest: dracut-network.rpm
|
||||||
|
- source: http://elrepo.org/people/akemi/testing/el8/dracut/dracut-squash-049-13.git20190614.p1.el8_0.elrepo.x86_64.rpm
|
||||||
|
dest: dracut-squash.rpm
|
||||||
|
- source: http://elrepo.org/people/akemi/testing/el8/dracut/dracut-tools-049-13.git20190614.p1.el8_0.elrepo.x86_64.rpm
|
||||||
|
dest: dracut-tools.rpm
|
||||||
|
|
||||||
|
- name: Install patched dracut toolchain
|
||||||
|
become: true
|
||||||
|
dnf:
|
||||||
|
state: latest
|
||||||
|
name:
|
||||||
|
- /tmp/dracut-patch/dracut.rpm
|
||||||
|
- /tmp/dracut-patch/dracut-caps.rpm
|
||||||
|
- /tmp/dracut-patch/dracut-config-generic.rpm
|
||||||
|
- /tmp/dracut-patch/dracut-config-rescue.rpm
|
||||||
|
- /tmp/dracut-patch/dracut-live.rpm
|
||||||
|
- /tmp/dracut-patch/dracut-network.rpm
|
||||||
|
- /tmp/dracut-patch/dracut-squash.rpm
|
||||||
|
- /tmp/dracut-patch/dracut-tools.rpm
|
||||||
|
|
||||||
|
- name: Remove temporary download directory
|
||||||
|
file:
|
||||||
|
path: /tmp/dracut-patch
|
||||||
|
state: absent
|
13
roles/packages/tasks/centos-repos.yml
Normal file
13
roles/packages/tasks/centos-repos.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
- name: Enable Extra Packages for Enterprise Linux
|
||||||
|
become: true
|
||||||
|
dnf:
|
||||||
|
state: latest
|
||||||
|
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||||
|
|
||||||
|
- name: Enable the power tools repository
|
||||||
|
become: true
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/yum.repos.d/CentOS-PowerTools.repo
|
||||||
|
regexp: "enabled=(0|1)"
|
||||||
|
line: "enabled=1"
|
7
roles/packages/tasks/clean.yml
Normal file
7
roles/packages/tasks/clean.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: Clean DNF cache
|
||||||
|
become: true
|
||||||
|
when: ansible_distribution == "Fedora" or ansible_distribution == "CentOS"
|
||||||
|
shell:
|
||||||
|
cmd: dnf clean all
|
||||||
|
warn: false
|
23
roles/packages/tasks/main.yml
Normal file
23
roles/packages/tasks/main.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: centos-repos.yml
|
||||||
|
when: ansible_distribution == "CentOS"
|
||||||
|
|
||||||
|
- import_tasks: clean.yml
|
||||||
|
when: clean | default(false) == true
|
||||||
|
|
||||||
|
- import_tasks: update.yml
|
||||||
|
when: update | default(false) == true
|
||||||
|
|
||||||
|
- name: Install packages on Fedora
|
||||||
|
become: true
|
||||||
|
when: ansible_distribution == "Fedora"
|
||||||
|
dnf:
|
||||||
|
state: latest
|
||||||
|
name: "{{ packages_global + packages_fedora }}"
|
||||||
|
|
||||||
|
- name: Install packages on CentOS
|
||||||
|
become: true
|
||||||
|
when: ansible_distribution == "CentOS"
|
||||||
|
dnf:
|
||||||
|
state: latest
|
||||||
|
name: "{{ packages_global + packages_centos }}"
|
16
roles/packages/tasks/update.yml
Normal file
16
roles/packages/tasks/update.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: centos-dracut.yml
|
||||||
|
when: ansible_distribution == "CentOS"
|
||||||
|
|
||||||
|
- name: Upgrade Fedora and CentOS packages
|
||||||
|
when: ansible_distribution == "CentOS" or ansible_distribution == "Fedora"
|
||||||
|
become: true
|
||||||
|
dnf:
|
||||||
|
state: latest
|
||||||
|
name: "*"
|
||||||
|
exclude: "{{ ','.join(exclude | default(['kernel*'])) }}"
|
||||||
|
|
||||||
|
# - name: Upgrade APT packages
|
||||||
|
# when: ansible_distribution == "Debian" or ansible_distribution == "Ubuntu"
|
||||||
|
# become: true
|
||||||
|
# apt:
|
35
roles/packages/vars/main.yml
Normal file
35
roles/packages/vars/main.yml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
packages_global:
|
||||||
|
- automake
|
||||||
|
- cmake
|
||||||
|
- curl
|
||||||
|
- gcc
|
||||||
|
- gcc-c++
|
||||||
|
- git
|
||||||
|
- make
|
||||||
|
- nano
|
||||||
|
- openssl-devel
|
||||||
|
- systemd-devel
|
||||||
|
- unzip
|
||||||
|
- vim
|
||||||
|
- vim-minimal
|
||||||
|
|
||||||
|
packages_fedora:
|
||||||
|
- libselinux-python
|
||||||
|
- git-lfs
|
||||||
|
- readline-devel
|
||||||
|
- policycoreutils-python
|
||||||
|
- python-devel
|
||||||
|
- python-virtualenv
|
||||||
|
- python3-devel
|
||||||
|
|
||||||
|
packages_centos:
|
||||||
|
- bind-utils
|
||||||
|
- bash-completion
|
||||||
|
- nc
|
||||||
|
- nfs-utils
|
||||||
|
- python3
|
||||||
|
- python3-pip
|
||||||
|
- python3-setuptools
|
||||||
|
- python3-virtualenv
|
||||||
|
- wget
|
Reference in New Issue
Block a user