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
|
|
|
|
|
|
|
|
# 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-27 19:16:43 +01:00
|
|
|
copy: { dest: "{{ tls_key_dir }}/{{ item.nginx_domain_name }}.crt.pem", content: "{{ item.tls_cert }}", mode: 0700, owner: 'root', group: 'root' }
|
2014-09-13 22:16:54 +02:00
|
|
|
with_items: nginx_tls_vhosts
|
2015-06-01 13:46:06 +02:00
|
|
|
when: item.tls_cert is defined
|
2014-09-13 22:16:54 +02:00
|
|
|
notify:
|
|
|
|
- reload nginx
|
|
|
|
|
2015-02-26 15:39:17 +01:00
|
|
|
#- name: Generate self-signed TLS cert
|
|
|
|
# command: openssl req -x509 -nodes -sha256 -days 365 -subj "/C=KE/ST=Nairobi/L=Nairobi/O=/CN={{ item.nginx_domain_name }}" -newkey rsa:2048 -keyout {{ item.nginx_domain_name }}.key -out {{ item.nginx_domain_name }}.crt -extensions v3_ca creates={{ tls_key_dir }}/{{ item.nginx_domain_name }}.crt.pem
|
|
|
|
#
|
2014-09-13 22:16:54 +02:00
|
|
|
- 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
|
|
|
|
|
2015-02-26 15:39:17 +01:00
|
|
|
- name: Install WordPress
|
2015-06-01 13:32:05 +02:00
|
|
|
git: repo=https://github.com/WordPress/WordPress.git dest={{ nginx_root_prefix }}/{{ item.nginx_domain_name }}/wordpress version={{ item.wordpress_version }} depth=1
|
2015-02-26 15:39:17 +01:00
|
|
|
when: item.has_wordpress == 'yes'
|
|
|
|
with_items: nginx_tls_vhosts
|
|
|
|
tags: wordpress
|
|
|
|
|
2014-09-13 22:16:54 +02:00
|
|
|
# vim: set ts=2 sw=2:
|