---
venus_services:
  venus-api:
    container_name: venus_api
    group: venus-api
    enabled: true
    image: "{{ venus_api_image_full }}"
    volumes: "{{ venus_api_default_volumes + venus_api_extra_volumes }}"
    dimensions: "{{ venus_api_dimensions }}"
    healthcheck: "{{ venus_api_healthcheck }}"
    haproxy:
      venus_api:
        enabled: "{{ enable_venus }}"
        mode: "http"
        external: false
        port: "{{ venus_api_port }}"
        backend_http_extra:
          - "option httpchk"
      venus_api_external:
        enabled: "{{ enable_venus }}"
        mode: "http"
        external: true
        external_fqdn: "{{ venus_external_fqdn }}"
        port: "{{ venus_api_public_port }}"
        backend_http_extra:
          - "option httpchk"
  venus-manager:
    container_name: venus_manager
    group: venus-manager
    enabled: true
    image: "{{ venus_manager_image_full }}"
    volumes: "{{ venus_manager_default_volumes + venus_manager_extra_volumes }}"
    dimensions: "{{ venus_manager_dimensions }}"

####################
# Config Validate
####################
venus_config_validation:
  - generator: "/venus/tools/config/venus-config-generator.conf"
    config: "/etc/venus/venus.conf"

####################
# Database
####################
venus_database_name: "venus"
venus_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}venus{% endif %}"
venus_database_address: "{{ database_address | put_address_in_context('url') }}:{{ database_port }}"

####################
# Database sharding
####################
venus_database_shard_root_user: "{% if enable_proxysql | bool %}root_shard_{{ venus_database_shard_id }}{% else %}{{ database_user }}{% endif %}"
venus_database_shard_id: "{{ mariadb_default_database_shard_id | int }}"
venus_database_shard:
  users:
    - user: "{{ venus_database_user }}"
      password: "{{ venus_database_password }}"
  rules:
    - schema: "{{ venus_database_name }}"
      shard_id: "{{ venus_database_shard_id }}"


####################
# Docker
####################
venus_tag: "{{ openstack_tag }}"

venus_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ docker_image_name_prefix }}venus-api"
venus_api_tag: "{{ venus_tag }}"
venus_api_image_full: "{{ venus_api_image }}:{{ venus_api_tag }}"

venus_manager_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ docker_image_name_prefix }}venus-manager"
venus_manager_tag: "{{ venus_tag }}"
venus_manager_image_full: "{{ venus_manager_image }}:{{ venus_manager_tag }}"

venus_api_dimensions: "{{ default_container_dimensions }}"
venus_manager_dimensions: "{{ default_container_dimensions }}"

venus_api_enable_healthchecks: "{{ enable_container_healthchecks }}"
venus_api_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
venus_api_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
venus_api_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
venus_api_healthcheck_test: ["CMD-SHELL", "healthcheck_curl http://{{ api_interface_address | put_address_in_context('url') }}:{{ venus_api_port }}"]
venus_api_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
venus_api_healthcheck:
  interval: "{{ venus_api_healthcheck_interval }}"
  retries: "{{ venus_api_healthcheck_retries }}"
  start_period: "{{ venus_api_healthcheck_start_period }}"
  test: "{% if venus_api_enable_healthchecks | bool %}{{ venus_api_healthcheck_test }}{% else %}NONE{% endif %}"
  timeout: "{{ venus_api_healthcheck_timeout }}"

venus_api_default_volumes:
  - "{{ node_config_directory }}/venus-api/:{{ container_config_directory }}/:ro"
  - "/etc/localtime:/etc/localtime:ro"
  - "{{ '/etc/timezone:/etc/timezone:ro' if ansible_facts.os_family == 'Debian' else '' }}"
  - "kolla_logs:/var/log/kolla/"
  - "{{ '/dev/shm:/dev/shm' }}"
  - "{{ kolla_dev_repos_directory ~ '/venus:/dev-mode/venus' if venus_dev_mode | bool else '' }}"
  - "venus:/var/lib/venus/"
venus_manager_default_volumes:
  - "{{ node_config_directory }}/venus-manager/:{{ container_config_directory }}/:ro"
  - "/etc/localtime:/etc/localtime:ro"
  - "{{ '/etc/timezone:/etc/timezone:ro' if ansible_facts.os_family == 'Debian' else '' }}"
  - "kolla_logs:/var/log/kolla/"
  - "{{ '/dev/shm:/dev/shm' }}"
  - "{{ kolla_dev_repos_directory ~ '/venus:/dev-mode/venus' if venus_dev_mode | bool else '' }}"
  - "venus:/var/lib/venus/"

venus_extra_volumes: "{{ default_extra_volumes }}"
venus_api_extra_volumes: "{{ venus_extra_volumes }}"
venus_manager_extra_volumes: "{{ venus_extra_volumes }}"

####################
# OpenStack
####################
venus_logging_debug: "{{ openstack_logging_debug }}"

venus_keystone_user: "venus"

openstack_venus_auth: "{{ openstack_auth }}"


####################
# Kolla
####################
venus_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
venus_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
venus_dev_mode: "{{ kolla_dev_mode }}"
venus_source_version: "{{ kolla_source_version }}"

####################
# logging
####################
openstack_logging_default_format_string: "%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [- req-None - - - - -] %(instance)s%(message)s"
openstack_logging_context_format_string: "%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(global_request_id)s %(request_id)s %(user_identity)s] %(instance)s%(message)s"

####################
# Notifications
####################
venus_notification_topics:
  - name: notifications
    enabled: "{{ enable_ceilometer | bool }}"

venus_enabled_notification_topics: "{{ venus_notification_topics | selectattr('enabled', 'equalto', true) | list }}"

####################
# Keystone
####################
venus_ks_services:
  - name: "venus"
    type: "LMS"
    description: "Log Manager Service"
    endpoints:
      - {'interface': 'internal', 'url': '{{ venus_internal_endpoint }}'}
      - {'interface': 'public', 'url': '{{ venus_public_endpoint }}'}

venus_ks_users:
  - project: "service"
    user: "{{ venus_keystone_user }}"
    password: "{{ venus_keystone_password }}"
    role: "admin"
