Skip to content

Commit 440b152

Browse files
committed
Add dehydrated_renew_command variable.
Defaults to `"{{ dehydrated_install_root }}/dehydrated --cron"` There were subtle variations on the call to this scattered through the code, and this way one may change the command, or embed into a pipe to redirect output as needed. For example: - Don't give up on first failure: ``` dehydrated_renew_command: "{{ dehydrated_install_root }}/dehydrated --cron --keep-going" ``` - More complicated example to redirect output to `syslog`: ``` dehydrated_renew_command: "bash -c '({{ dehydrated_install_root }}/dehydrated -c -g | logger -t dehydrated -p local7.info) 2>&1 | logger -t dehydrated -p local7.error -s'" ``` ... although the latter is somewhat contrived and one would probably be better served by using a `systemd` timer rather than a cron job, which would then do effectively the same thing.
1 parent ef52bf5 commit 440b152

File tree

6 files changed

+8
-5
lines changed

6 files changed

+8
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.code-workspace
33
.vagrant/
44
*.log
5+
.cache

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ dehydrated_challengetype | Challenge to use (http-01, dns-01) | http-01
4343
dehydrated_use_lexicon | Enable the use of lexicon | yes if dehydrated_challengetype == dns-01 else no
4444
dehydrated_lexicon_dns | Options for running lexicon | {}
4545
dehydrated_lexicon_dns_version | specific version of `dns-lexicon` to install | {} (== latest)
46+
dehydrated_renew_command | command to run to renew certificates | `{{ dehydrated_install_root }}/dehydrated --cron`
4647
dehydrated_hooks | Dict with hook-names for which to add scripts |
4748
dehydrated_hook_scripts | Add additional scripts to hooks-Directory | []
4849
dehydrated_key_algo | Keytype to generate (rsa, prime256v1, secp384r1) | rsa
@@ -200,7 +201,7 @@ TIMESTAMP | Timestamp when the certificate was created.
200201
- clutterbox.dehydrated
201202
```
202203

203-
## Additinal hook scripts
204+
## Additional hook scripts
204205

205206
This role offers two different ways to deploy additional hooks:
206207
* Using shell fragments

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ dehydrated_dependencies:
55
- curl
66
dehydrated_repo_url: https://github.com/dehydrated-io/dehydrated.git
77
dehydrated_install_root: /opt/dehydrated
8+
dehydrated_renew_command: "{{ dehydrated_install_root }}/dehydrated --cron"
89
dehydrated_update: yes
910
dehydrated_version: HEAD
1011
dehydrated_challengetype: http-01

handlers/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
command: "{{ dehydrated_install_root }}/dehydrated --account"
77

88
- name: run dehydrated
9-
command: "{{ dehydrated_install_root }}/dehydrated -c"
9+
command: "{{ dehydrated_renew_command }}"
1010
when: dehydrated_run_on_changes
1111

1212
- name: Reload systemd

tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@
4747
when:
4848
- dehydrated_use_lexicon
4949

50-
- name: Install cronjob
50+
- name: Configure crontab
5151
cron:
5252
name: dehydrated-renew
5353
minute: "{{ 59|random(seed=inventory_hostname) }}"
5454
hour: "{{ 4|random(seed=inventory_hostname) }}"
5555
user: root
56-
job: "{{ dehydrated_install_root }}/dehydrated -c"
56+
job: "{{ dehydrated_renew_command }}"
5757
cron_file: dehydrated
5858
state: "{{ 'present' if dehydrated_cronjob else 'absent' }}"
5959

templates/dehydrated.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ OnFailure={{ dehydrated_systemd_timer_onfailure }}
77

88
[Service]
99
User=root
10-
ExecStart={{ dehydrated_install_root }}/dehydrated --cron
10+
ExecStart={{ dehydrated_renew_command }}
1111
Type=oneshot

0 commit comments

Comments
 (0)