---
project_name: "glance"

glance_services:
  glance-api:
    container_name: glance_api
    group: glance-api
    enabled: true
    image: "{{ glance_api_image_full }}"
    environment: "{{ container_proxy }}"
    volumes:
      - "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "{{ glance_file_datadir_volume }}:/var/lib/glance/"
      - "{{ kolla_dev_repos_directory ~ '/glance/glance:/var/lib/kolla/venv/lib/python2.7/site-packages/glance' if glance_dev_mode | bool else '' }}"
      - "kolla_logs:/var/log/kolla/"
    dimensions: "{{ glance_api_dimensions }}"
  glance-registry:
    container_name: glance_registry
    group: glance-registry
    enabled: false
    image: "{{ glance_registry_image_full }}"
    volumes:
      - "{{ node_config_directory }}/glance-registry/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "{{ kolla_dev_repos_directory ~ '/glance/glance:/var/lib/kolla/venv/lib/python2.7/site-packages/glance' if glance_dev_mode | bool else '' }}"
      - "kolla_logs:/var/log/kolla/"
    dimensions: "{{ glance_registry_dimensions }}"

####################
# Notification
####################
glance_notification_topics:
  - name: notifications
    enabled: "{{ enable_ceilometer | bool or enable_searchlight | bool }}"

glance_enabled_notification_topics: "{{ glance_notification_topics | selectattr('enabled', 'equalto', true) | list }}"

####################
# Ceph
####################
ceph_glance_pool_type: "{{ ceph_pool_type }}"
ceph_glance_cache_mode: "{{ ceph_cache_mode }}"

# Due to Ansible issues on include, you cannot override these variables. Please
# override the variables they reference instead.
glance_pool_name: "{{ ceph_glance_pool_name }}"
glance_pool_type: "{{ ceph_glance_pool_type }}"
glance_cache_mode: "{{ ceph_glance_cache_mode }}"
glance_pool_pg_num: "{{ ceph_pool_pg_num }}"
glance_pool_pgp_num: "{{ ceph_pool_pgp_num }}"

ceph_client_glance_keyring_caps:
  mon: 'allow r'
  osd: >-
    allow class-read object_prefix rbd_children,
    allow rwx pool={{ ceph_glance_pool_name }},
    allow rwx pool={{ ceph_glance_pool_name }}-cache


####################
# Database
####################
glance_database_name: "glance"
glance_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}glance{% endif %}"
glance_database_address: "{{ database_address }}:{{ database_port }}"


####################
# Docker
####################
glance_install_type: "{{ kolla_install_type }}"
glance_tag: "{{ openstack_release }}"

glance_registry_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ glance_install_type }}-glance-registry"
glance_registry_tag: "{{ glance_tag }}"
glance_registry_image_full: "{{ glance_registry_image }}:{{ glance_registry_tag }}"

glance_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ glance_install_type }}-glance-api"
glance_api_tag: "{{ glance_tag }}"
glance_api_image_full: "{{ glance_api_image }}:{{ glance_api_tag }}"

glance_api_dimensions: "{{ default_container_dimensions }}"
glance_registry_dimensions: "{{ default_container_dimensions }}"


####################
# Glance
####################
glance_backends:
  - name: file
    enabled: true
  - name: http
    enabled: true
  - name: "rbd"
    enabled: "{{ enable_ceph | bool and glance_backend_ceph | bool }}"
  - name: "vmware"
    enabled: "{{ glance_backend_vmware | bool }}"
  - name: cinder
    enabled: "{{ enable_cinder | bool }}"
  - name: "swift"
    enabled: "{{ glance_backend_swift | bool }}"

glance_store_backends: "{{ glance_backends|selectattr('enabled', 'equalto', true)|list }}"

glance_api_hosts: "{{ groups['glance-api']|first if glance_backend_file | bool and glance_file_datadir_volume == 'glance' else groups['glance-api'] }}"

####################
# OpenStack
####################
glance_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ glance_api_port }}"
glance_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ glance_api_port }}"
glance_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ glance_api_port }}"

glance_logging_debug: "{{ openstack_logging_debug }}"

glance_keystone_user: "glance"

openstack_glance_auth: "{{ openstack_auth }}"

###################
# Kolla
####################
glance_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
glance_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
glance_dev_mode: "{{ kolla_dev_mode }}"

################################################
# VMware - OpenStack VMware support
################################################
vmware_vcenter_name:
vmware_datastore_name:
