/home/zuul/src/opendev.org/openstack/openstack-ansible-os_manila/vars/main.yml
---
# Copyright 2019, Rackspace US, 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.

#
# Compile a list of the services on a host based on whether
# the host is in the host group and the service is enabled.
# The service list is provided in the defined start order.
#
filtered_manila_services: |-
  {% set services = [] %}
  {% for key, value in manila_services.items() %}
  {%   if (value['group'] in group_names) and
          (('condition' not in value) or
           ('condition' in value and value['condition'])) %}
  {%     set _ = value.update({'service_key': key}) %}
  {%     set _ = services.append(value) %}
  {%   endif %}
  {% endfor %}
  {{ services | sort(attribute='start_order') }}

manila_core_files:
  - src: "manila.conf.j2"
    dest: "/etc/manila/manila.conf"
    config_overrides: "{{ manila_manila_conf_overrides }}"
    config_type: "ini"
  - src: "policy.json.j2"
    dest: "/etc/manila/policy.json-{{ manila_venv_tag }}"
    config_overrides: "{{ manila_policy_overrides }}"
    config_type: "json"

manila_rootwrap_files:
  - condition: "{{ manila_install_method == 'source' }}"
    config_overrides: "{{ manila_rootwrap_conf_overrides }}"
    config_type: ini
    dest: /etc/manila/rootwrap.conf
    source: "{{ manila_bin | dirname }}/etc/manila/rootwrap.conf"
    src: /tmp/rootwrap.conf
  - condition: "{{ manila_install_method == 'source' and 'manila_share' in group_names }}"
    config_type: ini
    dest: /etc/manila/rootwrap.d/share.filters
    source: "{{ manila_bin | dirname }}/etc/manila/rootwrap.d/share.filters"
    src: /tmp/manila-share.filters
  - condition: "{{ manila_install_method == 'source' and 'manila_api' in group_names }}"
    config_type: "ini"
    config_overrides: "{{ manila_api_paste_ini_overrides }}"
    source: "{{ manila_bin | dirname }}/etc/manila/api-paste.ini"
    src: "/tmp/api-paste.ini"
    dest: "/etc/manila/api-paste.ini"

manila_service_endpoints:
  - service: "{{ manila_service_name }}"
    interface: "public"
    url: "{{ manila_service_publicurl }}"
    state: present
  - service: "{{ manila_service_name }}"
    interface: "internal"
    url: "{{ manila_service_internalurl }}"
    state: present
  - service: "{{ manila_service_name }}"
    interface: "admin"
    url: "{{ manila_service_adminurl }}"
    state: present
  - service: "{{ manila_service_v2_name }}"
    interface: "public"
    url: "{{ manila_service_v2_publicurl }}"
    state: "{{ (manila_enable_v2_api | bool) | ternary('present', 'absent') }}"
  - service: "{{ manila_service_v2_name }}"
    interface: "internal"
    url: "{{ manila_service_v2_internalurl }}"
    state: "{{ (manila_enable_v2_api | bool) | ternary('present', 'absent') }}"
  - service: "{{ manila_service_v2_name }}"
    interface: "admin"
    url: "{{ manila_service_v2_adminurl }}"
    state: "{{ (manila_enable_v2_api | bool) | ternary('present', 'absent') }}"