2018-11-29 17:55:28 +00:00
|
|
|
---
|
2018-06-10 17:34:06 +00:00
|
|
|
- name: install certbot package
|
2021-08-24 16:18:42 +00:00
|
|
|
ansible.builtin.apt:
|
|
|
|
name:
|
2018-11-25 19:24:19 +00:00
|
|
|
- certbot
|
|
|
|
- cron
|
2021-08-24 16:18:42 +00:00
|
|
|
default_release: '{{ certbot_distribution|default(ansible_distribution_release) }}'
|
|
|
|
state: present
|
2018-06-10 17:34:06 +00:00
|
|
|
tags: certbot
|
|
|
|
|
|
|
|
- name: create webroot path directory
|
2021-08-24 16:18:42 +00:00
|
|
|
ansible.builtin.file:
|
2018-06-10 17:34:06 +00:00
|
|
|
path: '{{ certbot_path }}'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
|
|
|
state: directory
|
|
|
|
tags: certbot
|
2018-07-07 17:24:56 +00:00
|
|
|
|
2022-01-03 14:27:56 +00:00
|
|
|
- name: install hooks script
|
2021-08-24 16:18:42 +00:00
|
|
|
ansible.builtin.copy:
|
2022-01-03 14:27:56 +00:00
|
|
|
content: '{{ item.value|default("#!/bin/bash") }}'
|
|
|
|
dest: '/etc/letsencrypt/hook-{{ item.key }}'
|
2018-07-07 17:24:56 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
2022-01-03 14:27:56 +00:00
|
|
|
mode: 0700
|
|
|
|
loop: '{{ certbot_domains|dict2items }}'
|
|
|
|
loop_control:
|
|
|
|
label: '{{ item.key }}'
|
2018-07-07 17:24:56 +00:00
|
|
|
tags: certbot
|
|
|
|
|
2018-11-25 09:16:09 +00:00
|
|
|
- name: remove old cerbot renew cron
|
2021-08-24 16:18:42 +00:00
|
|
|
ansible.builtin.file:
|
2018-07-07 17:24:56 +00:00
|
|
|
path: /etc/cron.d/certbot
|
2018-11-25 09:16:09 +00:00
|
|
|
state: absent
|
|
|
|
tags: certbot
|
|
|
|
|
|
|
|
- name: add certbot renew cron
|
2021-08-24 16:18:42 +00:00
|
|
|
ansible.builtin.cron:
|
2018-11-25 09:16:09 +00:00
|
|
|
name: certbot-renew
|
|
|
|
user: root
|
|
|
|
hour: '*/12'
|
2021-08-24 16:18:42 +00:00
|
|
|
minute: '0'
|
2022-01-03 14:27:56 +00:00
|
|
|
job: perl -e 'sleep int(rand(3600))' && certbot -q renew
|
2018-07-07 17:24:56 +00:00
|
|
|
tags: certbot
|