From 27adad616f3c7b1f90d40ae462eadfbcdd2caa29 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 24 Oct 2019 16:23:48 +0200 Subject: [PATCH] squid: compatibility wit Debian 10 --- CHANGELOG.md | 2 +- squid/files/squid.service | 22 ---------------------- squid/files/systemd-override.conf | 4 ++++ squid/tasks/systemd.yml | 27 +++++++++++++++++---------- 4 files changed, 22 insertions(+), 33 deletions(-) delete mode 100644 squid/files/squid.service create mode 100644 squid/files/systemd-override.conf diff --git a/CHANGELOG.md b/CHANGELOG.md index 024e3094..802c1703 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,7 @@ The **patch** part changes incrementally at each release. * php: Don't set a chroot for the default fpm pool * rbenv: install Ruby 2.6.5 by default * squid: Remove wait time when we turn off squid -* squid: split systemd tasks into own file +* squid: compatibility wit Debian 10 * varnish: remove custom ExecReload= script for Debian 10+ ### Fixed diff --git a/squid/files/squid.service b/squid/files/squid.service deleted file mode 100644 index 67240beb..00000000 --- a/squid/files/squid.service +++ /dev/null @@ -1,22 +0,0 @@ -## Copyright (C) 1996-2019 The Squid Software Foundation and contributors -## -## Squid software is distributed under GPLv2+ license and includes -## contributions from numerous individuals and organizations. -## Please see the COPYING and CONTRIBUTORS files for details. -## - -[Unit] -Description=Squid Web Proxy Server -Documentation=man:squid(8) -After=network.target network-online.target nss-lookup.target - -[Service] -Type=forking -PIDFile=/var/run/squid.pid -ExecStartPre=/usr/sbin/squid --foreground -z -ExecStart=/usr/sbin/squid -sYC -f /etc/squid/evolinux-defaults.conf -ExecReload=/bin/kill -HUP $MAINPID -KillMode=mixed - -[Install] -WantedBy=multi-user.target diff --git a/squid/files/systemd-override.conf b/squid/files/systemd-override.conf new file mode 100644 index 00000000..eab76a17 --- /dev/null +++ b/squid/files/systemd-override.conf @@ -0,0 +1,4 @@ +# systemd override for Squid +[Service] +ExecStart= +ExecStart=/usr/sbin/squid -sYC -f /etc/squid/evolinux-defaults.conf diff --git a/squid/tasks/systemd.yml b/squid/tasks/systemd.yml index efa936c3..1f9b34b7 100644 --- a/squid/tasks/systemd.yml +++ b/squid/tasks/systemd.yml @@ -4,21 +4,28 @@ command: systemctl -q is-active squid.service changed_when: False failed_when: False - register: squid_systemd_active + register: _squid_systemd_active + +- name: Squid systemd overrides directory exists + file: + dest: /etc/systemd/system/squid.service.d/ + state: directory + owner: root + group: root + mode: "0755" -- name: "Squid systemd unit service is present (Debian 10 or later)" +- name: "Squid systemd unit service is present" copy: - src: squid.service - dest: /etc/systemd/system/squid.service - when: - - ansible_distribution_major_version | version_compare('10', '>=') - - squid_systemd_active.rc != 0 + src: systemd-override.conf + dest: /etc/systemd/system/squid.service.d/override.conf + force: yes + register: _squid_systemd_override -- name: "Systemd is reload and Squid restarted (Debian 10 or later)" +- name: "Systemd daemon is reloaded and Squid restarted" systemd: name: squid state: restarted daemon_reload: yes when: - - ansible_distribution_major_version | version_compare('10', '>=') - - squid_systemd_active.rc != 0 + - _squid_systemd_active.rc == 0 + - _squid_systemd_override.changed