mirror of
https://github.com/geerlingguy/ansible-role-certbot.git
synced 2026-09-12 00:31:16 +02:00
Implement support for DNS install method
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
---
|
||||
- name: Check if certificate already exists.
|
||||
stat:
|
||||
path: /etc/letsencrypt/live/{{ cert_item.domains | first | replace('*.', '') }}/cert.pem
|
||||
register: letsencrypt_cert
|
||||
|
||||
- name: Generate new certificate if one doesn't exist.
|
||||
command: "{{ certbot_create_command }}"
|
||||
when: not letsencrypt_cert.stat.exists
|
||||
@@ -1,7 +1,13 @@
|
||||
---
|
||||
- name: Install Certbot.
|
||||
- name: Install Certbot via package.
|
||||
package: "name={{ certbot_package }} state=present"
|
||||
|
||||
- name: Install Certbot DNS plugin via package.
|
||||
package: "name=python3-certbot-dns-{{ certbot_dns_plugin }} state=present"
|
||||
when:
|
||||
- certbot_create_method == 'dns'
|
||||
- certbot_dns_plugin is defined
|
||||
|
||||
- name: Set Certbot script variable.
|
||||
set_fact:
|
||||
certbot_script: "{{ certbot_package }}"
|
||||
|
||||
@@ -29,6 +29,14 @@
|
||||
name: certbot
|
||||
classic: true
|
||||
|
||||
- name: Install certbot DNS plugin via snap.
|
||||
snap:
|
||||
name: "certbot-dns-{{ certbot_dns_plugin }}"
|
||||
classic: true
|
||||
when:
|
||||
- certbot_create_method == 'dns'
|
||||
- certbot_dns_plugin is defined
|
||||
|
||||
- name: Symlink certbot into place.
|
||||
file:
|
||||
src: /snap/bin/certbot
|
||||
|
||||
@@ -29,5 +29,13 @@
|
||||
loop_control:
|
||||
loop_var: cert_item
|
||||
|
||||
- include_tasks: create-cert-dns.yml
|
||||
with_items: "{{ certbot_certs }}"
|
||||
when:
|
||||
- certbot_create_if_missing
|
||||
- certbot_create_method == 'dns'
|
||||
loop_control:
|
||||
loop_var: cert_item
|
||||
|
||||
- import_tasks: renew-cron.yml
|
||||
when: certbot_auto_renew
|
||||
|
||||
Reference in New Issue
Block a user