Varnish: add many variables for systemd unit file
This commit is contained in:
parent
bdf534fdbb
commit
45337ece51
|
@ -1,3 +1,18 @@
|
|||
---
|
||||
thread_pools: "{{ ansible_processor_cores * ansible_processor_count }}"
|
||||
malloc: "2G"
|
||||
|
||||
varnish_addresses:
|
||||
- 0.0.0.0:80
|
||||
|
||||
varnish_management_address: localhost:6082
|
||||
|
||||
varnish_malloc_size: "2G"
|
||||
|
||||
varnish_storage: malloc,{{ varnish_malloc_size }}
|
||||
|
||||
varnish_thread_pools: "{{ ansible_processor_cores * ansible_processor_count }}"
|
||||
varnish_thread_pool_add_delay: 2
|
||||
varnish_thread_pool_min: 500
|
||||
varnish_thread_pool_max: 5000
|
||||
|
||||
varnish_config_file: /etc/varnish/default.vcl
|
||||
varnish_secret_file: /etc/varnish/secret
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[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
|
|
@ -24,9 +24,11 @@
|
|||
state: directory
|
||||
|
||||
- name: Modify Varnish configuration files
|
||||
copy:
|
||||
src: varnish.conf
|
||||
dest: /etc/systemd/system/varnish.service.d/
|
||||
template:
|
||||
src: varnish.conf.j2
|
||||
dest: /etc/systemd/system/varnish.service.d/varnish.conf
|
||||
force: yes
|
||||
backup: yes
|
||||
notify: reload systemctl
|
||||
|
||||
- name: Patch logrotate conf
|
||||
|
|
5
varnish/templates/varnish.conf.j2
Normal file
5
varnish/templates/varnish.conf.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/varnishd -a {{ varnish_addresses | join(',') }} -T {{ varnish_management_address }} -f {{ varnish_config_file }} -S {{ varnish_secret_file }} -s {{ varnish_storage }} -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 }}
|
||||
ExecReload=/etc/varnish/reload-vcl.sh
|
Loading…
Reference in a new issue