Overhaul reuse structure from role to task orientation

The overall config this will end up with is going to be nowhere
near complicated enough to require the segmented structure of roles.
A single directory of reusable tasks and resources will be much better
This commit is contained in:
2020-12-04 14:47:33 -05:00
parent 5df550669a
commit f1639dce1e
26 changed files with 181 additions and 476 deletions

17
tasks/packages/clean.yml Normal file
View File

@@ -0,0 +1,17 @@
---
# I'm honestly not sure why these 304 warnings are being raised by the linter here...
- name: Clean DNF cache # noqa: 304
when: ansible_distribution == "Fedora" or (ansible_distribution == "CentOS" and ansible_distribution_major_version == "8")
become: true
command:
cmd: /usr/bin/dnf clean all
warn: false
changed_when: true
- name: Clean YUM cache # noqa: 304
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
become: true
command:
cmd: /usr/bin/yum clean all
warn: false
changed_when: true

View File

@@ -0,0 +1,21 @@
# NOTE: This is currently horrifically broken. See the ongoing drama around
# systemd-networkd on cent8. Basically triggering an update- or an install- will give
# a conflict error due to the spicy-jankaroni-with-extra-cheese edition of
# systemd-networkd I'm running. We can exclude "systemd*", but we need to install
# systemd-devel so then we get a package not found error. Its a truly stupid problem
# that will hopefully all go away when this bug gets fixed and systemd-networkd becomes
# available in EPEL:
# https://bugzilla.redhat.com/show_bug.cgi?id=1789146
- name: Install packages on CentOS 8
become: true
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "8"
dnf:
state: "{{ _runtime_update_state }}"
name: "{{ omni_packages_global + omni_packages_centos_8 }}"
- name: Install packages on CentOS 7
become: true
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
yum:
state: "{{ _runtime_update_state }}"
name: "{{ omni_packages_global + omni_packages_centos_7 }}"

32
tasks/packages/repos.yml Normal file
View File

@@ -0,0 +1,32 @@
---
- name: Install repositories on CentOS 8
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "8"
become: true
block:
- name: Enable Extra Packages for Enterprise Linux on CentOS 8
dnf:
state: present
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# The testing repo had to be enabled for a previous version of systemd-networkd
# to be installed
- name: Disable EPEL-Testing repository on CentOS 8
lineinfile:
path: /etc/yum.repos.d/epel-testing.repo
regexp: "enabled=(0|1)"
line: "enabled=0"
insertbefore: "^$"
firstmatch: true
- name: Enable the power tools repository on CentOS 8
lineinfile:
path: /etc/yum.repos.d/CentOS-PowerTools.repo
regexp: "enabled=(0|1)"
line: "enabled=1"
- name: Enable Extra Packages for Enterprise Linux on CentOS 7
become: true
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
yum:
state: present
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

32
tasks/packages/update.yml Normal file
View File

@@ -0,0 +1,32 @@
---
# Ansible Lint 403 ("Package installs should not use latest") is silenced here because
# it would defeat the point otherwise
- name: Upgrade Fedora and CentOS 8 packages # noqa: 403
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "8"
become: true
dnf:
state: latest
name: "*"
exclude: "{{ ','.join(omni_pkg_exclude | default(['kernel*', 'docker-ce'])) }}"
- name: Upgrade CentOS 7 packages # noqa: 403
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
become: true
yum:
state: latest
name: "*"
exclude: "{{ ','.join(omni_pkg_exclude | default(['kernel*', 'docker-ce'])) }}"
- name: Upgrade Fedora packages # noqa: 403
when: ansible_distribution == "Fedora"
become: true
dnf:
state: latest
name: "*"
exclude: "{{ ','.join(omni_pkg_exclude | default(['kernel*', 'docker-ce'])) }}"
# Yeah I'll get here eventually
# - name: Upgrade APT packages
# when: ansible_distribution == "Debian" or ansible_distribution == "Ubuntu"
# become: true
# apt: