Allow vhosts to be defined without DocumentRoot
Horizon at the moment does not have DocumentRoot defined as this is configured via Alias instead. Change-Id: Iae886d3bceb61247039fdb26ce0844f08934f8b6
This commit is contained in:
parent
6484f052e8
commit
ac2e053886
@ -36,7 +36,7 @@
|
||||
(
|
||||
httpd_vhosts | selectattr('state', 'defined') | selectattr('state', 'eq', 'present') +
|
||||
httpd_vhosts | selectattr('state', 'undefined')
|
||||
) | map(attribute='document_root') | map('community.general.dict_kv', 'path')
|
||||
) | selectattr('document_root', 'defined') | map(attribute='document_root') | map('community.general.dict_kv', 'path')
|
||||
}}
|
||||
_default_paths:
|
||||
- path: "{{ httpd_conf_dir }}/sites-available"
|
||||
|
@ -18,11 +18,10 @@
|
||||
that:
|
||||
- httpd_vhosts | length > 0
|
||||
- httpd_vhosts | selectattr('name', 'undefined') | length == 0
|
||||
- httpd_vhosts | selectattr('document_root', 'undefined') | length == 0
|
||||
success_msg: vhosts are defined properly
|
||||
fail_msg: >-
|
||||
At least one vhost must be defined in `httpd_vhosts`.
|
||||
Each vhost must contain at least `name` and `document_root` keys.
|
||||
Each vhost must contain at least `name` key.
|
||||
|
||||
- name: Gather variables for each operating system
|
||||
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
|
||||
|
@ -8,7 +8,10 @@ Listen {{ vhost['address'] | default('*') }}:{{ vhost['port'] | default(80) }}
|
||||
LogLevel {{ vhost['log_level'] | default(httpd_log_level) }}
|
||||
ErrorLog syslog:daemon
|
||||
CustomLog "|/usr/bin/env logger -p daemon.info -t {{ httpd_system_service_name }}:{{ vhost['name'] }}" {{ vhost['log_format'] | default(httpd_custom_log_format) }}
|
||||
|
||||
{% if 'document_root' in vhost %}
|
||||
DocumentRoot {{ vhost['document_root'] }}
|
||||
{% endif %}
|
||||
|
||||
{% for header in vhost['headers'] | default([]) %}
|
||||
{{ header }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user