vhost: Rename yml -> yaml
This commit is contained in:
49
roles/vhost/tasks/main.yaml
Normal file
49
roles/vhost/tasks/main.yaml
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
|
||||
- name: Fail if vhost_redirect_target is a relative path and vhost_redirect_preserve_path is true
|
||||
ansible.builtin.fail:
|
||||
msg: vhost_redirect_target must be an absolute url or absolute path if vhost_redirect_preserve_path is true
|
||||
when:
|
||||
- vhost_redirect_preserve_path
|
||||
- vhost_redirect_target.split('://') | length < 2
|
||||
- not vhost_redirect_target.startswith('/')
|
||||
|
||||
- name: Fail if vhost_redirect_target ends with / and vhost_redirect_preserve_path is true
|
||||
ansible.builtin.fail:
|
||||
msg: vhost_redirect_target must not end with / if vhost_redirect_preserve_path is true
|
||||
when:
|
||||
- vhost_redirect_preserve_path
|
||||
- vhost_redirect_target.endswith('/')
|
||||
|
||||
- name: Reset vhost_locations_all
|
||||
ansible.builtin.set_fact:
|
||||
vhost_locations_all: []
|
||||
- name: Set vhost_locations_all reverse proxies
|
||||
ansible.builtin.set_fact:
|
||||
vhost_locations_all: >
|
||||
{{ vhost_locations_all + [{
|
||||
'path': item.path,
|
||||
'type': item.type | default(vhost_type),
|
||||
'headers': item.headers | default(vhost_headers),
|
||||
'delete_headers': item.delete_headers | default(vhost_delete_headers),
|
||||
|
||||
'basicauth': item.basicauth | default(vhost_basicauth),
|
||||
'basicauth_users': item.basicauth_users | default(vhost_basicauth_users),
|
||||
|
||||
'proxy_target_port': item.proxy_target_port | default(vhost_proxy_target_port if vhost_type == 'reverse_proxy' else ''),
|
||||
'proxy_target_host': item.proxy_target_host | default(vhost_proxy_target_host),
|
||||
'proxy_target_protocol': item.proxy_target_protocol | default(vhost_proxy_target_protocol),
|
||||
'proxy_delete_headers': item.proxy_delete_headers | default(vhost_proxy_delete_headers),
|
||||
|
||||
'redirect_target': item.redirect_target | default(vhost_redirect_target if vhost_type == 'redirect' else ''),
|
||||
'redirect_preserve_path': item.redirect_preserve_path | default(vhost_redirect_preserve_path),
|
||||
'redirect_type': item.redirect_type | default(vhost_redirect_type),
|
||||
|
||||
'respond_content': item.respond_content | default(vhost_respond_content if vhost_type == 'respond' else ''),
|
||||
'respond_content_type': item.respond_content_type | default(vhost_respond_content_type)
|
||||
}] }}
|
||||
loop: "{{ vhost_locations + [{'path': ''}] }}"
|
||||
|
||||
- name: "Setup {{ vhost_id + ' vhost on ' + vhost_web_server }}"
|
||||
ansible.builtin.include_tasks: "{{ vhost_web_server }}.yml"
|
||||
when: vhost_web_server != 'none'
|
||||
Reference in New Issue
Block a user