From f004591e98892da2ad6cd61a79058c908c0cdd9a Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 11 Sep 2022 11:26:24 +0200 Subject: [PATCH] bundles/letsencrypt: use systemd-timers --- bundles/letsencrypt/metadata.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bundles/letsencrypt/metadata.py b/bundles/letsencrypt/metadata.py index 789c544..310dadd 100644 --- a/bundles/letsencrypt/metadata.py +++ b/bundles/letsencrypt/metadata.py @@ -26,17 +26,20 @@ defaults = { @metadata_reactor.provides( - 'cron/jobs/letsencrypt', + 'systemd-timers/timers/letsencrypt', ) def cron(metadata): if node.metadata.get('letsencrypt/domains'): return { - 'cron': { - 'jobs': { - 'letsencrypt': '\n'.join([ - '{} 4 * * * root /usr/bin/dehydrated --cron --accept-terms --challenge http-01 > /dev/null'.format((node.magic_number % 60)), - '{} 4 * * 0 root /usr/bin/dehydrated --cleanup > /dev/null'.format((node.magic_number % 60)), - ]), + 'systemd-timers': { + 'timers': { + 'letsencrypt': { + 'command': [ + '/usr/bin/dehydrated --cron --accept-terms --challenge http-01', + '/usr/bin/dehydrated --cleanup', + ], + 'when': '04:{}:00'.format(node.magic_number % 60), + }, }, }, }