---

- name: Request nsupdate key for certificate
  include_role: name=acme-dnskey-generate

- name: Configure certificate manager
  template: src=certs.j2 dest=/etc/acertmgr/{{ ansible_fqdn }}.conf
  notify: Run acertmgr

- name: Configure vhosts
  template: src=vhost.j2 dest=/etc/nginx/sites-available/pve
  notify: Restart nginx

- name: Disable default vhost
  file: path=/etc/nginx/sites-enabled/default state=absent

- name: Enable vhosts
  file: src=/etc/nginx/sites-available/pve dest=/etc/nginx/sites-enabled/pve state=link
  notify: Restart nginx