{% set apache_cmd = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
{% set apache_dir = 'apache2/conf-enabled' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd/conf.d' %}
{% set apache_file = '000-default.conf' if kolla_base_distro in ['ubuntu', 'debian'] else 'horizon.conf' %}
{% set uwsgi_cmd = 'uwsgi /etc/horizon/horizon-uwsgi.ini' %}
{% set command = uwsgi_cmd if horizon_wsgi_provider == 'uwsgi' else ('/usr/sbin/' + apache_cmd + ' -DFOREGROUND') %}
{
    "command": "{{ command }}",
    "config_files": [
        {
{% if horizon_wsgi_provider == 'apache' %}
            "source": "{{ container_config_directory }}/horizon.conf",
            "dest": "/etc/{{ apache_dir }}/{{ apache_file }}",
            "owner": "horizon",
            "perm": "0600"
{% elif horizon_wsgi_provider == 'uwsgi' %}
            "source": "{{ container_config_directory }}/horizon-uwsgi.ini",
            "dest": "/etc/horizon/horizon-uwsgi.ini",
            "owner": "horizon",
            "perm": "0600"
{% endif %}
        },
{% for path in custom_policy %}
        {
            "source": "{{ container_config_directory }}/{{ path | basename }}",
            "dest": "/etc/openstack-dashboard/{{ path | basename }}",
            "owner": "horizon",
            "perm": "0600"
        },
{% endfor %}
        {
            "source": "{{ container_config_directory }}/_9998-kolla-settings.py",
            "dest": "/etc/openstack-dashboard/local_settings.d/_9998-kolla-settings.py",
            "owner": "horizon",
            "perm": "0600"
        },
        {
            "source": "{{ container_config_directory }}/_9999-custom-settings.py",
            "dest": "/etc/openstack-dashboard/local_settings.d/_9999-custom-settings.py",
            "owner": "horizon",
            "perm": "0600"
        }{% if horizon_enable_tls_backend | bool %},
        {
            "source": "{{ container_config_directory }}/horizon-cert.pem",
            "dest": "/etc/horizon/certs/horizon-cert.pem",
            "owner": "horizon",
            "perm": "0600"
        },
        {
            "source": "{{ container_config_directory }}/horizon-key.pem",
            "dest": "/etc/horizon/certs/horizon-key.pem",
            "owner": "horizon",
            "perm": "0600"
        }{% endif %}{% if horizon_custom_themes | length > 0 %},
        {
            "source": "{{ container_config_directory}}/themes",
            "dest": "/etc/openstack-dashboard/themes",
            "owner": "horizon",
            "perm": "0600"
        }{% endif %}
        {% if kolla_copy_ca_into_containers | bool %},
        {
            "source": "{{ container_config_directory }}/ca-certificates",
            "dest": "/var/lib/kolla/share/ca-certificates",
            "owner": "root",
            "perm": "0600"
        }{% endif %}
    ]
}
