2018-11-01 22:35:53 +00:00
|
|
|
---
|
|
|
|
- block:
|
2019-02-04 19:43:52 +00:00
|
|
|
- name: Copy certs and private key to nginx proxy
|
2019-01-09 21:54:28 +00:00
|
|
|
copy:
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
mode: "{{ item.mode }}"
|
|
|
|
with_items:
|
|
|
|
- { src: "{{ pve_tls_key_source }}", dest: '/etc/pki/tls/private/{{ pve_nginx_tls_key_file }}', mode: '0600' }
|
|
|
|
- { src: "{{ pve_tls_cert_source }}", dest: '/etc/pki/tls/certs/{{ pve_nginx_tls_cert_file }}', mode: '0750' }
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.dest }}"
|
|
|
|
notify: __nginx_reload
|
2018-11-01 22:35:53 +00:00
|
|
|
delegate_to: "{{ pve_nginx_server }}"
|
|
|
|
when: pve_nginx_tls_enabled
|
|
|
|
become: True
|
|
|
|
become_user: root
|
|
|
|
tags: tls_renewal
|
|
|
|
|
|
|
|
- block:
|
2019-01-09 21:54:28 +00:00
|
|
|
- name: Add vhost configuration file
|
|
|
|
template:
|
|
|
|
src: nginx/vhost.j2
|
|
|
|
dest: "{{ pve_nginx_vhost_dir }}/pve"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0640
|
|
|
|
notify: __nginx_reload
|
2018-11-01 22:35:53 +00:00
|
|
|
|
2019-01-09 21:54:28 +00:00
|
|
|
- name: Enable pve vhost
|
|
|
|
file:
|
|
|
|
src: "{{ pve_nginx_vhost_dir }}/pve"
|
|
|
|
dest: "{{ pve_nginx_vhost_symlink }}/pve"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
state: link
|
|
|
|
notify: __nginx_reload
|
|
|
|
when: pve_nginx_vhost_symlink is defined
|
2018-11-01 22:35:53 +00:00
|
|
|
|
2019-01-09 21:54:28 +00:00
|
|
|
- name: Open ports in iptables
|
|
|
|
iptables_raw:
|
|
|
|
name: allow_pve_nginx_proxy
|
|
|
|
state: present
|
|
|
|
rules: '-A OUTPUT -m state --state NEW -p tcp -d {{ pve_server_ip }} --dport {{ pve_server_port }} -j ACCEPT'
|
|
|
|
when: pve_nginx_iptables_enabled
|
2018-11-01 22:35:53 +00:00
|
|
|
delegate_to: "{{ pve_nginx_server }}"
|
|
|
|
become: True
|
|
|
|
become_user: root
|