common/tasks/certbot.yml

41 lines
1015 B
YAML
Raw Normal View History

2020-01-14 10:55:56 +00:00
---
- name: Install Certbot
copy:
2020-01-14 12:29:03 +00:00
src: files/certbot/certbot-auto
dest: /usr/local/bin/certbot-auto
2020-01-14 10:55:56 +00:00
mode: 'u=rwx,g=rx,o=rx'
owner: root
group: root
- 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:29:03 +00:00
command: 'certbot-auto 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.')