summaryrefslogtreecommitdiff
path: root/roles/letsencrypt/tasks/main.yml
blob: 15ad04d6c37615cd6fba333eb96a92792fdaf319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---

- name: Install letsencrypt client for Xenial
  apt: pkg={{item}} state=installed
  with_items:
      - letsencrypt
      - python-letsencrypt-apache
  when: ansible_distribution_release == "xenial"

- name: Install letsencrypt client for Stretch
  apt: pkg={{item}} state=installed
  with_items:
      - certbot
      - python-certbot-apache
  when: ansible_distribution_release == "stretch"

- name: Install cert for {{hostname}}
  command: letsencrypt -n --apache --agree-tos --email "{{email}}" -d "{{hostname}}"
  args:
      creates: /etc/letsencrypt/live/{{hostname}}/fullchain.pem
  when: ( ansible_distribution_release == "xenial" ) or
        ( ansible_distribution_release == "stretch" )

- name: Ensure letsencrypt renewal cron is installed
  template: src=letsencrypt-crontab.cron dest=/etc/cron.d/letsencrypt-crontab
  when: ansible_distribution_release == "xenial"