---
project_name: "nova"

nova_services:
  nova-api:
    container_name: "nova_api"
    group: "nova-api"
    image: "{{ nova_api_image_full }}"
    enabled: True
    privileged: True
    volumes: "{{ nova_api_default_volumes + nova_api_extra_volumes }}"
    dimensions: "{{ nova_api_dimensions }}"
    haproxy:
      nova_api:
        enabled: "{{ enable_nova }}"
        mode: "http"
        external: false
        port: "{{ nova_api_port }}"
        listen_port: "{{ nova_api_listen_port }}"
      nova_api_external:
        enabled: "{{ enable_nova }}"
        mode: "http"
        external: true
        port: "{{ nova_api_port }}"
        listen_port: "{{ nova_api_listen_port }}"
      nova_metadata:
        enabled: "{{ enable_nova }}"
        mode: "http"
        external: false
        port: "{{ nova_metadata_port }}"
        listen_port: "{{ nova_metadata_listen_port }}"
      nova_metadata_external:
        enabled: "{{ enable_nova }}"
        mode: "http"
        external: true
        port: "{{ nova_metadata_port }}"
        listen_port: "{{ nova_metadata_listen_port }}"
      nova_rdp:
        enabled: "{{ enable_nova|bool and nova_console == 'rdp' }}"
        mode: "http"
        external: false
        port: "{{ rdp_port }}"
        host_group: "hyperv"
  nova-scheduler:
    container_name: "nova_scheduler"
    group: "nova-scheduler"
    image: "{{ nova_scheduler_image_full }}"
    enabled: True
    volumes: "{{ nova_scheduler_default_volumes + nova_scheduler_extra_volumes }}"
    dimensions: "{{ nova_scheduler_dimensions }}"
  nova-super-conductor:
    container_name: "nova_super_conductor"
    group: "nova-super-conductor"
    enabled: "{{ enable_cells }}"
    image: "{{ nova_super_conductor_image_full }}"
    volumes: "{{ nova_super_conductor_default_volumes + nova_super_conductor_extra_volumes }}"
    dimensions: "{{ nova_super_conductor_dimensions }}"

####################
# Database
####################
# These are kept for backwards compatibility, as cell0 references them.
nova_database_name: "nova"
nova_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}nova{% endif %}"
nova_database_address: "{{ database_address | put_address_in_context('url') }}:{{ database_port }}"

nova_cell0_database_name: "{{ nova_database_name }}_cell0"
nova_cell0_database_user: "{{ nova_database_user }}"
nova_cell0_database_address: "{{ nova_database_address }}"
nova_cell0_database_password: "{{ nova_database_password }}"

nova_api_database_name: "nova_api"
nova_api_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}nova_api{% endif %}"
nova_api_database_address: "{{ database_address | put_address_in_context('url') }}:{{ database_port }}"

####################
# Docker
####################
nova_install_type: "{{ kolla_install_type }}"
nova_tag: "{{ openstack_tag }}"

nova_super_conductor_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ nova_install_type }}-nova-conductor"
nova_super_conductor_tag: "{{ nova_tag }}"
nova_super_conductor_image_full: "{{ nova_super_conductor_image }}:{{ nova_super_conductor_tag }}"

nova_scheduler_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ nova_install_type }}-nova-scheduler"
nova_scheduler_tag: "{{ nova_tag }}"
nova_scheduler_image_full: "{{ nova_scheduler_image }}:{{ nova_scheduler_tag }}"

nova_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ nova_install_type }}-nova-api"
nova_api_tag: "{{ nova_tag }}"
nova_api_image_full: "{{ nova_api_image }}:{{ nova_api_tag }}"

nova_api_dimensions: "{{ default_container_dimensions }}"
nova_scheduler_dimensions: "{{ default_container_dimensions }}"
nova_super_conductor_dimensions: "{{ default_container_dimensions }}"

nova_api_default_volumes:
  - "{{ node_config_directory }}/nova-api/:{{ container_config_directory }}/:ro"
  - "/etc/localtime:/etc/localtime:ro"
  - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}"
  - "/lib/modules:/lib/modules:ro"
  - "kolla_logs:/var/log/kolla/"
  - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/nova' if nova_dev_mode | bool else '' }}"
nova_scheduler_default_volumes:
  - "{{ node_config_directory }}/nova-scheduler/:{{ container_config_directory }}/:ro"
  - "/etc/localtime:/etc/localtime:ro"
  - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}"
  - "kolla_logs:/var/log/kolla/"
  - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/nova' if nova_dev_mode | bool else '' }}"
nova_super_conductor_default_volumes:
  - "{{ node_config_directory }}/nova-super-conductor/:{{ container_config_directory }}/:ro"
  - "/etc/localtime:/etc/localtime:ro"
  - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}"
  - "kolla_logs:/var/log/kolla/"
  - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/nova' if nova_dev_mode | bool else '' }}"
# Used by bootstrapping containers.
nova_api_bootstrap_default_volumes:
  - "{{ node_config_directory }}/nova-api-bootstrap/:{{ container_config_directory }}/:ro"
  - "/etc/localtime:/etc/localtime:ro"
  - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}"
  - "kolla_logs:/var/log/kolla/"
  - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/nova' if nova_dev_mode | bool else '' }}"

nova_extra_volumes: "{{ default_extra_volumes }}"
nova_api_extra_volumes: "{{ nova_extra_volumes }}"
nova_scheduler_extra_volumes: "{{ nova_extra_volumes }}"
nova_super_conductor_extra_volumes: "{{ nova_extra_volumes }}"
# Used by bootstrapping containers.
nova_api_bootstrap_extra_volumes: "{{ nova_extra_volumes }}"


####################
# OpenStack
####################

nova_legacy_admin_endpoint: "{{ admin_protocol }}://{{ nova_internal_fqdn | put_address_in_context('url') }}:{{ nova_api_port }}/v2/%(tenant_id)s"
nova_legacy_internal_endpoint: "{{ internal_protocol }}://{{ nova_internal_fqdn | put_address_in_context('url') }}:{{ nova_api_port }}/v2/%(tenant_id)s"
nova_legacy_public_endpoint: "{{ public_protocol }}://{{ nova_external_fqdn | put_address_in_context('url') }}:{{ nova_api_port }}/v2/%(tenant_id)s"

nova_admin_endpoint: "{{ admin_protocol }}://{{ nova_internal_fqdn | put_address_in_context('url') }}:{{ nova_api_port }}/v2.1"
nova_internal_endpoint: "{{ internal_protocol }}://{{ nova_internal_fqdn | put_address_in_context('url') }}:{{ nova_api_port }}/v2.1"
nova_public_endpoint: "{{ public_protocol }}://{{ nova_external_fqdn | put_address_in_context('url') }}:{{ nova_api_port }}/v2.1"

nova_logging_debug: "{{ openstack_logging_debug }}"

openstack_nova_auth: "{{ openstack_auth }}"

nova_safety_upgrade: "no"

nova_services_require_policy_json:
  - nova-api

####################
# Keystone
####################
nova_ks_services:
  - name: "nova_legacy"
    type: "compute_legacy"
    description: "OpenStack Compute Service (Legacy 2.0)"
    endpoints:
      - {'interface': 'admin', 'url': '{{ nova_legacy_admin_endpoint }}'}
      - {'interface': 'internal', 'url': '{{ nova_legacy_internal_endpoint }}'}
      - {'interface': 'public', 'url': '{{ nova_legacy_public_endpoint }}'}
  - name: "nova"
    type: "compute"
    description: "OpenStack Compute Service"
    endpoints:
      - {'interface': 'admin', 'url': '{{ nova_admin_endpoint }}'}
      - {'interface': 'internal', 'url': '{{ nova_internal_endpoint }}'}
      - {'interface': 'public', 'url': '{{ nova_public_endpoint }}'}

nova_ks_users:
  - project: "service"
    user: "{{ nova_keystone_user }}"
    password: "{{ nova_keystone_password }}"
    role: "admin"

####################
# Notification
####################
nova_notification_topics:
  - name: notifications
    enabled: "{{ enable_ceilometer | bool or enable_searchlight | bool or enable_neutron_infoblox_ipam_agent | bool }}"
  - name: notifications_designate
    enabled: "{{ enable_designate | bool }}"
  - name: vitrage_notifications
    enabled: "{{ enable_vitrage | bool }}"

nova_enabled_notification_topics: "{{ nova_notification_topics | selectattr('enabled', 'equalto', true) | list }}"

####################
# Kolla
####################
nova_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
nova_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
nova_dev_mode: "{{ kolla_dev_mode }}"
nova_source_version: "{{ kolla_source_version }}"