summaryrefslogtreecommitdiff
path: root/roles/nginx/vhost/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/nginx/vhost/tasks/main.yml')
-rw-r--r--roles/nginx/vhost/tasks/main.yml19
1 files changed, 18 insertions, 1 deletions
diff --git a/roles/nginx/vhost/tasks/main.yml b/roles/nginx/vhost/tasks/main.yml
index 1b5e3392..424c86a0 100644
--- a/roles/nginx/vhost/tasks/main.yml
+++ b/roles/nginx/vhost/tasks/main.yml
@@ -1,4 +1,12 @@
---
+- name: ensure certificate exists (fake it, until you make it)
+ when: "'acme' in nginx_vhost and nginx_vhost.acme"
+ import_role:
+ name: x509/acmetool/cert/prepare
+ vars:
+ acmetool_cert_name: "{{ nginx_vhost.name }}"
+ acmetool_cert_hostnames: "{{ nginx_vhost.hostnames }}"
+
- name: install nginx configs from template
when: "'template' in nginx_vhost"
template:
@@ -24,4 +32,13 @@
- name: generate acme certificate
when: "'acme' in nginx_vhost and nginx_vhost.acme"
- include_tasks: acme.yml
+ block:
+ - name: make sure nginx config has been (re)loaded
+ meta: flush_handlers
+
+ - name: actually request the certificate
+ import_role:
+ name: x509/acmetool/cert/finalize
+ vars:
+ acmetool_cert_name: "{{ nginx_vhost.name }}"
+ acmetool_cert_hostnames: "{{ nginx_vhost.hostnames }}"