vhost: lint
This commit is contained in:
@@ -20,16 +20,18 @@ argument_specs:
|
||||
- present
|
||||
- absent
|
||||
vhost_type:
|
||||
description: Required if vhost_state is present
|
||||
type: str
|
||||
required: "{{ vhost_state == 'present' }}"
|
||||
required: false
|
||||
choices:
|
||||
- reverse_proxy
|
||||
- redirect
|
||||
- respond
|
||||
- absent
|
||||
vhost_domains:
|
||||
description: Required if vhost_state is present
|
||||
type: list
|
||||
required: "{{ vhost_state == 'present' }}"
|
||||
required: false
|
||||
elements: str
|
||||
vhost_web_server:
|
||||
description: Defines which server software to use for vhost. This role does nothing if set to none.
|
||||
@@ -94,13 +96,13 @@ argument_specs:
|
||||
- Port where to proxy requests to.
|
||||
- Only applicable if vhost_type is reverse_proxy and vhost_proxy_target_netproto is tcp.
|
||||
type: int
|
||||
required: "{{ vhost_state == 'present' and vhost_type == 'reverse_proxy' and vhost_proxy_target_netproto == 'tcp' }}"
|
||||
required: false
|
||||
vhost_proxy_target_socket:
|
||||
description:
|
||||
- Unix socket path to proxy requests to.
|
||||
- Only applicable if vhost_type is reverse_proxy and vhost_proxy_target_netproto is unix.
|
||||
type: str
|
||||
required: "{{ vhost_state == 'present' and vhost_type == 'reverse_proxy' and vhost_proxy_target_netproto == 'unix' }}"
|
||||
required: false
|
||||
vhost_proxy_delete_headers:
|
||||
description: List of headers to delete from proxied requests
|
||||
type: list
|
||||
@@ -111,7 +113,7 @@ argument_specs:
|
||||
vhost_redirect_target:
|
||||
description: "Only applicable if vhost_type is redirect. Example: https://www.domain.tld/location"
|
||||
type: str
|
||||
required: "{{ vhost_state == 'present' and vhost_type == 'redirect' }}"
|
||||
required: false
|
||||
vhost_redirect_preserve_path:
|
||||
description: Whether to keep the original request path
|
||||
type: bool
|
||||
@@ -134,7 +136,7 @@ argument_specs:
|
||||
vhost_respond_content:
|
||||
description: Content to respond with. Json content can be set as yaml as long as vhost_respond_content_type is set to json
|
||||
type: str
|
||||
required: "{{ vhost_state == 'present' and vhost_type == 'respond' }}"
|
||||
required: false
|
||||
vhost_respond_content_type:
|
||||
description: Type of the respond content
|
||||
type: str
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
ansible.builtin.blockinfile:
|
||||
path: /etc/caddy/Caddyfile
|
||||
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ vhost_id }}"
|
||||
# yamllint disable rule:line-length
|
||||
block: |
|
||||
{{ vhost_domains | join(' ') }} {
|
||||
{% for location in vhost_locations_all %}
|
||||
@@ -52,6 +53,7 @@
|
||||
}
|
||||
{% endfor %}
|
||||
}
|
||||
# yamllint enable rule:line-length
|
||||
validate: 'caddy validate --config %s --adapter caddyfile'
|
||||
backup: true
|
||||
state: "{{ vhost_state }}"
|
||||
|
||||
Reference in New Issue
Block a user