---
- name: ensure acmetool repository key is installed
  apt_key:
    id: EDB58DFA
    data: "{{ lookup('file', 'acmetool.gpg') }}"

- name: ensure acmetool apt repository is installed
  apt_repository: repo='deb http://ppa.launchpad.net/hlandau/rhea/ubuntu xenial main'

- name: ensure acmetool is installed
  apt: name=acmetool install_recommends=no

- name: Ensure acmetool response file is up to date
  register: responsefile
  template: 
    src: acme_config.j2
    dest: /var/lib/acme/responses.yml

- name: Setup acmetool
  when: responsefile|changed
  shell: /usr/bin/acmetool quickstart --batch --response-file=/var/lib/acme/responses.yml
