From 2a6547dfb7806b93193ae98a3f363a40ef151148 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Mon, 1 Jun 2020 11:54:28 +0200 Subject: [PATCH] bundles/cron: add --- bundles/cron/items.py | 6 ++++++ bundles/letsencrypt/metadata.py | 8 ++++++++ groups/all.py | 1 + 3 files changed, 15 insertions(+) create mode 100644 bundles/cron/items.py create mode 100644 bundles/letsencrypt/metadata.py diff --git a/bundles/cron/items.py b/bundles/cron/items.py new file mode 100644 index 0000000..3c1f9e0 --- /dev/null +++ b/bundles/cron/items.py @@ -0,0 +1,6 @@ +files = {} + +for crontab, content in node.metadata.get('cron', {}).items(): + files['/etc/cron.d/{}'.format(crontab)] = { + 'content': content + "\n", + } diff --git a/bundles/letsencrypt/metadata.py b/bundles/letsencrypt/metadata.py new file mode 100644 index 0000000..0c42592 --- /dev/null +++ b/bundles/letsencrypt/metadata.py @@ -0,0 +1,8 @@ +@metadata_processor +def crontab(metadata): + return { + 'cron': { + 'letsencrypt_renew': '20 4 * * * root /usr/bin/dehydrated --cron --accept-terms --ocsp --challenge http-01 > /dev/null', + 'letsencrypt_cleanup': '42 23 * * 0 root /usr/bin/dehydrated --cleanup > /dev/null', + }, + }, DEFAULTS, DONE diff --git a/groups/all.py b/groups/all.py index 8242284..30c5f06 100644 --- a/groups/all.py +++ b/groups/all.py @@ -4,6 +4,7 @@ groups['all'] = { ), 'bundles': { 'apt', + 'cron', 'hostname', 'sudo', 'systemd',