Merge "Fix default deployment of freezer, use mariadb."

This commit is contained in:
Zuul 2019-06-19 13:59:53 +00:00 committed by Gerrit Code Review
commit 8ce545e7b8
7 changed files with 90 additions and 3 deletions
ansible
group_vars
roles/freezer
etc/kolla
releasenotes/notes

@ -684,7 +684,7 @@ skip_stop_containers: []
####################
elasticsearch_address: "{{ kolla_internal_fqdn }}"
enable_elasticsearch: "{{ 'yes' if enable_central_logging | bool or enable_freezer | bool or enable_osprofiler | bool or enable_skydive | bool or enable_monasca | bool else 'no' }}"
enable_elasticsearch: "{{ 'yes' if enable_central_logging | bool or enable_osprofiler | bool or enable_skydive | bool or enable_monasca | bool else 'no' }}"
enable_kibana: "{{ 'yes' if enable_central_logging | bool or enable_monasca | bool else 'no' }}"
####################

@ -28,6 +28,17 @@ freezer_services:
volumes: "{{ freezer_scheduler_default_volumes + freezer_scheduler_extra_volumes }}"
dimensions: "{{ freezer_scheduler_dimensions }}"
####################
## 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 }}:{{ database_port }}"
freezer_elasticsearch_replicas: "1"
freezer_es_protocol:
freezer_es_address:
freezer_es_port:
####################
# Docker

@ -0,0 +1,38 @@
---
- name: Creating Freezer database
kolla_toolbox:
module_name: mysql_db
module_args:
login_host: "{{ database_address }}"
login_port: "{{ database_port }}"
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ freezer_database_name }}"
become: true
register: database
run_once: True
delegate_to: "{{ groups['freezer-api'][0] }}"
when:
- not use_preconfigured_databases | bool
- name: Creating Freezer database user and setting permissions
kolla_toolbox:
module_name: mysql_user
module_args:
login_host: "{{ database_address }}"
login_port: "{{ database_port }}"
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ freezer_database_user }}"
password: "{{ freezer_database_password }}"
host: "%"
priv: "{{ freezer_database_name }}.*:ALL"
append_privs: "yes"
become: true
run_once: True
delegate_to: "{{ groups['freezer-api'][0] }}"
when:
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml
when: database.changed or use_preconfigured_databases | bool

@ -6,6 +6,9 @@
when: inventory_hostname in groups['freezer-api'] or
inventory_hostname in groups['freezer-scheduler']
- include_tasks: bootstrap.yml
when: freezer_database_backend == 'mariadb' and inventory_hostname in groups['freezer-api']
- include_tasks: bootstrap_service.yml
when: inventory_hostname in groups['freezer-api']

@ -46,12 +46,25 @@ enable_proxy_headers_parsing = True
[paste_deploy]
config_file = /etc/freezer/freezer-paste.ini
{% if freezer_database_backend == 'mariadb' %}
[storage]
backend = sqlachemy
driver = sqlalchemy
[database]
connection = mysql+pymysql://{{ freezer_database_user }}:{{ freezer_database_password }}@{{ freezer_database_address }}/{{ freezer_database_name }}
max_retries = -1
{% endif %}
{% if freezer_database_backend == 'elasticsearch' %}
[storage]
backend = elasticsearch
driver = elasticsearch
[elasticsearch]
hosts = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ elasticsearch_port }}
number_of_replicas = 0
hosts = {{ freezer_es_protocol }}://{{ freezer_es_address }}:{{ freezer_es_port }}
number_of_replicas = {{ freezer_elasticsearch_replicas }}
index = freezer
{% endif %}
{% endif %}

@ -565,3 +565,12 @@
#enable_prometheus_ceph_mgr_exporter: "{{ enable_prometheus | bool and enable_ceph | bool }}"
#enable_prometheus_openstack_exporter: "{{ enable_prometheus | bool }}"
#enable_prometheus_elasticsearch_exporter: "{{ enable_prometheus | bool and enable_elasticsearch | bool }}"
#########
# Freezer
#########
# Freezer can utilize two different database backends, elasticsearch or mariadb.
# Elasticsearch is preferred, however it is not compatible with the version deployed
# by kolla-ansible. You must first setup an external elasticsearch with 2.3.0.
# By default, kolla-ansible deployed mariadb is the used database backend.
#freezer_database_backend: "mariadb"

@ -0,0 +1,13 @@
---
upgrade:
- |
Freezer now use MariaDB as default backend for database.
Elasticsearch remains as an optional backend due to the requirement of
Freezer to use Elasticsearch version 2.3.0. Elasticsearch in kolla-ansible
is 5.6.x and that doesn't work with Freezer.
New variables have been added:: ``freezer_database_backend``,
``freezer_database_name``, ``freezer_database_user``,
``freezer_database_address``, ``freezer_elasticsearch_replicas``,
``freezer_es_protocol``, ``freezer_es_address``, ``freezer_es_port``