varnish: systemd override depends on Varnish
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
Use Varnish version instead of Debian version to choose systemd override template, to make it forward compatible
This commit is contained in:
parent
b1138c07ee
commit
4d259d3c04
|
@ -29,10 +29,11 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
* redis: some values should be quoted
|
* redis: some values should be quoted
|
||||||
* redis: variable to disable transparent hugepage (default: do nothing)
|
* redis: variable to disable transparent hugepage (default: do nothing)
|
||||||
* squid: whitelist deb.freexian.com
|
* squid: whitelist deb.freexian.com
|
||||||
|
* varnish: systemd override depends on Varnish version instead of Debian version
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
* evolinux-user: Fix sudoers privilege for chck php\_fpm80
|
* evolinux-user: Fix sudoers privilege for check php\_fpm80
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,17 @@
|
||||||
tags:
|
tags:
|
||||||
- varnish
|
- varnish
|
||||||
|
|
||||||
|
- name: Fetch packages
|
||||||
|
package_facts:
|
||||||
|
manager: auto
|
||||||
|
tags:
|
||||||
|
- varnish
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
varnish_package_facts: ansible_facts.packages['varnish'] | first
|
||||||
|
tags:
|
||||||
|
- varnish
|
||||||
|
|
||||||
- name: Remove default varnish configuration files
|
- name: Remove default varnish configuration files
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
|
@ -19,7 +30,7 @@
|
||||||
- varnish
|
- varnish
|
||||||
- config
|
- config
|
||||||
|
|
||||||
- name: Copy Custom Varnish ExecReload script (Debian <10)
|
- name: Copy Custom Varnish ExecReload script (Debian < 10)
|
||||||
template:
|
template:
|
||||||
src: "reload-vcl.sh.j2"
|
src: "reload-vcl.sh.j2"
|
||||||
dest: "/etc/varnish/reload-vcl.sh"
|
dest: "/etc/varnish/reload-vcl.sh"
|
||||||
|
@ -38,27 +49,41 @@
|
||||||
tags:
|
tags:
|
||||||
- varnish
|
- varnish
|
||||||
|
|
||||||
- name: Override Varnish systemd unit (Stretch and before)
|
- name: Rename legacy systemd override
|
||||||
template:
|
command: mv /etc/systemd/system/varnish.service.d/evolinux.conf /etc/systemd/system/varnish.service.d/override.conf
|
||||||
src: varnish.conf.jessie.j2
|
args:
|
||||||
dest: /etc/systemd/system/varnish.service.d/evolinux.conf
|
removes: /etc/systemd/system/varnish.service.d/evolinux.conf
|
||||||
force: yes
|
creates: /etc/systemd/system/varnish.service.d/override.conf
|
||||||
when: ansible_distribution_major_version is version('10', '<')
|
|
||||||
notify:
|
notify:
|
||||||
- reload systemd
|
- reload systemd
|
||||||
- restart varnish
|
|
||||||
tags:
|
tags:
|
||||||
- varnish
|
- varnish
|
||||||
- config
|
|
||||||
- update-config
|
|
||||||
|
|
||||||
# TODO: verify if it's still necessary for Debian 11
|
- name: Varnish systemd override template (Varnish 4 and 5)
|
||||||
- name: Override Varnish systemd unit (Buster and later)
|
set_fact:
|
||||||
|
varnish_systemd_override_template: override.conf.varnish4.j2
|
||||||
|
when:
|
||||||
|
- varnish_package_facts['version'] is version('4', '>=')
|
||||||
|
- varnish_package_facts['version'] is version('6', '<')
|
||||||
|
|
||||||
|
- name: Varnish systemd override template (Varnish 6)
|
||||||
|
set_fact:
|
||||||
|
varnish_systemd_override_template: override.conf.varnish6.j2
|
||||||
|
when:
|
||||||
|
- varnish_package_facts['version'] is version('6', '>=')
|
||||||
|
- varnish_package_facts['version'] is version('7', '<')
|
||||||
|
|
||||||
|
- name: Varnish systemd override template (Varnish 7 and later)
|
||||||
|
set_fact:
|
||||||
|
varnish_systemd_override_template: override.conf.varnish7.j2
|
||||||
|
when:
|
||||||
|
- varnish_package_facts['version'] is version('7', '>=')
|
||||||
|
|
||||||
|
- name: Override Varnish systemd unit
|
||||||
template:
|
template:
|
||||||
src: varnish.conf.buster.j2
|
src: "{{ varnish_systemd_override_template }}"
|
||||||
dest: /etc/systemd/system/varnish.service.d/evolinux.conf
|
dest: /etc/systemd/system/varnish.service.d/override.conf
|
||||||
force: yes
|
force: yes
|
||||||
when: ansible_distribution_major_version is version('10', '>=')
|
|
||||||
notify:
|
notify:
|
||||||
- reload systemd
|
- reload systemd
|
||||||
- restart varnish
|
- restart varnish
|
||||||
|
|
18
varnish/templates/override.conf.varnish7.j2
Normal file
18
varnish/templates/override.conf.varnish7.j2
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=
|
||||||
|
ExecStart=/usr/sbin/varnishd \
|
||||||
|
-j {{ varnish_jail }} \
|
||||||
|
{{ varnish_addresses | map('regex_replace', '^(.*)$', '-a \\1') | list | join(' ') }} \
|
||||||
|
-P %t/%N/varnishd.pid \
|
||||||
|
-T {{ varnish_management_address }} \
|
||||||
|
-f {{ varnish_config_file }} \
|
||||||
|
-S {{ varnish_secret_file }} \
|
||||||
|
-s {{ varnish_storage }} \
|
||||||
|
-p feature=+http2 \
|
||||||
|
-p thread_pools={{ varnish_thread_pools }} \
|
||||||
|
-p thread_pool_add_delay={{ varnish_thread_pool_add_delay }} \
|
||||||
|
-p thread_pool_min={{ varnish_thread_pool_min }} \
|
||||||
|
-p thread_pool_max={{ varnish_thread_pool_max }} \
|
||||||
|
{{ varnish_additional_options }}
|
Loading…
Reference in a new issue