ansible-roles/varnish/tasks/main.yml
2016-12-21 16:12:25 +01:00

39 lines
1.1 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- 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/"
remote_src: True
force: no
mode: 0644
owner: root
group: root
- 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:
dest: "/etc/systemd/system/varnish.service"
section: "Service"
option: "{{ item.option }}"
value: "{{ value.value }}"
notify: reload systemctl
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' }