moved force_ssl and self signed cert to tasks
This commit is contained in:
parent
b3aa2c6169
commit
6781423adf
3 changed files with 19 additions and 22 deletions
|
|
@ -2,12 +2,17 @@
|
|||
- set_fact:
|
||||
nginx_certs: "{{ nginx.vhosts|nginx_vhosts_to_certificates }}"
|
||||
inventory_certs: "{{ certificates.certs|d({}) }}"
|
||||
selfsigned_cert: "{ '{{ inventory_hostname }}': { 'backend': 'selfsigned' }}"
|
||||
|
||||
- include_role:
|
||||
name: certificates
|
||||
vars:
|
||||
certificates:
|
||||
certs: "{{ {}|combine(nginx_certs, inventory_certs, recursive=True) }}"
|
||||
certs: "{{ {}|combine(selfsigned_cert|from_yaml, nginx_certs, inventory_certs, recursive=True) }}"
|
||||
|
||||
- debug:
|
||||
verbosity: 1
|
||||
var: nginx
|
||||
|
||||
- name: install nginx
|
||||
apt: pkg=nginx
|
||||
|
|
@ -74,16 +79,7 @@
|
|||
src: "/etc/nginx/sites-available/{{ item.key }}"
|
||||
path: "/etc/nginx/sites-enabled/{{ item.key }}"
|
||||
state: link
|
||||
with_dict: "{{ nginx.vhosts }}"
|
||||
notify:
|
||||
- restart nginx
|
||||
|
||||
- name: enable https redirect
|
||||
file:
|
||||
src: "/etc/nginx/sites-available/https-redirect"
|
||||
path: "/etc/nginx/sites-enabled/https-redirect"
|
||||
state: link
|
||||
when: nginx.force_ssl
|
||||
with_dict: "{{ {}|combine((nginx_forcessl_vhost if nginx.force_ssl else {}), nginx.vhosts, recursive=True) }}"
|
||||
notify:
|
||||
- restart nginx
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue