/home/zuul/src/opendev.org/openstack/openstack-ansible-os_panko/vars/main.yml
---
# Copyright 2019, VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

filtered_panko_services: |-
  {% set services = [] %}
  {% for name, service in panko_services.items() %}
  {%   if (service['group'] in group_names) and
        (('service_enabled' not in service) or
        ('service_enabled' in service and service['service_enabled']))
        and not ('wsgi_app' in service and service['wsgi_app']) %}
  {%     set _ = service.update(
        {
          'service_key': name,
          'enabled': 'yes',
          'state': 'started',
        }
      )
  %}
  {%     set _ = services.append(service) %}
  {%   endif %}
  {% endfor %}
  {{ services }}

uwsgi_panko_services: |-
  {% set services = {} %}
  {% for name, service in panko_services.items() %}
  {%   if (service['group'] in group_names) and
         (('condition' not in service) or ('condition' in service and service['condition']))
         and ('wsgi_app' in service and service['wsgi_app']) %}
  {%     set _ = service.update(
            {
             'wsgi_venv': panko_bin,
             'uwsgi_uid': panko_system_user_name,
             'uwsgi_guid': panko_system_group_name,
             'uwsgi_processes': panko_wsgi_processes,
             'uwsgi_threads': panko_wsgi_threads
           }
         ) %}
  {%     set _ = services.update({name: service}) %}
  {%   endif %}
  {% endfor %}
  {{ services }}