2019-01-18 13:52:23 +00:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
- name: Copy certs and private key to nginx proxy
|
|
|
|
copy:
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
mode: "{{ item.mode }}"
|
2019-01-30 21:35:57 +00:00
|
|
|
loop:
|
2019-01-18 13:52:23 +00:00
|
|
|
- { src: "{{ matrix_tls_key_source }}", dest: '/etc/pki/tls/private/{{ matrix_nginx_tls_key_file }}', mode: '0600' }
|
|
|
|
- { src: "{{ matrix_tls_cert_source }}", dest: '/etc/pki/tls/certs/{{ matrix_nginx_tls_cert_file }}', mode: '0750' }
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.dest }}"
|
|
|
|
notify: __nginx_reload
|
|
|
|
delegate_to: "{{ matrix_nginx_server }}"
|
|
|
|
when: matrix_nginx_tls_enabled
|
|
|
|
become: True
|
|
|
|
become_user: root
|
|
|
|
tags: tls_renewal
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Add vhost configuration file
|
|
|
|
template:
|
|
|
|
src: nginx/vhost.j2
|
|
|
|
dest: "{{ matrix_nginx_vhost_dir }}/matrix"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0640
|
|
|
|
notify: __nginx_reload
|
|
|
|
|
|
|
|
- name: Enable matrix vhost
|
|
|
|
file:
|
|
|
|
src: "{{ matrix_nginx_vhost_dir }}/matrix"
|
|
|
|
dest: "{{ matrix_nginx_vhost_symlink }}/matrix"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
state: link
|
|
|
|
notify: __nginx_reload
|
|
|
|
when: matrix_nginx_vhost_symlink is defined
|
|
|
|
|
|
|
|
- name: Open ports in iptables
|
|
|
|
iptables_raw:
|
|
|
|
name: allow_matrix_nginx_proxy
|
|
|
|
state: present
|
2019-01-19 02:07:45 +00:00
|
|
|
rules: '-A OUTPUT -m state --state NEW -p tcp -d {{ matrix_nginx_proxy_ip }} --dport {{ matrix_nginx_proxy_port }} -j ACCEPT'
|
2019-02-03 23:57:58 +00:00
|
|
|
when: matrix_nginx_iptables_enabled and (not matrix_nginx_server == inventory_hostname or not matrix_nginx_server == "localhost")
|
2019-01-18 13:52:23 +00:00
|
|
|
delegate_to: "{{ matrix_nginx_server }}"
|
|
|
|
become: True
|
|
|
|
become_user: root
|