-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add certificate download for temporary environments
community.crypto.acme_certificate does use the existing certificate file to check for the validity in order to decide whether a certificate needs renewal. As this file isn't kept if running the playbook on a non persistent environment such as a containerized ci runner this leads to a certificate renewal on each playbook execution which might hit the limit of 5 certs per seven days as configured on letsencrypt depending on the configured schedule. By downloading the certificate from the webserver beforehand to the certificate file this check should work as expected again
- Loading branch information
Christoph Sieber
authored and
Christoph Sieber
committed
Dec 21, 2023
1 parent
722df0f
commit 5e7acaa
Showing
3 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
- name: Fetch current certificate from https server | ||
ansible.community.crypto.get_certificate: | ||
host: "{{ acme_cert_download_host | default(acme_domain.subject_alt_name[0]) }}" | ||
port: "{{ acme_cert_download_port | default('443') }}" | ||
server_name: "{{ acme_cert_san_name | default(acme_domain.subject_alt_name[0]) }}" | ||
register: certificate | ||
|
||
- name: Write fetched certificate to file | ||
ansible.builtin.copy: | ||
content: "{{ certificate.cert }}" | ||
dest: "{{ acme_cert_path }}" | ||
mode: "0644" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters