vhost: Prefix variables with role name

This commit is contained in:
uumas
2024-07-28 01:05:19 +03:00
parent 3331a96cbc
commit d731d3c70e
7 changed files with 54 additions and 86 deletions

View File

@@ -1,19 +1,19 @@
---
- name: Fail if redirect_target is a relative path and redirect_preserve_path is true
- name: Fail if vhost_redirect_target is a relative path and vhost_redirect_preserve_path is true
ansible.builtin.fail:
msg: redirect_target must be an absolute url or absolute path if redirect_preserve_path is true
msg: vhost_redirect_target must be an absolute url or absolute path if vhost_redirect_preserve_path is true
when:
- redirect_preserve_path
- redirect_target.split('://') | length < 2
- not redirect_target.startswith('/')
- vhost_redirect_preserve_path
- vhost_redirect_target.split('://') | length < 2
- not vhost_redirect_target.startswith('/')
- name: Fail if redirect_target ends with / and redirect_preserve_path is true
- name: Fail if vhost_redirect_target ends with / and vhost_redirect_preserve_path is true
ansible.builtin.fail:
msg: redirect_target must not end with / if redirect_preserve_path is true
msg: vhost_redirect_target must not end with / if vhost_redirect_preserve_path is true
when:
- redirect_preserve_path
- redirect_target.endswith('/')
- vhost_redirect_preserve_path
- vhost_redirect_target.endswith('/')
- name: Reset vhost_locations_all
ansible.builtin.set_fact:
@@ -30,20 +30,20 @@
'basicauth': item.basicauth | default(vhost_basicauth),
'basicauth_users': item.basicauth_users | default(vhost_basicauth_users),
'proxy_target_port': item.proxy_target_port | default(proxy_target_port if vhost_type == 'reverse_proxy' else ''),
'proxy_target_host': item.proxy_target_host | default(proxy_target_host),
'proxy_target_protocol': item.proxy_target_protocol | default(proxy_target_protocol),
'proxy_delete_headers': item.proxy_delete_headers | default(proxy_delete_headers),
'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(redirect_target if vhost_type == 'redirect' else ''),
'redirect_preserve_path': item.redirect_preserve_path | default(redirect_preserve_path),
'redirect_type': item.redirect_type | default(redirect_type),
'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(respond_content if vhost_type == 'respond' else ''),
'respond_content_type': item.respond_content_type | default(respond_content_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 ' + web_server }}"
ansible.builtin.include_tasks: "{{ web_server }}.yml"
when: web_server != 'none'
- name: "Setup {{ vhost_id + ' vhost on ' + vhost_web_server }}"
ansible.builtin.include_tasks: "{{ vhost_web_server }}.yml"
when: vhost_web_server != 'none'