Add Masakari Ansible role

Masakari provides Instances High Availability Service for
OpenStack clouds by automatically recovering failed Instances.

Depends-On: https://review.openstack.org/#/c/615469/
Change-Id: I0b3457232ee86576022cff64eb2e227ff9bbf0aa
Implements: blueprint ansible-masakari
Co-Authored-By: Gaëtan Trellu <gaetan.trellu@incloudus.com>
This commit is contained in:
Kien Nguyen 2018-11-06 10:20:02 +07:00 committed by Gaëtan Trellu
parent 2b78c831fd
commit 577bb50a04
43 changed files with 828 additions and 0 deletions

@ -62,6 +62,7 @@ Kolla-Ansible deploys containers for the following OpenStack projects:
- `Kuryr <https://docs.openstack.org/kuryr/latest/>`__
- `Magnum <https://docs.openstack.org/magnum/latest/>`__
- `Manila <https://docs.openstack.org/manila/latest/>`__
- `Masakari <https://docs.openstack.org/masakari/latest/>`__
- `Mistral <https://docs.openstack.org/mistral/latest/>`__
- `Monasca <https://docs.openstack.org/monasca-api/latest/>`__
- `Murano <https://docs.openstack.org/murano/latest/>`__

@ -301,6 +301,8 @@ mariadb_wsrep_port: "4567"
mariadb_ist_port: "4568"
mariadb_sst_port: "4444"
masakari_api_port: "15868"
memcached_port: "11211"
mistral_api_port: "8989"
@ -558,6 +560,7 @@ enable_horizon_ironic: "{{ enable_ironic | bool }}"
enable_horizon_karbor: "{{ enable_karbor | bool }}"
enable_horizon_magnum: "{{ enable_magnum | bool }}"
enable_horizon_manila: "{{ enable_manila | bool }}"
enable_horizon_masakari: "{{ enable_masakari | bool }}"
enable_horizon_mistral: "{{ enable_mistral | bool }}"
enable_horizon_murano: "{{ enable_murano | bool }}"
enable_horizon_neutron_vpnaas: "{{ enable_neutron_vpnaas | bool }}"
@ -588,6 +591,7 @@ enable_manila_backend_generic: "no"
enable_manila_backend_hnas: "no"
enable_manila_backend_cephfs_native: "no"
enable_manila_backend_cephfs_nfs: "no"
enable_masakari: "no"
enable_mistral: "no"
enable_monasca: "no"
enable_mongodb: "no"

@ -756,3 +756,12 @@ monitoring
[prometheus-elasticsearch-exporter:children]
elasticsearch
[masakari-api:children]
control
[masakari-engine:children]
control
[masakari-monitors:children]
compute

@ -775,3 +775,12 @@ monitoring
[prometheus-elasticsearch-exporter:children]
elasticsearch
[masakari-api:children]
control
[masakari-engine:children]
control
[masakari-monitors:children]
compute

@ -267,6 +267,7 @@
- { name: "magnum", enabled: "{{ enable_magnum }}" }
- { name: "manila", enabled: "{{ enable_manila }}" }
- { name: "mariadb", enabled: "{{ enable_mariadb }}" }
- { name: "masakari", enabled: "{{ enable_masakari }}" }
- { name: "mistral", enabled: "{{ enable_mistral }}" }
- { name: "monasca", enabled: "{{ enable_monasca }}" }
- { name: "mongodb", enabled: "{{ enable_mongodb }}" }

@ -176,6 +176,11 @@
pattern ^(monasca-api|monasca-notification|monasca-persister|agent-collector|agent-forwarder|agent-statsd)$
tag openstack_python
</rule>
<rule>
key programname
pattern ^(masakari-engine|masakari-api)$
tag openstack_python
</rule>
<rule>
key programname
pattern .+

@ -22,6 +22,7 @@
( 'kuryr', enable_kuryr ),
( 'magnum', enable_magnum ),
( 'manila', enable_manila ),
( 'masakari', enable_masakari ),
( 'mistral', enable_mistral ),
( 'monasca', enable_monasca ),
( 'mongodb', enable_mongodb ),

@ -0,0 +1,3 @@
"/var/log/kolla/masakari/*.log"
{
}

@ -35,6 +35,7 @@
( 'magnum', enable_magnum ),
( 'manila', enable_manila ),
( 'mariadb', enable_mariadb ),
( 'masakari', enable_masakari ),
( 'mistral', enable_mistral ),
( 'monasca', enable_monasca ),
( 'mongodb', enable_mongodb ),

@ -517,6 +517,19 @@
- haproxy_stat.find('mariadb') == -1
- "host_running_haproxy == 'None'"
- name: Checking free port for Masakari API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ masakari_api_port }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- enable_masakari | bool
- inventory_hostname in groups['haproxy']
- haproxy_stat.find('masakari_api') == -1
- "host_running_haproxy == 'None'"
- name: Checking free port for Mistral API HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"

@ -19,6 +19,7 @@ horizon_services:
ENABLE_KARBOR: "{{ 'yes' if enable_horizon_karbor | bool else 'no' }}"
ENABLE_MAGNUM: "{{ 'yes' if enable_horizon_magnum | bool else 'no' }}"
ENABLE_MANILA: "{{ 'yes' if enable_horizon_manila | bool else 'no' }}"
ENABLE_MASAKARI: "{{ 'yes' if enable_horizon_masakari | bool else 'no' }}"
ENABLE_MISTRAL: "{{ 'yes' if enable_horizon_mistral | bool else 'no' }}"
ENABLE_MURANO: "{{ 'yes' if enable_horizon_murano | bool else 'no' }}"
ENABLE_NEUTRON_VPNAAS: "{{ 'yes' if enable_horizon_neutron_vpnaas | bool else 'no' }}"

@ -33,6 +33,7 @@
- { name: "karbor", enabled: "{{ enable_horizon_karbor }}" }
- { name: "magnum", enabled: "{{ enable_horizon_magnum }}" }
- { name: "manila", enabled: "{{ enable_horizon_manila }}" }
- { name: "masakari", enabled: "{{ enable_horizon_masakari }}" }
- { name: "mistral", enabled: "{{ enable_horizon_mistral }}" }
- { name: "murano", enabled: "{{ enable_horizon_murano }}" }
- { name: "neutron", enabled: "{{ enable_neutron_horizon_policy_file }}" }

@ -14,6 +14,7 @@
( 'karbor', enable_horizon_karbor ),
( 'magnum', enable_horizon_magnum ),
( 'manila', enable_horizon_manila ),
( 'masakari', enable_horizon_masakari ),
( 'mistral', enable_horizon_mistral ),
( 'murano', enable_horizon_murano ),
( 'neutron', enable_neutron ),

@ -0,0 +1,117 @@
---
project_name: "masakari"
masakari_services:
masakari-api:
container_name: masakari_api
group: masakari-api
enabled: true
image: "{{ masakari_api_image_full }}"
volumes: "{{ masakari_api_default_volumes + masakari_api_extra_volumes }}"
dimensions: "{{ masakari_api_dimensions }}"
haproxy:
masakari_api:
enabled: "{{ enable_masakari }}"
mode: "http"
external: false
port: "{{ masakari_api_port }}"
masakari_api_external:
enabled: "{{ enable_masakari }}"
mode: "http"
external: true
port: "{{ masakari_api_port }}"
masakari-engine:
container_name: masakari_engine
group: masakari-engine
enabled: true
image: "{{ masakari_engine_image_full }}"
volumes: "{{ masakari_engine_default_volumes + masakari_engine_extra_volumes }}"
dimensions: "{{ masakari_engine_dimensions }}"
masakari-instancemonitor:
container_name: masakari_instancemonitor
group: masakari-monitors
enabled: true
image: "{{ masakari_monitors_image_full }}"
volumes: "{{ masakari_instancemonitor_default_volumes + masakari_instancemonitor_extra_volumes }}"
privileged: True
dimensions: "{{ masakari_monitors_dimensions }}"
####################
# Database
####################
masakari_database_name: "masakari"
masakari_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}masakari{% endif %}"
masakari_database_address: "{{ database_address }}:{{ database_port }}"
####################
# Docker
####################
masakari_install_type: "{{ kolla_install_type }}"
masakari_tag: "{{ openstack_release }}"
masakari_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ masakari_install_type }}-masakari-api"
masakari_api_tag: "{{ masakari_tag }}"
masakari_api_image_full: "{{ masakari_api_image }}:{{ masakari_api_tag }}"
masakari_engine_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ masakari_install_type }}-masakari-engine"
masakari_engine_tag: "{{ masakari_tag }}"
masakari_engine_image_full: "{{ masakari_engine_image }}:{{ masakari_engine_tag }}"
masakari_monitors_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ masakari_install_type }}-masakari-monitors"
masakari_monitors_tag: "{{ masakari_tag }}"
masakari_monitors_image_full: "{{ masakari_monitors_image }}:{{ masakari_monitors_tag }}"
masakari_api_dimensions: "{{ default_container_dimensions }}"
masakari_engine_dimensions: "{{ default_container_dimensions }}"
masakari_monitors_dimensions: "{{ default_container_dimensions }}"
masakari_extra_volumes: "{{ default_extra_volumes }}"
masakari_api_extra_volumes: "{{ masakari_extra_volumes }}"
masakari_engine_extra_volumes: "{{ masakari_extra_volumes }}"
masakari_instancemonitor_extra_volumes: "{{ masakari_extra_volumes }}"
masakari_api_default_volumes:
- "{{ node_config_directory }}/masakari-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/masakari/masakari:/var/lib/kolla/venv/lib/python2.7/site-packages/masakari' if masakari_dev_mode | bool else '' }}"
masakari_engine_default_volumes:
- "{{ node_config_directory }}/masakari-engine/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/masakari/masakari:/var/lib/kolla/venv/lib/python2.7/site-packages/masakari' if masakari_dev_mode | bool else '' }}"
- "masakari:/var/lib/masakari/"
masakari_instancemonitor_default_volumes:
- "{{ node_config_directory }}/masakari-engine/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/masakari/masakari:/var/lib/kolla/venv/lib/python2.7/site-packages/masakari' if masakari_dev_mode | bool else '' }}"
####################
# OpenStack
####################
masakari_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ masakari_api_port }}"
masakari_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ masakari_api_port }}"
masakari_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ masakari_api_port }}"
masakari_logging_debug: "{{ openstack_logging_debug }}"
masakari_keystone_user: "masakari"
openstack_masakari_auth: "{{ openstack_auth }}"
####################
# Kolla
####################
masakari_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
masakari_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
masakari_dev_mode: "{{ kolla_dev_mode }}"
masakari_source_version: "{{ kolla_source_version }}"
masakari_monitors_git_repository: "{{ kolla_dev_repos_git }}/masakarimonitors"
masakari_monitors_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
masakari_monitors_dev_mode: "{{ kolla_dev_mode }}"
masakari_monitors_source_version: "{{ kolla_source_version }}"

@ -0,0 +1,48 @@
---
- name: Restart masakari-api container
vars:
service_name: "masakari-api"
service: "{{ masakari_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- name: Restart masakari-engine container
vars:
service_name: "masakari-engine"
service: "{{ masakari_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- name: Restart masakari-instancemonitor container
vars:
service_name: "masakari-instancemonitor"
service: "{{ masakari_services[service_name] }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged | default(True) }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"

@ -0,0 +1,3 @@
---
dependencies:
- { role: common }

@ -0,0 +1,36 @@
---
- name: Creating Masakari database
become: true
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: "{{ masakari_database_name }}"
run_once: True
delegate_to: "{{ groups['masakari-api'][0] }}"
when:
- not use_preconfigured_databases | bool
- name: Creating Masakari database user and setting permissions
become: true
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: "{{ masakari_database_user }}"
password: "{{ masakari_database_password }}"
host: "%"
priv: "{{ masakari_database_name }}.*:ALL"
append_privs: "yes"
run_once: True
delegate_to: "{{ groups['masakari-api'][0] }}"
when:
- not use_preconfigured_databases | bool
- include_tasks: bootstrap_service.yml

@ -0,0 +1,20 @@
---
- name: Running Masakari bootstrap container
vars:
masakari_api: "{{ masakari_services['masakari-api'] }}"
become: true
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
detach: False
environment:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ masakari_api.image }}"
labels:
BOOTSTRAP:
name: "bootstrap_masakari"
restart_policy: "no"
volumes: "{{ masakari_api.volumes|reject('equalto', '')|list }}"
run_once: True
delegate_to: "{{ groups[masakari_api.group][0] }}"

@ -0,0 +1 @@
---

@ -0,0 +1,14 @@
---
- name: Cloning masakari source repository for development
git:
repo: "{{ masakari_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}"
update: "{{ masakari_dev_repos_pull }}"
version: "{{ masakari_source_version }}"
- name: Cloning masakarimonitors source repository for development
git:
repo: "{{ masakarimonitors_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/masakarimonitors"
update: "{{ masakarimonitors_dev_repos_pull }}"
version: "{{ masakarimonitors_source_version }}"

@ -0,0 +1,145 @@
---
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory"
owner: "{{ config_owner_user }}"
group: "{{ config_owner_group }}"
mode: "0770"
become: true
when:
- item.value.enabled | bool
- inventory_hostname in groups[item.value.group]
with_dict: "{{ masakari_services }}"
- name: Check if policies shall be overwritten
local_action: stat path="{{ item }}"
run_once: True
register: masakari_policy
with_first_found:
- files: "{{ supported_policy_format_list }}"
paths:
- "{{ node_custom_config }}/masakari/"
skip: true
- name: Set masakari policy file
set_fact:
masakari_policy_file: "{{ masakari_policy.results.0.stat.path | basename }}"
masakari_policy_file_path: "{{ masakari_policy.results.0.stat.path }}"
when:
- masakari_policy.results
- name: Copying over existing policy file
template:
src: "{{ masakari_policy_file_path }}"
dest: "{{ node_config_directory }}/{{ item }}/{{ masakari_policy_file }}"
mode: "0660"
become: true
when:
- masakari_policy_file is defined
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ masakari_services }}"
notify:
- Restart {{ item.key }} container
- name: Copying over config.json files for services
template:
src: "{{ item.key }}.json.j2"
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
mode: "0660"
become: true
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ masakari_services }}"
notify:
- Restart {{ item.key }} container
- name: Copying over masakari.conf
vars:
service: "{{ item.key }}"
merge_configs:
sources:
- "{{ role_path }}/templates/masakari.conf.j2"
- "{{ node_custom_config }}/global.conf"
- "{{ node_custom_config }}/masakari.conf"
- "{{ node_custom_config }}/masakari/{{ item.key }}.conf"
- "{{ node_custom_config }}/masakari/{{ inventory_hostname }}/masakari.conf"
dest: "{{ node_config_directory }}/{{ item.key }}/masakari.conf"
mode: "0660"
become: true
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ masakari_services }}"
notify:
- Restart {{ item.key }} container
- name: Copying over masakari-monitors.conf
vars:
service: "{{ item.key }}"
merge_configs:
sources:
- "{{ role_path }}/templates/masakari-monitors.conf.j2"
- "{{ node_custom_config }}/global.conf"
- "{{ node_custom_config }}/masakari/{{ item.key }}.conf"
- "{{ node_custom_config }}/masakari/masakari-monitors.conf"
- "{{ node_custom_config }}/masakari/{{ inventory_hostname }}/masakari-monitors.conf"
dest: "{{ node_config_directory }}/{{ item.key }}/masakari-monitors.conf"
mode: "0660"
become: true
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ masakari_services }}"
notify:
- Restart {{ item.key }} container
- name: Copying over wsgi-masakari file for services
vars:
service: "{{ masakari_services['masakari-api'] }}"
template:
src: "wsgi-masakari.conf.j2"
dest: "{{ node_config_directory }}/masakari-api/wsgi-masakari.conf"
mode: "0660"
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart masakari-api container
- name: Copying over masakari-api-paste.ini
vars:
service: "{{ masakari_services['masakari-api'] }}"
merge_configs:
sources:
- "{{ role_path }}/templates/masakari-api-paste.ini.j2"
- "{{ node_custom_config }}/masakari/masakari-api/masakari-api-paste.ini"
dest: "{{ node_config_directory }}/masakari-api/masakari-api-paste.ini"
mode: "0660"
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart masakari-api container
- name: Check masakari containers
become: true
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
privileged: "{{ item.value.privileged | default(False) }}"
volumes: "{{ item.value.volumes | reject('equalto', '') | list }}"
dimensions: "{{ item.value.dimensions }}"
when:
- kolla_action != "config"
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ masakari_services }}"
notify:
- Restart {{ item.key }} container

@ -0,0 +1,17 @@
---
- include_tasks: register.yml
when: inventory_hostname in groups['masakari-api']
- include_tasks: config.yml
when: inventory_hostname in groups['masakari-api'] or
inventory_hostname in groups['masakari-engine'] or
inventory_hostname in groups['masakari-monitors']
- include_tasks: clone.yml
when: masakari_dev_mode | bool
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['masakari-api']
- name: Flush handlers
meta: flush_handlers

@ -0,0 +1,7 @@
---
- name: "Configure haproxy for {{ project_name }}"
import_role:
role: haproxy-config
vars:
project_services: "{{ masakari_services }}"
tags: always

@ -0,0 +1,2 @@
---
- include_tasks: "{{ kolla_action }}.yml"

@ -0,0 +1,18 @@
---
- name: Get container facts
become: true
kolla_container_facts:
name:
- masakari_api
register: container_facts
- name: Checking free port for Masakari API
wait_for:
host: "{{ api_interface_address }}"
port: "{{ masakari_api_port }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- container_facts['masakari_api'] is not defined
- inventory_hostname in groups['masakari-api']

@ -0,0 +1,11 @@
---
- name: Pulling masakari images
become: true
kolla_docker:
action: "pull_image"
common_options: "{{ docker_common_options }}"
image: "{{ item.value.image }}"
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ masakari_services }}"

@ -0,0 +1,2 @@
---
- include_tasks: deploy.yml

@ -0,0 +1,34 @@
---
- name: Creating the Masakari service and endpoint
become: true
kolla_toolbox:
module_name: "kolla_keystone_service"
module_args:
service_name: "masakari"
service_type: "instance-ha"
description: "OpenStack High Availability"
endpoint_region: "{{ openstack_region_name }}"
url: "{{ item.url }}"
interface: "{{ item.interface }}"
region_name: "{{ openstack_region_name }}"
auth: "{{ openstack_masakari_auth }}"
endpoint_type: "{{ openstack_interface }}"
run_once: True
with_items:
- {'interface': 'admin', 'url': '{{ masakari_admin_endpoint }}'}
- {'interface': 'internal', 'url': '{{ masakari_internal_endpoint }}'}
- {'interface': 'public', 'url': '{{ masakari_public_endpoint }}'}
- name: Creating the Masakari project, user, and role
become: true
kolla_toolbox:
module_name: "kolla_keystone_user"
module_args:
project: "service"
user: "{{ masakari_keystone_user }}"
password: "{{ masakari_keystone_password }}"
role: "admin"
region_name: "{{ openstack_region_name }}"
auth: "{{ openstack_masakari_auth }}"
endpoint_type: "{{ openstack_interface }}"
run_once: True

@ -0,0 +1,6 @@
---
- import_role:
role: service-stop
vars:
project_services: "{{ masakari_services }}"
service_name: "{{ project_name }}"

@ -0,0 +1,7 @@
---
- include_tasks: config.yml
- include_tasks: bootstrap_service.yml
- name: Flush handlers
meta: flush_handlers

@ -0,0 +1,44 @@
[composite:masakari_api]
use = call:masakari.api.urlmap:urlmap_factory
/: apiversions
/v1: masakari_api_v1
[composite:masakari_api_v1]
use = call:masakari.api.auth:pipeline_factory_v1
keystone = cors http_proxy_to_wsgi request_id faultwrap sizelimit authtoken keystonecontext osapi_masakari_app_v1
# filters
[filter:cors]
paste.filter_factory = oslo_middleware.cors:filter_factory
oslo_config_project = masakari
[filter:http_proxy_to_wsgi]
paste.filter_factory = oslo_middleware.http_proxy_to_wsgi:HTTPProxyToWSGI.factory
[filter:request_id]
paste.filter_factory = oslo_middleware:RequestId.factory
[filter:faultwrap]
paste.filter_factory = masakari.api.openstack:FaultWrapper.factory
[filter:sizelimit]
paste.filter_factory = oslo_middleware:RequestBodySizeLimiter.factory
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
[filter:keystonecontext]
paste.filter_factory = masakari.api.auth:MasakariKeystoneContext.factory
[filter:noauth2]
paste.filter_factory = masakari.api.auth:NoAuthMiddleware.factory
# apps
[app:osapi_masakari_app_v1]
paste.app_factory = masakari.api.openstack.ha:APIRouterV1.factory
[pipeline:apiversions]
pipeline = faultwrap http_proxy_to_wsgi apiversionsapp
[app:apiversionsapp]
paste.app_factory = masakari.api.openstack.ha.versions:Versions.factory

@ -0,0 +1,38 @@
{% set masakari_cmd = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
{% set masakari_dir = 'apache2/conf-enabled' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd/conf.d' %}
{
"command": "{{ masakari_cmd }} -DFOREGROUND",
"config_files": [
{
"source": "{{ container_config_directory }}/masakari.conf",
"dest": "/etc/masakari/masakari.conf",
"owner": "masakari",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/masakari-api-paste.ini",
"dest": "/etc/masakari/api-paste.ini",
"owner": "masakari",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/wsgi-masakari.conf",
"dest": "/etc/{{ masakari_dir }}/wsgi-masakari.conf",
"owner": "root",
"perm": "0600"
}{% if masakari_policy_file is defined %},
{
"source": "{{ container_config_directory }}/{{ masakari_policy_file }}",
"dest": "/etc/masakari/{{ masakari_policy_file }}",
"owner": "masakari",
"perm": "0600"
}{% endif %}
],
"permissions": [
{
"path": "/var/log/kolla/masakari",
"owner": "masakari:masakari",
"recurse": true
}
]
}

@ -0,0 +1,29 @@
{
"command": "masakari-engine --config-file /etc/masakari/masakari.conf",
"config_files": [
{
"source": "{{ container_config_directory }}/masakari.conf",
"dest": "/etc/masakari/masakari.conf",
"owner": "masakari",
"perm": "0600"
}{% if masakari_policy_file is defined %},
{
"source": "{{ container_config_directory }}/{{ masakari_policy_file }}",
"dest": "/etc/masakari/{{ masakari_policy_file }}",
"owner": "masakari",
"perm": "0600"
}{% endif %}
],
"permissions": [
{
"path": "/var/lib/masakari",
"owner": "masakari:masakari",
"recurse": true
},
{
"path": "/var/log/kolla/masakari",
"owner": "masakari:masakari",
"recurse": true
}
]
}

@ -0,0 +1,18 @@
{
"command": "masakari-instancemonitor --config-file /etc/masakari-monitors/masakari-monitors.conf",
"config_files": [
{
"source": "{{ container_config_directory }}/masakari-monitors.conf",
"dest": "/etc/masakari-monitors/masakari-monitors.conf",
"owner": "masakari",
"perm": "0600"
}
],
"permissions": [
{
"path": "/var/log/kolla/masakari",
"owner": "masakari:masakari",
"recurse": true
}
]
}

@ -0,0 +1,15 @@
[DEFAULT]
debug = {{ masakari_logging_debug }}
log_dir = /var/log/kolla/masakari
[api]
region = {{ openstack_region_name }}
auth_url = {{ keystone_admin_url }}
user_domain_id = {{ default_user_domain_id }}
project_name = service
project_domain_id = {{ default_project_domain_id }}
username = {{ masakari_keystone_user }}
password = {{ masakari_keystone_password }}
[libvirt]
connection_uri = "qemu+tcp://{{ migration_interface_address }}/system"

@ -0,0 +1,53 @@
[DEFAULT]
debug = {{ masakari_logging_debug }}
log_dir = /var/log/kolla/masakari
masakari_api_listen = {{ api_interface_address }}
masakari_api_listen_port = {{ masakari_api_port }}
enabled_apis = masakari_api
state_path = /var/lib/masakari
transport_url = {{ rpc_transport_url }}
os_user_domain_name = {{ default_user_domain_id }}
os_project_domain_name = {{ default_project_domain_id }}
os_privileged_user_tenant = service
os_privileged_user_auth_url = {{ keystone_internal_url }}/v3
os_privileged_user_name = {{ nova_keystone_user }}
os_privileged_user_password = {{ nova_keystone_password }}
[database]
connection = mysql+pymysql://{{ masakari_database_user }}:{{ masakari_database_password }}@{{ masakari_database_address }}/{{ masakari_database_name }}
max_retries = -1
[keystone_authtoken]
www_authenticate_uri = {{ keystone_internal_url }}/v3
auth_url = {{ keystone_admin_url }}
auth_type = password
project_domain_name = {{ default_project_domain_name }}
user_domain_name = {{ default_user_domain_name }}
project_name = service
username = {{ masakari_keystone_user }}
password = {{ masakari_keystone_password }}
service_token_roles_required = True
region_name = {{ openstack_region_name }}
{% if enable_memcached | bool %}
memcache_security_strategy = ENCRYPT
memcache_secret_key = {{ memcache_secret_key }}
memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}
{% endif %}
[oslo_messaging_notifications]
transport_url = {{ notify_transport_url }}
{% if enable_ceilometer | bool %}
driver = messagingv2
topics = notifications
{% else %}
driver = noop
{% endif %}
[oslo_middleware]
enable_proxy_headers_parsing = True
{% if masakari_policy_file is defined %}
[oslo_policy]
policy_file = {{ masakari_policy_file }}
{% endif %}

@ -0,0 +1,30 @@
{% if kolla_base_distro in ['debian', 'ubuntu'] %}
{% set python_path = '/usr/lib/python3/dist-packages' if masakari_install_type == 'binary' else '/var/lib/kolla/venv/lib/python' + distro_python_version + '/site-packages' %}
{% else %}
{% set python_path = '/usr/lib/python2.7/site-packages' if masakari_install_type == 'binary' else '/var/lib/kolla/venv/lib/python' + distro_python_version + '/site-packages' %}
{% endif %}
{% set binary_path = '/usr/bin' if masakari_install_type == 'binary' else '/var/lib/kolla/venv/bin' %}
Listen {{ api_interface_address }}:{{ masakari_api_port }}
ServerSignature Off
ServerTokens Prod
TraceEnable off
<Directory "{{ binary_path }}">
<FilesMatch "^masakari-wsgi$">
Options Indexes FollowSymLinks MultiViews
Require all granted
</FilesMatch>
</Directory>
<VirtualHost *:{{ masakari_api_port }}>
## Logging
ErrorLog "/var/log/kolla/masakari/masakari_wsgi_error.log"
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat
CustomLog "/var/log/kolla/masakari/masakari_wsgi_access.log" logformat
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess masakari group=masakari processes={{ openstack_service_workers }} threads=1 user=masakari python-path={{ python_path }}
WSGIProcessGroup masakari
WSGIScriptAlias / "{{ binary_path }}/masakari-wsgi"
</VirtualHost>

@ -53,6 +53,7 @@
- enable_magnum_{{ enable_magnum | bool }}
- enable_manila_{{ enable_manila | bool }}
- enable_mariadb_{{ enable_mariadb | bool }}
- enable_masakari_{{ enable_masakari | bool }}
- enable_memcached_{{ enable_memcached | bool }}
- enable_mistral_{{ enable_mistral | bool }}
- enable_monasca_{{ enable_monasca | bool }}
@ -244,6 +245,11 @@
tasks_from: loadbalancer
tags: mariadb
when: enable_mariadb | bool
- include_role:
role: masakari
tasks_from: loadbalancer
tags: masakari
when: enable_masakari | bool
- include_role:
role: memcached
tasks_from: loadbalancer
@ -1241,3 +1247,16 @@
- { role: blazar,
tags: blazar,
when: enable_blazar | bool }
- name: Apply role masakari
gather_facts: false
hosts:
- masakari-api
- masakari-engine
- masakari-monitors
- '&enable_masakari_True'
serial: '{{ kolla_serial|default("0") }}'
roles:
- { role: masakari,
tags: masakari,
when: enable_masakari | bool }

@ -9,6 +9,7 @@ compute services like HyperV, XenServer and so on.
:maxdepth: 1
hyperv-guide
masakari-guide
nova-fake-driver
qinling-guide
vmware-guide

@ -0,0 +1,34 @@
.. _masakari-guide:
=============================================
Masakari - Virtual Machines High Availability
=============================================
Overview
~~~~~~~~
Masakari provides Instances High Availability Service for OpenStack clouds by
automatically recovering failed Instances. Currently, Masakari can recover
KVM-based Virtual Machine(VM)s from failure events such as VM process down,
provisioning process down, and nova-compute host failure. Masakari also
provides an API service to manage and control the automated rescue mechanism.
Kolla deploys Masakari API, Masakari Engine and Masakari Instance Monitor
containers which are the main Masakari components only if ``enable_masakari``
is set in ``/etc/kolla/globals.yml``.
Connection URI to libvirtd
~~~~~~~~~~~~~~~~~~~~~~~~~~
By default ``masakari-instancemonitor`` will connect to ``libvirt`` daemon
using ``qemu+tcp://`` connection URI to get events of KVM-based virtual
machines.
The setting is overridable using custom config, put the content in
``/etc/kolla/config/masakari/masakari-monitors.conf``.
.. code-block:: ini
[libvirt]
connection_uri = "xen://{{ migration_interface_address }}/system"

@ -242,6 +242,7 @@
#enable_horizon_karbor: "{{ enable_karbor | bool }}"
#enable_horizon_magnum: "{{ enable_magnum | bool }}"
#enable_horizon_manila: "{{ enable_manila | bool }}"
#enable_horizon_masakari: "{{ enable_masakari | bool }}"
#enable_horizon_mistral: "{{ enable_mistral | bool }}"
#enable_horizon_murano: "{{ enable_murano | bool }}"
#enable_horizon_neutron_vpnaas: "{{ enable_neutron_vpnaas | bool }}"
@ -270,6 +271,7 @@
#enable_manila_backend_hnas: "no"
#enable_manila_backend_cephfs_native: "no"
#enable_manila_backend_cephfs_nfs: "no"
#enable_masakari: "no"
#enable_mistral: "no"
#enable_monasca: "no"
#enable_mongodb: "no"

@ -193,6 +193,9 @@ zun_keystone_password:
vitrage_database_password:
vitrage_keystone_password:
masakari_database_password:
masakari_keystone_password:
memcache_secret_key:
qinling_database_password:

@ -0,0 +1,4 @@
---
features:
- Ansible role and shared configuration to deploy
Masakari with Kolla-ansible.