ansible-roles/varnish/tasks/main.yml
Jérémy Lecour bdf534fdbb Varnish: fix logrotate replace
it was not idempotent and would add a segment indefinitely
2017-04-12 18:04:09 +02:00

40 lines
909 B
YAML

---
- 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 Custom Varnish ExecReload script
copy:
src: "reload-vcl.sh"
dest: "/etc/varnish/reload-vcl.sh"
mode: "0700"
owner: root
group: root
- name: Create a system config directory for systemd overrides
file:
path: /etc/systemd/system/varnish.service.d
state: directory
- name: Modify Varnish configuration files
copy:
src: varnish.conf
dest: /etc/systemd/system/varnish.service.d/
notify: reload systemctl
- 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'
with_items:
- varnishlog
- varnishncsa