---
# Tasks to set up varnish

- name: install needed packages
  yum: pkg={{ item }} state=installed
  with_items:
  - varnish
  tags:
  - varnish
  - packages

- name: set some varnishd selinux boolean
  seboolean: name=varnishd_connect_any persistent=yes state=yes
  tags:
  - varnish
  - selinux

- name: install varnish /etc/sysconfig/varnish
  copy: src={{ item.file }} dest={{ item.dest }}
        owner=root group=root
  with_items:
  - { file: varnish, dest: /etc/sysconfig/varnish }
  notify:
  - restart varnish
  tags:
  - varnish

- name: install /etc/varnish/default.vcl
  template: src=proxy.vcl.j2 dest=/etc/varnish/default.vcl
            owner=root group=root
  with_items:
  - proxy.vcl
  notify:
  - restart varnish
  tags:
  - varnish

- name: make sure varnish is set to enabled on boot
  service: enabled=yes name=varnish
  tags:
  - varnish
