From bb288ca991c076c181d3fda1b2dd5ada883f6c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20S=C3=89RIE?= Date: Wed, 3 Jul 2019 10:07:00 +0200 Subject: [PATCH] squid: Custom systemd unit file for Debian >=10 Fixes #63 --- squid/files/squid.service | 22 ++++++++++++++++++++++ squid/tasks/main.yml | 13 +++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 squid/files/squid.service diff --git a/squid/files/squid.service b/squid/files/squid.service new file mode 100644 index 00000000..67240beb --- /dev/null +++ b/squid/files/squid.service @@ -0,0 +1,22 @@ +## 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/tasks/main.yml b/squid/tasks/main.yml index 17429954..2e50789e 100644 --- a/squid/tasks/main.yml +++ b/squid/tasks/main.yml @@ -29,6 +29,12 @@ dest: /etc/default/squid when: ansible_distribution_major_version | version_compare('9', '>=') +- name: "Set custom systemd unit service (Debian 10 or later)" + copy: + src: squid.service + dst: /etc/systemd/system/squid.service + when: ansible_distribution_major_version | version_compare('10', '>=') + - name: "squid.conf is present (jessie)" template: src: squid.conf.j2 @@ -134,6 +140,13 @@ notify: "reload squid" when: ansible_distribution_major_version | version_compare('9', '>=') +- name: "Reload systemd and restart squid (Debian 10 or later)" + systemd: + name: squid + state: restarted + daemon_reload: yes + when: ansible_distribution_major_version | version_compare('10', '>=') + - include: logrotate_jessie.yml when: ansible_distribution_release == "jessie"