varnish: config file name is configurable

This commit is contained in:
Jérémy Lecour 2020-12-20 22:55:39 +01:00 committed by Jérémy Lecour
parent 81fbd98a5f
commit 8861169a04
4 changed files with 9 additions and 8 deletions

View File

@ -23,6 +23,7 @@ The **patch** part changes incrementally at each release.
* redis: variable to force use of port 6379 in instances mode * redis: variable to force use of port 6379 in instances mode
* redis: check maxmemory in NRPE check * redis: check maxmemory in NRPE check
* lxc-php: Allow php containers to contact local MySQL with localhost * lxc-php: Allow php containers to contact local MySQL with localhost
* varnish: config file name is configurable
### Changed ### Changed

View File

@ -1,5 +0,0 @@
#!/bin/sh
UUID=`cat /proc/sys/kernel/random/uuid`
/usr/sbin/varnishd -C -f /etc/varnish/default.vcl >/dev/null \
&&/usr/bin/varnishadm -T localhost:6082 -S /etc/varnish/secret "vcl.load vcl_$UUID /etc/varnish/default.vcl" \
&& /usr/bin/varnishadm -T localhost:6082 -S /etc/varnish/secret "vcl.use vcl_$UUID"

View File

@ -19,8 +19,8 @@
- varnish - varnish
- name: Copy Custom Varnish ExecReload script (Debian <=9) - name: Copy Custom Varnish ExecReload script (Debian <=9)
copy: template:
src: "reload-vcl.sh" src: "reload-vcl.sh.j2"
dest: "/etc/varnish/reload-vcl.sh" dest: "/etc/varnish/reload-vcl.sh"
mode: "0700" mode: "0700"
owner: root owner: root
@ -62,7 +62,7 @@
- name: Copy Varnish configuration - name: Copy Varnish configuration
template: template:
src: "{{ item }}" src: "{{ item }}"
dest: /etc/varnish/default.vcl dest: "{{ varnish_config_file }}"
mode: "0644" mode: "0644"
force: yes force: yes
with_first_found: with_first_found:

View File

@ -0,0 +1,5 @@
#!/bin/sh
UUID=`cat /proc/sys/kernel/random/uuid`
/usr/sbin/varnishd -C -f {{ varnish_config_file }} >/dev/null \
&& /usr/bin/varnishadm -T {{ varnish_management_address }} -S {{ varnish_secret_file }} "vcl.load vcl_$UUID {{ varnish_config_file }}" \
&& /usr/bin/varnishadm -T {{ varnish_management_address }} -S {{ varnish_secret_file }} "vcl.use vcl_$UUID"