Files
ansible-general/roles/vhost/vars/main.yaml

72 lines
2.3 KiB
YAML

---
_vhost_matcher_defaults:
match_headers: {}
match_method: []
_vhost_matchers: >-
{{
vhost_matchers
| map('combine', _vhost_matcher_defaults)
| zip(vhost_matchers)
| map('combine')
}}
_vhost_location_defaults:
type: "{{ vhost_type }}"
headers: "{{ vhost_headers }}"
delete_headers: "{{ vhost_delete_headers }}"
basicauth: "{{ vhost_basicauth }}"
basicauth_users: "{{ vhost_basicauth_users }}"
proxy_target_netproto: "{{ vhost_proxy_target_netproto }}"
proxy_target_protocol: "{{ vhost_proxy_target_protocol }}"
proxy_target_host: "{{ vhost_proxy_target_host }}"
proxy_target_port: "{{ vhost_proxy_target_port if
vhost_type == 'reverse_proxy' and vhost_proxy_target_netproto == 'tcp' else '' }}"
proxy_target_socket: "{{ vhost_proxy_target_socket if
vhost_type == 'reverse_proxy' and vhost_proxy_target_netproto == 'unix' else '' }}"
proxy_headers: "{{ vhost_proxy_headers }}"
proxy_delete_headers: "{{ vhost_proxy_delete_headers }}"
proxy_pass_host_header: "{{ vhost_proxy_pass_host_header }}"
redirect_target: "{{ vhost_redirect_target if vhost_type == 'redirect' else '' }}"
redirect_preserve_path: "{{ vhost_redirect_preserve_path }}"
redirect_preserve_query: "{{ vhost_redirect_preserve_query }}"
redirect_type: "{{ vhost_redirect_type }}"
respond_content: "{{ vhost_respond_content if vhost_type == 'respond' else '' }}"
respond_content_type: "{{ vhost_respond_content_type }}"
respond_status: "{{ vhost_respond_status }}"
matchers: "{{ _vhost_matchers }}"
_vhost_locations: "{{ vhost_locations + [{'path': ''}] }}"
_vhost_locations_withdefaults: >-
{{
_vhost_locations
| map('combine', _vhost_location_defaults)
| zip(
_vhost_locations
)
| map('combine')
| map('combine', {'matchers': [{'name': ''}]}, list_merge='append')
}}
_vhost_locations_complete: >-
{{
_vhost_locations_withdefaults |
sort(attribute='path') |
zip(
_vhost_locations_withdefaults |
subelements('matchers') |
map('combine') |
groupby('path') |
map('last') |
map('community.general.remove_keys', ['matchers', 'path']) |
map('community.general.dict_kv', 'matchers')
) |
map('combine') |
reverse
}}