Files
ansible-general/roles/reverse_proxy/tasks/main.yml
2023-09-04 02:13:17 +03:00

31 lines
1.1 KiB
YAML

---
- name: Deprecation warning
ansible.builtin.debug:
msg: "uumas.general.reverse_proxy is deprecated. You should switch to uumas.general.vhost with vhost_type: reverse_proxy"
- name: Legacy proxy_target handling
when: proxy_target is defined and proxy_target_port is not defined
block:
- name: Split legacy proxy_target to protocol and target
ansible.builtin.set_fact:
proxy_target_split_protocol: "{{ proxy_target.split('://') }}"
- name: Split target further to host and port
ansible.builtin.set_fact:
proxy_target_split_host: "{{ (proxy_target_split_protocol | last).split(':') }}"
- name: Set host and port variables
ansible.builtin.set_fact:
proxy_target_host: "{{ proxy_target_split_host[0] }}"
proxy_target_port: "{{ proxy_target_split_host[1] }}"
- name: Set proxy_target_protocol based on proxy_target
ansible.builtin.set_fact:
proxy_target_protocol: "{{ proxy_target_split_protocol[0] }}"
when: proxy_target_split_protocol | length == 2
- name: Configure vhost for reverse proxy
ansible.builtin.include_role:
name: vhost
vars:
vhost_type: reverse_proxy