---

#- include: "yum.yml"

- yum:
    name={{ item }}
    state=present
  with_items:
    - varnish

- template:
    src=default.vcl.j2
    dest=/etc/varnish/default.vcl
    backup=yes
  notify:
    - restart varnish

- template:
    src=varnish.params.j2
    dest=/etc/varnish/varnish.params
    backup=yes
  notify:
    - restart varnish

- template:
    src=varnish.secret.j2
    dest=/etc/varnish/secret
    backup=yes
  notify:
    - restart varnish
  when: varnish.control_key is defined

- name: Add extra definitions
  blockinfile:
    dest: "{{ item.dest }}"
    insertafter: "{{ item.insertafter }}"
    content: "{{ item.content }}"
  with_items: varnish_extra_definition
  when: varnish_extra_definition is defined

# Make sure all services are ON and configured to start on boot
- service: name={{ item }} state=started enabled=yes
  with_items:
    - varnish

---

#- include: "yum.yml"

- yum:
    name={{ item }}
    state=present
  with_items:
    - varnish

- template:
    src=default.vcl.j2
    dest=/etc/varnish/default.vcl
    backup=yes
  notify:
    - restart varnish

- template:
    src=varnish.params.j2
    dest=/etc/varnish/varnish.params
    backup=yes
  notify:
    - restart varnish

- template:
    src=varnish.secret.j2
    dest=/etc/varnish/secret
    backup=yes
  notify:
    - restart varnish
  when: varnish.control_key is defined

- name: Add extra definitions
  blockinfile:
    dest: "{{ item.dest }}"
    insertafter: "{{ item.insertafter }}"
    content: "{{ item.content }}"
  with_items: "{{ varnish_extra_definition }}"
  when: varnish_extra_definition is defined

# Make sure all services are ON and configured to start on boot
- service: name={{ item }} state=started enabled=yes
  with_items:
    - varnish

Fix varnish role with_items variable escaping.
Fix varnish role with_items variable escaping.
