This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/master by this push:
new e82a087fee Ansible: django: generate letsencrypt cert if it doesn't
exist
e82a087fee is described below
commit e82a087fee6ef77307c8d55915ccf763d7d38285
Author: Marcus Christie <[email protected]>
AuthorDate: Tue Nov 15 17:56:33 2022 -0500
Ansible: django: generate letsencrypt cert if it doesn't exist
---
dev-tools/ansible/roles/django/tasks/main.yml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/dev-tools/ansible/roles/django/tasks/main.yml
b/dev-tools/ansible/roles/django/tasks/main.yml
index 892a3947c7..6e0e438028 100644
--- a/dev-tools/ansible/roles/django/tasks/main.yml
+++ b/dev-tools/ansible/roles/django/tasks/main.yml
@@ -298,6 +298,18 @@
- restart httpd
when: not vhost_ssl
+- name: check if SSL certificate exists
+ stat:
+ path: "{{ ssl_certificate_file }}"
+ register: stat_ssl_cert_result
+ become: yes
+ when: vhost_ssl
+
+- name: generate certificate if it doesn't exist
+ command: certbot --apache --non-interactive --agree-tos --email "{{
letsencrypt_email }}" -d {{ vhost_servername }} certonly
+ become: yes
+ when: vhost_ssl and not stat_ssl_cert_result.stat.exists
+
- name: copy SSL enabled virtual host config file
template: src={{ django_ssl_vhost_template }} dest={{
httpd_confd_file_location[ansible_os_family] }} backup=yes
become: yes