From 0405924e260ca9faea553a18be42c2b303254bac Mon Sep 17 00:00:00 2001 From: James Antill Date: Fri, 14 Feb 2025 16:59:02 -0500 Subject: [PATCH] Add mod_wsgi.actions and libdnf plugin, to restart httpd. Signed-off-by: James Antill --- roles/mod_wsgi/files/mod_wsgi.actions | 19 +++++++++++++++++++ roles/mod_wsgi/tasks/main.yml | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 roles/mod_wsgi/files/mod_wsgi.actions diff --git a/roles/mod_wsgi/files/mod_wsgi.actions b/roles/mod_wsgi/files/mod_wsgi.actions new file mode 100644 index 0000000000..9fa2253f0e --- /dev/null +++ b/roles/mod_wsgi/files/mod_wsgi.actions @@ -0,0 +1,19 @@ +# Requirements: yum install libdnf5-plugin-actions + +# At the end of the DNF transaction +# if python3-mod_wsgi has (re)installed/(up|down)graded then +# restart HTTPD +# if python3-libs has (re)installed/(up|down)graded then +# restart HTTPD +# (will run the cmd twice on if they both change on (up/down)grades) +# Doesn't do anything if either are removed. +post_transaction:python3-mod_wsgi:in:enabled=host-only:/bin/systemctl try-restart --no-block httpd.service +post_transaction:python3-libs:in:enabled=host-only:/bin/systemctl try-restart --no-block httpd.service + +# Uncomment this line to do the same thing when it's removed +# (will run the cmd twice on (up/down)grades) +# post_transaction:python3-mod_wsgi:out:enabled=host-only:/bin/systemctl try-restart --no-block httpd.service + +# This is for python2-mod_wsgi ... probably DNF5 doesn't exist, or this package +# doesn't. +# post_transaction:python2-mod_wsgi:in:enabled=host-only:/bin/systemctl try-restart --no-block httpd.service diff --git a/roles/mod_wsgi/tasks/main.yml b/roles/mod_wsgi/tasks/main.yml index cea352bbed..bc5398c7cb 100644 --- a/roles/mod_wsgi/tasks/main.yml +++ b/roles/mod_wsgi/tasks/main.yml @@ -30,3 +30,21 @@ - Restart apache tags: - config + +# These next two should eventually be: install mod_wsgi-dnf5-actions +- name: Install libdnf actions plugin + ansible.builtin.package: + name: libdnf5-plugin-actions + state: present + tags: + - packages + # This is currently Fedora-40+ ... no RHEL, no EPEL + when: ansible_distribution == 'Fedora' + +- name: Wsgi libdnf actions + ansible.builtin.copy: src="mod_wsgi.actions" dest=/etc/dnf/libdnf5-plugins/actions.d + tags: + - config + # This does nothing without the above plugin, although we could install it + # everywhere. + when: ansible_distribution == 'Fedora'