Add cron job, update README

This commit is contained in:
phil 2023-04-11 21:38:48 +02:00
parent a43de905b6
commit 4b3b89d560
5 changed files with 41 additions and 4 deletions

View file

@ -1,5 +1,19 @@
Dehydrated
==========
Diese Rolle installiert [dehydrated](https://dehydrated.io/), akzeptiert die TOS und erstellt eine `domains.txt`.
Sie ist zur Verwendung in anderen playbooks gedacht.
Setup and configure [Dehydrated](https://dehydrated.io/).
**Feature**
- Install Dehydrate
- Accept TOS
- Create `domains.txt` and domain directory
- Create cron job for certificate renewal
## Variables
| Name | Default | Descrition |
|--|--|--|
| `dehydrated_cron_name` | Dehydrated certificate renewal | Name of the cron job |
| `dehydrated_cron_hour` | 01 | Hour to run the cron job |
| `dehydrated_cron_minute` | 08 | Minute to run the cron job |
| `dehydrated_cron_user` | root | User to create the cron job for |

5
defaults/main.yml Normal file
View file

@ -0,0 +1,5 @@
---
dehydrated_cron_name: Dehydrated certificate renewal
dehydrated_cron_hour: "01"
dehydrated_cron_minute: "08"
dehydrated_cron_user: root

View file

@ -2,8 +2,23 @@
- name: "Dehydrated | Accept TOS"
ansible.builtin.command: dehydrated --register --accept-terms
# https://github.com/dehydrated-io/dehydrated/blob/master/docs/domains_txt.md
- name: "Dehydrated | Create domains.txt"
ansible.builtin.file:
path: /etc/dehydrated/domains.txt
state: touch
mode: "0644"
- name: "Dehydrated | Create domains directory"
ansible.builtin.file:
path: /etc/dehydrated/domains.txt.d
state: directory
mode: "0755"
- name: Dehydrated | Create cron job
ansible.builtin.cron:
name: "{{ dehydrated_cron_name }}"
hour: "{{ dehydrated_cron_hour }}"
minute: "{{ dehydrated_cron_minute }}"
user: "{{ dehydrated_cron_user }}"
job: "chronic dehydrated --cron -g"

View file

@ -1,6 +1,8 @@
---
- import_tasks: packages.yml
- name: Install packages
ansible.builtin.import_tasks: packages.yml
tags: packages
- import_tasks: dehydrated.yml
- name: Configure Dehydrated
ansible.builtin.import_tasks: dehydrated.yml
tags: dehydrated

View file

@ -2,4 +2,5 @@
- name: Packages | Install package
ansible.builtin.apt:
pkg:
- chronic
- dehydrated