From 612af5e20c202124a29d19ec55db54f31f57c948 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sun, 23 Jan 2022 23:52:31 +0100 Subject: [PATCH] copr: use systemd drop-ins instead of chaning /usr --- .../system/httpd.service.d/50-oom.conf | 3 +++ .../system/httpd.service.d/50-restart.conf | 4 ++++ roles/copr/frontend/tasks/httpd.yml | 21 ------------------- roles/copr/frontend/tasks/main.yml | 2 ++ 4 files changed, 9 insertions(+), 21 deletions(-) create mode 100644 roles/copr/frontend/files/systemd/system/httpd.service.d/50-oom.conf create mode 100644 roles/copr/frontend/files/systemd/system/httpd.service.d/50-restart.conf diff --git a/roles/copr/frontend/files/systemd/system/httpd.service.d/50-oom.conf b/roles/copr/frontend/files/systemd/system/httpd.service.d/50-oom.conf new file mode 100644 index 0000000000..398ecc8a51 --- /dev/null +++ b/roles/copr/frontend/files/systemd/system/httpd.service.d/50-oom.conf @@ -0,0 +1,3 @@ +# Keep httpd master running when child is OOM killed, rhbz#1947475 +[Service] +OOMPolicy = continue diff --git a/roles/copr/frontend/files/systemd/system/httpd.service.d/50-restart.conf b/roles/copr/frontend/files/systemd/system/httpd.service.d/50-restart.conf new file mode 100644 index 0000000000..cdd5c1b82d --- /dev/null +++ b/roles/copr/frontend/files/systemd/system/httpd.service.d/50-restart.conf @@ -0,0 +1,4 @@ +# When httpd is OOM killed or otherwise failed, start it again +[Service] +Restart = on-failure +RestartSec = 5s diff --git a/roles/copr/frontend/tasks/httpd.yml b/roles/copr/frontend/tasks/httpd.yml index 2d219e4f5e..5a8e0ddf33 100644 --- a/roles/copr/frontend/tasks/httpd.yml +++ b/roles/copr/frontend/tasks/httpd.yml @@ -82,27 +82,6 @@ regexp: '^LoadModule substitute_module modules/mod_substitute.so' line: '#LoadModule substitute_module modules/mod_substitute.so' -- name: Keep httpd master running when child is OOM killed, rhbz#1947475 - ini_file: - path: /usr/lib/systemd/system/httpd.service - section: Service - option: OOMPolicy - value: continue - backup: yes - notify: restart apache - -- name: When httpd is OOM killed or otherwise failed, start it again - ini_file: - path: /usr/lib/systemd/system/httpd.service - section: Service - option: "{{ item.option }}" - value: "{{ item.value }}" - backup: yes - with_items: - - { option: "Restart", value: "on-failure" } - - { option: "RestartSec", value: "5s" } - notify: restart apache - - include_role: name: keytab/service vars: diff --git a/roles/copr/frontend/tasks/main.yml b/roles/copr/frontend/tasks/main.yml index 0946098e4a..ece79019d6 100644 --- a/roles/copr/frontend/tasks/main.yml +++ b/roles/copr/frontend/tasks/main.yml @@ -141,6 +141,8 @@ - name: install custom systemd service files copy: src=systemd dest=/etc + notify: + - reload httpd - name: compress rotated httpd logs copy: src="httpd.logrotate" dest="/etc/logrotate.d/httpd"