ansible/roles/reverse_proxy_stream/tasks/main.yml

34 lines
953 B
YAML

---
- name: Ensure the stream proxy conf available directory exists
file:
path: /etc/nginx/stream-available
state: directory
- name: Ensure the stream proxy conf enabled directory exists
file:
path: /etc/nginx/stream-enabled
state: directory
- name: Include the stream proxy configuration files
blockinfile:
path: /etc/nginx/nginx.conf
block: |
stream {
include /etc/nginx/stream-enabled/*;
}
- name: Copy reverse proxy stream
template:
src: "nginx/stream-available/reverse_proxy"
dest: "/etc/nginx/stream-available/stream_{{ item.type }}_{{ item.from_port }}"
loop: "{{ reverse_proxy_stream }}"
- name: Activate stream
file:
src: "/etc/nginx/stream-available/stream_{{ item.type }}_{{ item.from_port }}"
dest: "/etc/nginx/stream-enabled/stream_{{ item.type }}_{{ item.from_port }}"
state: link
force: yes
loop: "{{ reverse_proxy_stream }}"
notify: Reload nginx