ansible-roles/varnish/tasks/main.yml

98 lines
2 KiB
YAML
Raw Normal View History

2016-11-15 20:00:26 +01:00
---
- name: Install Varnish
2016-11-18 16:24:54 +01:00
apt:
name: varnish
state: present
2017-05-12 13:44:59 +02:00
tags:
- varnish
2016-11-15 20:00:26 +01:00
- name: Remove default varnish configuration files
file:
path: "{{ item }}"
state: absent
with_items:
- /etc/default/varnish
- /etc/default/varnishncsa
- /etc/default/varnishlog
2017-11-30 23:51:18 +01:00
notify: reload varnish
2017-05-12 13:44:59 +02:00
tags:
- varnish
2016-11-15 20:00:26 +01:00
- name: Copy Custom Varnish ExecReload script (Debian <=9)
template:
src: "reload-vcl.sh.j2"
dest: "/etc/varnish/reload-vcl.sh"
mode: "0700"
owner: root
group: root
when: ansible_distribution_major_version is version('9', '<=')
2017-11-30 23:51:18 +01:00
notify: reload varnish
2017-05-12 13:44:59 +02:00
tags:
- varnish
2016-11-18 16:24:54 +01:00
- name: Create a system config directory for systemd overrides
file:
path: /etc/systemd/system/varnish.service.d
state: directory
2017-05-12 13:44:59 +02:00
tags:
- varnish
2016-11-18 16:24:54 +01:00
- name: Override Varnish systemd unit
template:
src: varnish.conf.j2
dest: /etc/systemd/system/varnish.service.d/evolinux.conf
force: yes
2017-11-30 23:51:18 +01:00
notify:
- reload systemd
- restart varnish
2017-05-12 13:44:59 +02:00
tags:
- varnish
2017-03-30 17:54:58 +02:00
- name: Patch logrotate conf
replace:
name: /etc/logrotate.d/varnish
regexp: '^(\s+)(/usr/sbin/invoke-rc.d {{item}}.*)'
replace: '\1systemctl -q is-active {{item}} && \2'
2017-03-30 17:54:58 +02:00
with_items:
- varnishlog
- varnishncsa
2017-05-12 13:44:59 +02:00
tags:
- varnish
2017-05-12 12:40:23 +02:00
- name: Copy Varnish configuration
template:
src: "{{ item }}"
dest: "{{ varnish_config_file }}"
2017-05-15 14:21:28 +02:00
mode: "0644"
2017-05-12 12:40:23 +02:00
force: yes
with_first_found:
- "templates/varnish/default.{{ inventory_hostname }}.vcl.j2"
- "templates/varnish/default.{{ host_group }}.vcl.j2"
- "templates/varnish/default.default.vcl.j2"
- "default.vcl.j2"
notify: reload varnish
2017-05-12 13:44:59 +02:00
tags:
- varnish
2017-05-15 14:21:28 +02:00
- name: Create Varnish config dir
file:
path: /etc/varnish/conf.d
state: directory
mode: "0755"
tags:
- varnish
- name: Copy included Varnish config
template:
src: "{{ item }}"
dest: /etc/varnish/conf.d/
force: yes
mode: "0644"
with_fileglob:
- "templates/varnish/conf.d/*.vcl"
notify: reload varnish
tags:
- varnish
2017-05-23 22:19:29 +02:00
- include: munin.yml