varnish: systemd override depends on Varnish
gitea/ansible-roles/pipeline/head This commit looks good
Details
gitea/ansible-roles/pipeline/head This commit looks good
Details
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: variable to disable transparent hugepage (default: do nothing)
|
||||
* squid: whitelist deb.freexian.com
|
||||
* varnish: systemd override depends on Varnish version instead of Debian version
|
||||
|
||||
### Fixed
|
||||
|
||||
* evolinux-user: Fix sudoers privilege for chck php\_fpm80
|
||||
* evolinux-user: Fix sudoers privilege for check php\_fpm80
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
@ -6,6 +6,17 @@
|
|||
tags:
|
||||
- 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
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
|
@ -38,27 +49,41 @@
|
|||
tags:
|
||||
- varnish
|
||||
|
||||
- name: Override Varnish systemd unit (Stretch and before)
|
||||
template:
|
||||
src: varnish.conf.jessie.j2
|
||||
dest: /etc/systemd/system/varnish.service.d/evolinux.conf
|
||||
force: yes
|
||||
when: ansible_distribution_major_version is version('10', '<')
|
||||
- name: Rename legacy systemd override
|
||||
command: mv /etc/systemd/system/varnish.service.d/evolinux.conf /etc/systemd/system/varnish.service.d/override.conf
|
||||
args:
|
||||
removes: /etc/systemd/system/varnish.service.d/evolinux.conf
|
||||
creates: /etc/systemd/system/varnish.service.d/override.conf
|
||||
notify:
|
||||
- reload systemd
|
||||
- restart varnish
|
||||
tags:
|
||||
- varnish
|
||||
- config
|
||||
- update-config
|
||||
|
||||
# TODO: verify if it's still necessary for Debian 11
|
||||
- name: Override Varnish systemd unit (Buster and later)
|
||||
- name: Varnish systemd override template (Varnish 4 and 5)
|
||||
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:
|
||||
src: varnish.conf.buster.j2
|
||||
dest: /etc/systemd/system/varnish.service.d/evolinux.conf
|
||||
src: "{{ varnish_systemd_override_template }}"
|
||||
dest: /etc/systemd/system/varnish.service.d/override.conf
|
||||
force: yes
|
||||
when: ansible_distribution_major_version is version('10', '>=')
|
||||
notify:
|
||||
- reload systemd
|
||||
- restart varnish
|
||||
|
|
|
@ -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 New Issue