Ansible Playbook to install Varnish

If you need to install Varnish, here is a quick little Ansible playbook to get it installed. Updated your host file and user as needed. I am still reading up on Varnish, so haven’t got much past the install yet.

- hosts: varnish (update to match your hosts file)
  remote_user: virtxpert (update to match your user account
  sudo: yes

  - name: Install apt-transport & curl
    apt: name=apt-transport-https state=present
    apt: name=curl state=present

  - name: Get Varnish key
    apt_key: url= state=present

  - name: Add Varnish sources to sources.list.d
    register: aptrepo

  - name: Apt Update
    apt: update_cache=yes

  - name: Install Varnish
    apt: name=varnish state=present