added cert generation

This commit is contained in:
Beth Parker 2024-10-06 00:13:20 -05:00
parent 38fa0cc624
commit 5c123d7301
3 changed files with 21 additions and 1 deletions

10
tasks/generate_cert.yml Normal file
View file

@ -0,0 +1,10 @@
# generate_cert.yml
---
- name: check if privkey exists
ansible.builtin.command: '[ -f "/etc/letsencrypt/live/{{ item.domain }}/README" ]'
register: result
ignore_errors: true
- name: generate certificate
ansible.builtin.command: 'certbot certonly --standalone --preferred-challenge http-01 -d {{ item.domain }}'
when: result is failure

View file

@ -4,3 +4,8 @@
ansible.builtin.package: ansible.builtin.package:
name: certbot name: certbot
state: present state: present
# generate certs for new domains
- include_tasks: generate_cert.yml
loop: "{{ domains }}"

View file

@ -1,2 +1,7 @@
--- ---
# vars file for certbot # vars file for nginx-ssl on privtorrents.actcur.com
domains:
- domain: privtorrents.actcur.com
# end of file