2020-01-14 05:55:56 -05:00
|
|
|
---
|
|
|
|
- name: Install Certbot
|
2020-01-14 07:59:51 -05:00
|
|
|
apt:
|
|
|
|
name: certbot
|
2020-01-14 05:55:56 -05: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
|
2020-02-06 07:25:21 -05:00
|
|
|
template:
|
|
|
|
src: templates/certbot/options-ssl-nginx.conf
|
2020-01-14 05:55:56 -05:00
|
|
|
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 07:59:51 -05:00
|
|
|
command: 'certbot certonly'
|
2020-01-14 05:55:56 -05:00
|
|
|
register: common__certbot__result
|
2020-01-14 07:05:26 -05:00
|
|
|
when: common__certbot__run|bool
|
2020-01-14 05:55:56 -05:00
|
|
|
changed_when: >-
|
|
|
|
common__certbot__result.stdout is
|
|
|
|
not search('Certificate not yet due for renewal; no action taken.')
|