Skip to content

Commit 8b499dc

Browse files
committed
Document certificate service notification and fix param doc
1 parent 8dab341 commit 8b499dc

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,28 @@ With the yaml snippet above you'd request the following certificates:
138138
- SAN certificate __san.example.com__ with **second_domain.san.example.com**
139139
and **third_domain.san.example.com** as subject alternative names.
140140
141+
### Service Notification (Restart/Reload)
142+
When a certificate is initially created or renewed, you usually want to restart or reload the service using it (like Nginx, Apache, etc.).
143+
To do this, you can safely `subscribe` to the `Dehydrated::Certificate[$dn]` resource or have the certificate resource `notify` your service.
144+
145+
**Example using `subscribe` in a Service:**
146+
```puppet
147+
service { 'nginx':
148+
ensure => running,
149+
enable => true,
150+
subscribe => Dehydrated::Certificate['my-https-host.example.com'],
151+
}
152+
```
153+
154+
**Example using `notify` from the Certificate:**
155+
```puppet
156+
::dehydrated::certificate { 'my-https-host.example.com':
157+
notify => Service['apache2'],
158+
}
159+
```
160+
161+
Since the actual certificate files are contained within the `dehydrated::certificate` defined type, any changes to the underlying files (such as a renewal) will automatically bubble up and trigger the refresh event for your service.
162+
141163
### Monitoring & debugging
142164
- usual Puppet debugging rules apply >:-)
143165
- you'll find the output and errors from the last systemd timer run in **/opt/dehydrated/status.json**.

manifests/certificate/deploy.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
# @param key_password
1313
# Password of the key if needed to access it.
1414
#
15+
# @param custom_base_filename
16+
# Custom base filename to use for the certificate files.
17+
#
1518
# @example
1619
# dehydrated::certificate::deploy { 'namevar': }
1720
#

0 commit comments

Comments
 (0)