configure certificates even if file exists
This commit is contained in:
parent
a64199b9fb
commit
4c8219b554
2 changed files with 8 additions and 7 deletions
|
@ -13,11 +13,18 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
mail_server_fqdn_ip: "{{ lookup('dig', mail_server_fqdn, '@1.1.1.1') }}"
|
mail_server_fqdn_ip: "{{ lookup('dig', mail_server_fqdn, '@1.1.1.1') }}"
|
||||||
|
|
||||||
|
- name: Get file certificate stats
|
||||||
|
stat:
|
||||||
|
path: "/etc/letsencrypt/live/{{ mail_server_fqdn }}"
|
||||||
|
register: cert_file
|
||||||
|
|
||||||
- name: Ensure server certificate exists
|
- name: Ensure server certificate exists
|
||||||
shell: "certbot certonly --agree-tos --email {{ admin_email }} -n --webroot -d {{ mail_server_fqdn }} --webroot-path /var/www/html"
|
shell: "certbot certonly --agree-tos --email {{ admin_email }} -n --webroot -d {{ mail_server_fqdn }} --webroot-path /var/www/html"
|
||||||
args:
|
args:
|
||||||
creates: "/etc/letsencrypt/live/{{ mail_server_fqdn }}"
|
creates: "/etc/letsencrypt/live/{{ mail_server_fqdn }}"
|
||||||
when: mail_server_fqdn_ip == node_external_ip
|
when:
|
||||||
|
- mail_server_fqdn_ip == node_external_ip
|
||||||
|
- not cert_file.stat.exists
|
||||||
|
|
||||||
- name: Show check for main mail server
|
- name: Show check for main mail server
|
||||||
debug:
|
debug:
|
||||||
|
|
|
@ -15,16 +15,10 @@
|
||||||
- name: Ensure configuration of dbmail
|
- name: Ensure configuration of dbmail
|
||||||
include_tasks: configure_dbmail.yml
|
include_tasks: configure_dbmail.yml
|
||||||
|
|
||||||
- name: Get file certificate stats
|
|
||||||
stat:
|
|
||||||
path: "/etc/letsencrypt/live/{{ mail_server_fqdn }}"
|
|
||||||
register: cert_file
|
|
||||||
|
|
||||||
- name: Ensure certificates are configured
|
- name: Ensure certificates are configured
|
||||||
include_tasks: configure_certificates.yml
|
include_tasks: configure_certificates.yml
|
||||||
when:
|
when:
|
||||||
- dbmail_configuration['POP']['tls_port'] > 0 or dbmail_configuration['IMAP']['tls_port'] > 0 or dbmail_configuration['SIEVE']['tls_port'] > 0
|
- dbmail_configuration['POP']['tls_port'] > 0 or dbmail_configuration['IMAP']['tls_port'] > 0 or dbmail_configuration['SIEVE']['tls_port'] > 0
|
||||||
- not cert_file.stat.exists
|
|
||||||
|
|
||||||
- name: Ensure user's are configured in dbmail
|
- name: Ensure user's are configured in dbmail
|
||||||
include_tasks: configure_dbmail_users.yml
|
include_tasks: configure_dbmail_users.yml
|
||||||
|
|
Loading…
Reference in a new issue