2016-11-15 20:00:26 +01:00
|
|
|
|
---
|
|
|
|
|
- name: Install Varnish
|
|
|
|
|
apt: name=varnish state=present
|
|
|
|
|
|
|
|
|
|
- name: Remove default varnish configuration files
|
|
|
|
|
file:
|
|
|
|
|
path: "{{ item }}"
|
|
|
|
|
state: absent
|
|
|
|
|
with_fileglob: "/etc/defaults/varnish*"
|
|
|
|
|
|
|
|
|
|
- name: Copy Varnish service configuration file
|
|
|
|
|
copy:
|
|
|
|
|
src: "/lib/systemd/system/varnish.service"
|
|
|
|
|
dest: "/etc/systemd/system/"
|
2016-11-18 15:51:44 +01:00
|
|
|
|
remote_src: True
|
2016-11-15 20:48:28 +01:00
|
|
|
|
force: no
|
2016-11-18 15:51:44 +01:00
|
|
|
|
mode: 0644
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
2016-11-15 20:00:26 +01:00
|
|
|
|
|
2016-11-18 15:51:44 +01:00
|
|
|
|
- name: Copy Custom Varnish ExecReload script
|
|
|
|
|
copy:
|
|
|
|
|
src: "reload-vcl.sh"
|
|
|
|
|
dest: "/etc/varnish/reload-vcl.sh"
|
|
|
|
|
mode: 0700
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
|
|
|
|
|
- name: Modify Varnish configuration files
|
|
|
|
|
ini_file:
|
2016-11-15 20:00:26 +01:00
|
|
|
|
dest: "/etc/systemd/system/varnish.service"
|
2016-11-18 15:51:44 +01:00
|
|
|
|
section: "Service"
|
|
|
|
|
option: "{{ item.option }}"
|
|
|
|
|
value: "{{ value.value }}"
|
2016-11-15 20:00:26 +01:00
|
|
|
|
notify: reload systemctl
|
2016-11-18 15:51:44 +01:00
|
|
|
|
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' }
|