xoxys.unifi/tasks/nginx.yml
2018-08-13 23:18:10 +02:00

31 lines
832 B
YAML

---
- block:
- name: Add vhost configuration file
template:
src: nginx/vhost.j2
dest: "{{ unifi_nginx_vhost_dir }}/unifi"
owner: root
group: root
mode: 0640
notify: __nginx_reload
- name: Enable unifi vhost
file:
src: "{{ unifi_nginx_vhost_dir }}/unifi"
dest: "{{ unifi_nginx_vhost_symlink }}/unifi"
owner: root
group: root
state: link
notify: __nginx_reload
when: unifi_nginx_vhost_symlink is defined
- name: Open ports in iptables
iptables_raw:
name: allow_unifi_nginx_proxy
state: present
rules: '-A OUTPUT -m state --state NEW -p tcp -d {{ unifi_server_ip }} --dport {{ unifi_server_port }} -j ACCEPT'
when: unifi_nginx_iptables_enabled
delegate_to: "{{ unifi_nginx_server }}"
become: True
become_user: root