---
freezer_services:
  freezer-api:
    container_name: freezer_api
    group: freezer-api
    enabled: true
    image: "{{ freezer_api_image_full }}"
    volumes: "{{ freezer_api_default_volumes + freezer_api_extra_volumes }}"
    dimensions: "{{ freezer_api_dimensions }}"
    haproxy:
      freezer_api:
        enabled: "{{ enable_freezer }}"
        mode: "http"
        external: false
        port: "{{ freezer_api_port }}"
      freezer_api_external:
        enabled: "{{ enable_freezer }}"
        mode: "http"
        external: true
        port: "{{ freezer_api_port }}"
  freezer-scheduler:
    container_name: freezer_scheduler
    group: freezer-scheduler
    enabled: true
    image: "{{ freezer_scheduler_image_full }}"
    volumes: "{{ freezer_scheduler_default_volumes + freezer_scheduler_extra_volumes }}"
    dimensions: "{{ freezer_scheduler_dimensions }}"

####################
# Config Validate
####################
freezer_config_validation:
  - generator: "/freezer/etc/config-generator.conf"
    config: "/etc/freezer/freezer.conf"

####################
## Database
#####################
freezer_database_backend: "mariadb"
freezer_database_name: "freezer"
freezer_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}freezer{% endif %}"
freezer_database_address: "{{ database_address | put_address_in_context('url') }}:{{ database_port }}"
freezer_elasticsearch_replicas: "1"
freezer_es_protocol: "{{ internal_protocol }}"
freezer_es_address: "{{ opensearch_address }}"
freezer_es_port: "{{ opensearch_port }}"

####################
# Database sharding
####################
freezer_database_shard_root_user: "{% if enable_proxysql | bool %}root_shard_{{ freezer_database_shard_id }}{% else %}{{ database_user }}{% endif %}"
freezer_database_shard_id: "{{ mariadb_default_database_shard_id | int }}"
freezer_database_shard:
  users:
    - user: "{{ freezer_database_user }}"
      password: "{{ freezer_database_password }}"
  rules:
    - schema: "{{ freezer_database_name }}"
      shard_id: "{{ freezer_database_shard_id }}"


####################
# Docker
####################
freezer_tag: "{{ openstack_tag }}"

freezer_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/freezer-api"
freezer_api_tag: "{{ freezer_tag }}"
freezer_api_image_full: "{{ freezer_api_image }}:{{ freezer_api_tag }}"

freezer_scheduler_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/freezer-scheduler"
freezer_scheduler_tag: "{{ freezer_tag }}"
freezer_scheduler_image_full: "{{ freezer_scheduler_image }}:{{ freezer_scheduler_tag }}"

freezer_api_dimensions: "{{ default_container_dimensions }}"
freezer_scheduler_dimensions: "{{ default_container_dimensions }}"

freezer_api_default_volumes:
  - "{{ node_config_directory }}/freezer-api/:{{ container_config_directory }}/:ro"
  - "/etc/localtime:/etc/localtime:ro"
  - "{{ '/etc/timezone:/etc/timezone:ro' if ansible_facts.os_family == 'Debian' else '' }}"
  - "freezer:/var/lib/freezer/"
  - "kolla_logs:/var/log/kolla/"
  - "{{ kolla_dev_repos_directory ~ '/freezer-api/freezer_api:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/freezer_api' if freezer_dev_mode | bool else '' }}"
freezer_scheduler_default_volumes:
  - "{{ node_config_directory }}/freezer-scheduler/:{{ container_config_directory }}/:ro"
  - "/etc/localtime:/etc/localtime:ro"
  - "{{ '/etc/timezone:/etc/timezone:ro' if ansible_facts.os_family == 'Debian' else '' }}"
  - "freezer:/var/lib/freezer/"
  - "kolla_logs:/var/log/kolla/"
  - "{{ kolla_dev_repos_directory ~ '/freezer/freezer:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/freezer' if freezer_dev_mode | bool else '' }}"

freezer_extra_volumes: "{{ default_extra_volumes }}"
freezer_api_extra_volumes: "{{ freezer_extra_volumes }}"
freezer_scheduler_extra_volumes: "{{ freezer_extra_volumes }}"

####################
# OpenStack
####################
freezer_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ freezer_api_port }}"
freezer_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn | put_address_in_context('url') }}:{{ freezer_api_port }}"

freezer_logging_debug: "{{ openstack_logging_debug }}"

freezer_keystone_user: "freezer"

openstack_freezer_auth: "{{ openstack_auth }}"

freezer_api_workers: "{{ openstack_service_workers }}"

####################
# Kolla
####################
freezer_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
freezer_api_git_repository: "{{ kolla_dev_repos_git }}/freezer-api"
freezer_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
freezer_dev_mode: "{{ kolla_dev_mode }}"
freezer_source_version: "{{ kolla_source_version }}"

####################
# Keystone
####################
freezer_ks_services:
  - name: "freezer"
    type: "backup"
    description: "Openstack Freezer Backup Service"
    endpoints:
      - {'interface': 'internal', 'url': '{{ freezer_internal_endpoint }}'}
      - {'interface': 'public', 'url': '{{ freezer_public_endpoint }}'}

freezer_ks_users:
  - project: "service"
    user: "{{ freezer_keystone_user }}"
    password: "{{ freezer_keystone_password }}"
    role: "admin"
