make it work on RH

This commit is contained in:
2026-05-31 13:13:38 +02:00
parent 7dd6b51c2c
commit 0e950c67a2
+14 -11
View File
@@ -1,4 +1,9 @@
--- ---
- name: debug
debug:
msg: "plop {{ apache_server_alias }}"
changed_when: true
- name: install certbot - name: install certbot
package: package:
name: name:
@@ -24,19 +29,17 @@
state: restarted state: restarted
when: result.changed when: result.changed
- name: "check if certificate already exists"
ansible.builtin.stat:
path: "/etc/letsencrypt/live/{{ apache_server_name }}/cert.pem"
register: cert_stat
- name: generate certificates for domaine and subdomains - name: generate certificates for domaine and subdomains
vars: vars:
subdomains: "-d {{ apache_server_alias | join( ' -d ' ) }}" domainlist: "{{ [ apache_server_name ] + apache_server_alias|default( '') }}"
command: certbot certonly --agree-tos --non-interactive -m {{ apache_ssl_root_email }} --webroot --webroot-path {{ apache_document_root }} -d {{ apache_server_name }} {{ subdomains }} subdomains: "-d {{ domainlist | join( ' -d ' ) }}"
args: command: certbot certonly --webroot --webroot-path {{ certbot_docroot }} --agree-tos --non-interactive -m {{ certbot_email }} {{ subdomains }} --expand
creates: "{{ apache_ssl_chain }}" when: not cert_stat.stat.exists
when: apache_server_alias is defined
- name: generate certificates
command: certbot certonly --agree-tos --non-interactive -m {{ apache_ssl_root_email }} --webroot --webroot-path {{ apache_document_root }} -d {{ apache_server_name }}
args:
creates: "{{ apache_ssl_chain }}"
when: apache_server_alias is not defined
- name: deploy ssl config file - name: deploy ssl config file
template: template: