2014-09-13 22:16:54 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Configure https vhosts
|
|
|
|
template: src=vhost.conf.j2 dest={{ nginx_confd_path }}/{{ item.nginx_domain_name }}.conf mode=0644 owner=root group=root
|
|
|
|
with_items: nginx_tls_vhosts
|
|
|
|
notify:
|
|
|
|
- reload nginx
|
|
|
|
|
2014-10-11 14:42:03 +02:00
|
|
|
# Chained TLS keys for all domains in one file, like:
|
|
|
|
#
|
|
|
|
# domain.com:
|
|
|
|
# tls_cert: |
|
|
|
|
# -----BEGIN PRIVATE KEY-----
|
|
|
|
# MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDeIotVB7/WY9sJ
|
|
|
|
- name: Get TLS certs
|
|
|
|
include_vars: "../../../vars/tls_keys.yml"
|
|
|
|
|
|
|
|
# Loop through tls vhosts and derive var to pull cert from (see above)
|
|
|
|
#
|
2014-09-13 22:16:54 +02:00
|
|
|
# concatenated key + cert, can live in the same file
|
|
|
|
# See: http://nginx.org/en/docs/http/configuring_https_servers.html
|
|
|
|
- name: Copy TLS certs
|
2014-10-11 14:42:03 +02:00
|
|
|
copy: { dest: "{{ tls_key_dir }}/{{ item.nginx_domain_name }}.crt.pem", content: "{{ {{ item.nginx_domain_name }}.{{ tls_cert }} }}", mode: 0700, owner: 'root', group: 'root' }
|
2014-09-13 22:16:54 +02:00
|
|
|
with_items: nginx_tls_vhosts
|
|
|
|
notify:
|
|
|
|
- reload nginx
|
|
|
|
|
|
|
|
- name: Generate 2048-bit dhparam
|
|
|
|
command: openssl dhparam -out dhparam.pem 2048 chdir=/etc/ssl/certs creates=dhparam.pem
|
|
|
|
notify:
|
|
|
|
- reload nginx
|
|
|
|
|
|
|
|
- name: Create vhost document roots
|
|
|
|
file: path={{ nginx_root_prefix }}/{{ item.nginx_domain_name }} state=directory mode=0755 owner=nginx group=nginx
|
|
|
|
with_items: nginx_tls_vhosts
|
|
|
|
|
|
|
|
# vim: set ts=2 sw=2:
|