mirror of
https://github.com/geerlingguy/ansible-role-certbot.git
synced 2025-04-19 17:01:37 +02:00
added a role variable to set global certbot options in configuration file
This commit is contained in:
parent
3f1a802d71
commit
18b991db03
@ -14,6 +14,8 @@ Generally, installing from source (see section `Source Installation from Git`) l
|
|||||||
|
|
||||||
The variable `certbot_install_from_source` controls whether to install Certbot from Git or package management. The latter is the default, so the variable defaults to `no`.
|
The variable `certbot_install_from_source` controls whether to install Certbot from Git or package management. The latter is the default, so the variable defaults to `no`.
|
||||||
|
|
||||||
|
The variable `certbot_config_file_options` defaults to an empty dictionary but can be used to configure global options for Certbot, which will go into `/etc/letsencrypt/cli.ini`.
|
||||||
|
|
||||||
certbot_auto_renew: true
|
certbot_auto_renew: true
|
||||||
certbot_auto_renew_user: "{{ ansible_user }}"
|
certbot_auto_renew_user: "{{ ansible_user }}"
|
||||||
certbot_auto_renew_hour: 3
|
certbot_auto_renew_hour: 3
|
||||||
@ -82,12 +84,14 @@ None.
|
|||||||
## Example Playbook
|
## Example Playbook
|
||||||
|
|
||||||
- hosts: servers
|
- hosts: servers
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
|
certbot_config_file_options:
|
||||||
|
rsa-key-size: 4096
|
||||||
certbot_auto_renew_user: your_username_here
|
certbot_auto_renew_user: your_username_here
|
||||||
certbot_auto_renew_minute: 20
|
certbot_auto_renew_minute: 20
|
||||||
certbot_auto_renew_hour: 5
|
certbot_auto_renew_hour: 5
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- geerlingguy.certbot
|
- geerlingguy.certbot
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
# Global options for configuration file
|
||||||
|
certbot_config_file_options: {}
|
||||||
|
|
||||||
# Certbot auto-renew cron job configuration (for certificate renewals).
|
# Certbot auto-renew cron job configuration (for certificate renewals).
|
||||||
certbot_auto_renew: true
|
certbot_auto_renew: true
|
||||||
certbot_auto_renew_user: "{{ ansible_user }}"
|
certbot_auto_renew_user: "{{ ansible_user }}"
|
||||||
|
10
tasks/config-file.yml
Normal file
10
tasks/config-file.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure configuration directory is present.
|
||||||
|
file:
|
||||||
|
path: /etc/letsencrypt
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Install Certbot configuration file.
|
||||||
|
template:
|
||||||
|
src: cli.ini.j2
|
||||||
|
dest: /etc/letsencrypt/cli.ini
|
@ -7,6 +7,8 @@
|
|||||||
- import_tasks: install-from-source.yml
|
- import_tasks: install-from-source.yml
|
||||||
when: certbot_install_from_source
|
when: certbot_install_from_source
|
||||||
|
|
||||||
|
- import_tasks: config-file.yml
|
||||||
|
|
||||||
- include_tasks: create-cert-standalone.yml
|
- include_tasks: create-cert-standalone.yml
|
||||||
with_items: "{{ certbot_certs }}"
|
with_items: "{{ certbot_certs }}"
|
||||||
when:
|
when:
|
||||||
|
5
templates/cli.ini.j2
Normal file
5
templates/cli.ini.j2
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
{% for key, value in certbot_config_file_options.items() %}
|
||||||
|
{{ key }} = {{ value }}
|
||||||
|
{% endfor %}
|
Loading…
x
Reference in New Issue
Block a user