ansible-role-certbot/tasks/base.yml

46 lines
1 KiB
YAML
Raw Normal View History

2018-11-29 17:55:28 +00:00
---
2023-07-26 14:19:27 +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
2023-07-26 14:19:27 +00:00
default_release: "{{ certbot_distribution | default(ansible_distribution_release) }}"
2021-08-24 16:18:42 +00:00
state: present
2018-06-10 17:34:06 +00:00
tags: certbot
2023-07-26 14:19:27 +00:00
- name: Create webroot path directory
2021-08-24 16:18:42 +00:00
ansible.builtin.file:
2023-07-26 14:19:27 +00:00
path: "{{ certbot_path }}"
2018-06-10 17:34:06 +00:00
owner: root
group: root
mode: 0755
state: directory
tags: certbot
2018-07-07 17:24:56 +00:00
2023-07-26 14:19:27 +00:00
- name: Install hooks script
2021-08-24 16:18:42 +00:00
ansible.builtin.copy:
2023-07-26 14:19:27 +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
2023-07-26 14:19:27 +00:00
loop: "{{ certbot_domains | dict2items }}"
2022-01-03 14:27:56 +00:00
loop_control:
2023-07-26 14:19:27 +00:00
label: "{{ item.key }}"
2018-07-07 17:24:56 +00:00
tags: certbot
2023-07-26 14:19:27 +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
state: absent
tags: certbot
2023-07-26 14:19:27 +00:00
- name: Add certbot renew cron
2021-08-24 16:18:42 +00:00
ansible.builtin.cron:
name: certbot-renew
user: root
2023-07-26 14:19:27 +00:00
hour: "*/12"
minute: "0"
job: "perl -e 'sleep int(rand(3600))' && certbot -q renew"
2018-07-07 17:24:56 +00:00
tags: certbot