Compare commits

...

4 Commits

Author SHA1 Message Date
Niyazi Gokberk Gunduz
cd9ba090f6
Merge 9dcabdc972d4b906908015b89b57926a9cb664e1 into f8e02e1e83182dca09cec447c4da5f0081303755 2025-11-17 13:10:39 +01:00
Jeff Geerling
f8e02e1e83 Require Python 3.13 until Ansible 13 is released. 2025-11-10 14:29:32 -06:00
Niyazi Gokberk Gunduz
9dcabdc972 Define renewal hook variables in defaults/main.yml 2024-05-16 11:13:22 +02:00
Niyazi Gokberk Gunduz
b9415db0f0 Enhance certbot role to support configurable renewal hooks
- Added variables for pre, post, and deploy renewal hooks in defaults/main.yml.
- Created a new task file tasks/setup-hooks.yml to manage the hooks setup.
- Included setup-hooks.yml in tasks/main.yml to ensure hooks are created if specified.
2024-05-16 10:48:43 +02:00
5 changed files with 41 additions and 3 deletions

View File

@ -26,7 +26,7 @@ jobs:
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.13' # Can't go to 3.14+ until Ansible 13.x
- name: Install test dependencies.
run: pip3 install yamllint
@ -64,7 +64,7 @@ jobs:
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.13' # Can't go to 3.14+ until Ansible 13.x
- name: Install test dependencies.
run: pip3 install ansible molecule molecule-plugins[docker] docker

View File

@ -29,7 +29,7 @@ jobs:
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.13' # Can't go to 3.14+ until Ansible 13.x
- name: Install Ansible.
run: pip3 install ansible-core

View File

@ -9,6 +9,12 @@ certbot_auto_renew_options: "--quiet"
certbot_testmode: false
certbot_hsts: false
certbot_renewal_hook_post: ""
certbot_renewal_hook_pre: ""
certbot_renewal_hook_deploy: ""
certbot_renewal_hook_post_filename: "post.sh"
certbot_renewal_hook_pre_filename: "pre.sh"
certbot_renewal_hook_deploy_filename: "deploy.sh"
# Parameters used when creating new Certbot certs.
certbot_create_if_missing: false

View File

@ -29,5 +29,7 @@
loop_control:
loop_var: cert_item
- import_tasks: setup-hooks.yml
- import_tasks: renew-cron.yml
when: certbot_auto_renew

30
tasks/setup-hooks.yml Normal file
View File

@ -0,0 +1,30 @@
---
- name: Ensure renewal hook directories exist
file:
path: "/etc/letsencrypt/renewal-hooks/{{ item }}"
state: directory
with_items:
- post
- pre
- deploy
- name: Create post-renewal hook
copy:
content: "{{ certbot_renewal_hook_post }}"
dest: "/etc/letsencrypt/renewal-hooks/post/{{ certbot_renewal_hook_post_filename }}"
mode: "0755"
when: certbot_renewal_hook_post != ""
- name: Create pre-renewal hook
copy:
content: "{{ certbot_renewal_hook_pre }}"
dest: "/etc/letsencrypt/renewal-hooks/pre/{{ certbot_renewal_hook_pre_filename }}"
mode: "0755"
when: certbot_renewal_hook_pre != ""
- name: Create deploy-renewal hook
copy:
content: "{{ certbot_renewal_hook_deploy }}"
dest: "/etc/letsencrypt/renewal-hooks/deploy/{{ certbot_renewal_hook_deploy_filename }}"
mode: "0755"
when: certbot_renewal_hook_deploy != ""