From 4be248ce58566d42e6fd781d84a4ba5cef875b91 Mon Sep 17 00:00:00 2001 From: Romain Dessort Date: Wed, 15 Mar 2017 18:01:33 -0400 Subject: [PATCH] Fix Varnish systemd unit We need to switch to copy module instead of ini_file since it doe not support putting the same key multiple times in a section. --- varnish/files/varnish.conf | 4 ++++ varnish/tasks/main.yml | 11 +++-------- 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 varnish/files/varnish.conf diff --git a/varnish/files/varnish.conf b/varnish/files/varnish.conf new file mode 100644 index 00000000..d1f113c2 --- /dev/null +++ b/varnish/files/varnish.conf @@ -0,0 +1,4 @@ +[Service] +ExecStart= +ExecStart=/usr/sbin/varnishd -a 0.0.0.0:80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,2G -p thread_pools=2 -p thread_pool_add_delay=2 -p thread_pool_min=500 -p thread_pool_max=5000 +ExecReload=/etc/varnish/reload-vcl.sh diff --git a/varnish/tasks/main.yml b/varnish/tasks/main.yml index d73b588e..0274f765 100644 --- a/varnish/tasks/main.yml +++ b/varnish/tasks/main.yml @@ -24,12 +24,7 @@ state: directory - name: Modify Varnish configuration files - ini_file: - dest: /etc/systemd/system/varnish.service.d/varnish.conf - section: Service - option: "{{ item.option }}" - value: "{{ item.value }}" + copy: + src: varnish.conf + dest: /etc/systemd/system/varnish.service.d/ notify: reload systemctl - with_items: - - { option: ExecStart, value: "/usr/sbin/varnishd -a 0.0.0.0:80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,{{ malloc }} -p thread_pools={{ thread_pools }} -p thread_pool_add_delay=2 -p thread_pool_min=500 -p thread_pool_max=5000 "} - - { option: ExecReload, value: "/etc/varnish/reload-vcl.sh" }