common/tasks/certbot.yml

37 lines
893 B
YAML
Raw Normal View History

2020-01-14 10:55:56 +00:00
---
- name: Install Certbot
2020-01-14 12:59:51 +00:00
apt:
name: certbot
2020-01-14 10:55:56 +00:00
- name: Create directory for Let's Encrypt configuration
file:
state: directory
path: '{{ common__certbot__conf_dir }}'
mode: 'u=rwx,g=rx,o=rx'
owner: root
group: root
- name: Install Let's Encrypt config
template:
src: templates/certbot/cli.ini
dest: '{{ common__certbot__conf_cli }}'
mode: 'u=rw,g=r,o=r'
owner: root
group: root
- name: Install Nginx SSL options
copy:
src: files/certbot/options-ssl-nginx.conf
dest: '{{ common__certbot__conf_nginx }}'
mode: 'u=rw,g=r,o=r'
owner: root
group: root
- name: Obtain Let's Encrypt certificate
2020-01-14 12:59:51 +00:00
command: 'certbot certonly'
2020-01-14 10:55:56 +00:00
register: common__certbot__result
2020-01-14 12:05:26 +00:00
when: common__certbot__run|bool
2020-01-14 10:55:56 +00:00
changed_when: >-
common__certbot__result.stdout is
not search('Certificate not yet due for renewal; no action taken.')