vhost: add support for locations, headers, and responds
This commit is contained in:
@@ -14,6 +14,7 @@ argument_specs:
|
||||
choices:
|
||||
- reverse_proxy
|
||||
- redirect
|
||||
- respond
|
||||
vhost_domains:
|
||||
type: list
|
||||
required: true
|
||||
@@ -26,26 +27,134 @@ argument_specs:
|
||||
choices:
|
||||
- caddy
|
||||
- none
|
||||
vhost_headers:
|
||||
description: dict of headers and their values
|
||||
type: dict
|
||||
required: false
|
||||
default: {}
|
||||
|
||||
proxy_target_port:
|
||||
description: Required and only applicable if vhost_type is reverse_proxy
|
||||
description: Port where to proxy requests to. Only applicable if vhost_type is reverse_proxy
|
||||
type: int
|
||||
required: "{{ vhost_type == 'reverse_proxy' }}"
|
||||
proxy_target_host:
|
||||
description: Only applicable if vhost_type is reverse_proxy
|
||||
description: Host where to proxy requests to. Only applicable if vhost_type is reverse_proxy
|
||||
type: str
|
||||
required: false
|
||||
default: localhost
|
||||
proxy_target_protocol:
|
||||
description: Only applicable if vhost_type is reverse_proxy
|
||||
description: Protocol to use for proxy requests. Only applicable if vhost_type is reverse_proxy
|
||||
type: str
|
||||
required: false
|
||||
default: http
|
||||
choices:
|
||||
- http
|
||||
- https
|
||||
|
||||
redirect_target:
|
||||
description: "Required and only applicable if vhost_type is redirect. Example: https://www.domain.tld/location"
|
||||
description: "Only applicable if vhost_type is redirect. Example: https://www.domain.tld/location"
|
||||
type: str
|
||||
required: "{{ vhost_type == 'redirect' }}"
|
||||
redirect_preserve_path:
|
||||
description: Whether to keep the original request path
|
||||
type: bool
|
||||
required: false
|
||||
default: false
|
||||
redirect type:
|
||||
description: Only applicable if vhost_type is reverse_proxy
|
||||
type: str
|
||||
required: false
|
||||
default: temporary
|
||||
choices:
|
||||
- temporary
|
||||
- permanent
|
||||
|
||||
respond_content:
|
||||
description: Content to respond with. Json content can be set as yaml as long as respond_content_type is set to json
|
||||
type: str
|
||||
required: "{{ vhost_type == 'respond' }}"
|
||||
respond_content_type:
|
||||
description: Type of the respond content
|
||||
type: str
|
||||
required: false
|
||||
default: plain
|
||||
choices:
|
||||
- plain
|
||||
- json
|
||||
|
||||
vhost_locations:
|
||||
description: List of locations to handle differently from the default for vhost
|
||||
type: list
|
||||
required: false
|
||||
default: []
|
||||
elements: dict
|
||||
options:
|
||||
path:
|
||||
description: Path to match. Only supports full paths for now.
|
||||
type: str
|
||||
required: true
|
||||
type:
|
||||
type: str
|
||||
required: false
|
||||
default: "{{ vhost_type }}"
|
||||
choices:
|
||||
- reverse_proxy
|
||||
- redirect
|
||||
- respond
|
||||
headers:
|
||||
description: dict of headers and their values
|
||||
type: dict
|
||||
required: false
|
||||
default: "{{ vhost_headers }}"
|
||||
|
||||
proxy_target_port:
|
||||
description: Port where to proxy requests to. Only applicable if type is reverse_proxy.
|
||||
type: int
|
||||
required: false
|
||||
default: "{{ proxy_target_port if vhost_type == 'reverse_proxy' else 0 }}"
|
||||
proxy_target_host:
|
||||
description: Host where to proxy requests to. Only applicable if type is reverse_proxy
|
||||
type: str
|
||||
required: false
|
||||
default: "{{ proxy_target_host }}"
|
||||
proxy_target_protocol:
|
||||
description: Protocol to use for proxy requests. Only applicable if type is reverse_proxy
|
||||
type: str
|
||||
required: false
|
||||
default: "{{ proxy_target_protocol }}"
|
||||
choices:
|
||||
- http
|
||||
- https
|
||||
|
||||
redirect_target:
|
||||
description: "Only applicable if vhost_type is redirect. Example: https://www.domain.tld/location"
|
||||
type: str
|
||||
required: false
|
||||
default: "{{ redirect_target if vhost_type == 'redirect' else '' }}"
|
||||
redirect_preserve_path:
|
||||
description: Whether to keep the original request path
|
||||
type: bool
|
||||
required: false
|
||||
default: "{{ redirect_preserve_path }}"
|
||||
redirect type:
|
||||
description: Only applicable if vhost_type is reverse_proxy
|
||||
type: str
|
||||
required: false
|
||||
default: "{{ redirect_type }}"
|
||||
choices:
|
||||
- temporary
|
||||
- permanent
|
||||
|
||||
respond_content:
|
||||
description: Content to respond with. Json content can be set as yaml as long as respond_content_type is set to json
|
||||
type: str
|
||||
required: false
|
||||
default: "{{ respond_content if vhost_type == 'respond' else '' }}"
|
||||
respond_content_type:
|
||||
description: Type of the respond content
|
||||
type: str
|
||||
required: false
|
||||
default: "{{ respond_content_type }}"
|
||||
choices:
|
||||
- plain
|
||||
- json
|
||||
|
||||
Reference in New Issue
Block a user