Deploy mistral-event-engine service

This PS adds deployment of mistral-event-engine service
within mistral role.

Change-Id: If187e1a49a321d1e85fb3cfff2ea037e567b30dc
This commit is contained in:
Eduardo Gonzalez 2018-08-01 18:00:41 +02:00
parent f941d47dcb
commit db4e25836d
10 changed files with 111 additions and 0 deletions

View File

@ -514,6 +514,9 @@ mistral
[mistral-engine:children]
mistral
[mistral-event-engine:children]
mistral
# Aodh
[aodh-api:children]
aodh

View File

@ -530,6 +530,9 @@ mistral
[mistral-engine:children]
mistral
[mistral-event-engine:children]
mistral
# Ceilometer
[ceilometer-central:children]
ceilometer

View File

@ -35,6 +35,17 @@ mistral_services:
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/mistral/mistral:/var/lib/kolla/venv/lib/python2.7/site-packages/mistral' if mistral_dev_mode | bool else '' }}"
dimensions: "{{ mistral_engine_dimensions }}"
mistral-event-engine:
container_name: mistral_event_engine
group: mistral-event-engine
enabled: true
image: "{{ mistral_event_engine_image_full }}"
volumes:
- "{{ node_config_directory }}/mistral-event-engine/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/mistral/mistral:/var/lib/kolla/venv/lib/python2.7/site-packages/mistral' if mistral_dev_mode | bool else '' }}"
dimensions: "{{ mistral_event_engine_dimensions }}"
mistral-executor:
container_name: mistral_executor
group: mistral-executor
@ -66,6 +77,10 @@ mistral_engine_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{
mistral_engine_tag: "{{ mistral_tag }}"
mistral_engine_image_full: "{{ mistral_engine_image }}:{{ mistral_engine_tag }}"
mistral_event_engine_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ mistral_install_type }}-mistral-event-engine"
mistral_event_engine_tag: "{{ mistral_tag }}"
mistral_event_engine_image_full: "{{ mistral_event_engine_image }}:{{ mistral_event_engine_tag }}"
mistral_executor_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ mistral_install_type }}-mistral-executor"
mistral_executor_tag: "{{ mistral_tag }}"
mistral_executor_image_full: "{{ mistral_executor_image }}:{{ mistral_executor_tag }}"
@ -75,6 +90,7 @@ mistral_api_tag: "{{ mistral_tag }}"
mistral_api_image_full: "{{ mistral_api_image }}:{{ mistral_api_tag }}"
mistral_engine_dimensions: "{{ default_container_dimensions }}"
mistral_event_engine_dimensions: "{{ default_container_dimensions }}"
mistral_executor_dimensions: "{{ default_container_dimensions }}"
mistral_api_dimensions: "{{ default_container_dimensions }}"

View File

@ -49,6 +49,32 @@
or policy_overwriting.changed | bool
or mistral_engine_container.changed | bool
- name: Restart mistral-event-engine container
vars:
service_name: "mistral-event-engine"
service: "{{ mistral_services[service_name] }}"
config_json: "{{ mistral_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
mistral_conf: "{{ mistral_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_overwriting: "{{ mistral_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
mistral_event_engine_container: "{{ check_mistral_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or mistral_conf.changed | bool
or policy_overwriting.changed | bool
or mistral_event_definitions_confs.changed | bool
or mistral_event_engine_container.changed | bool
- name: Restart mistral-executor container
vars:
service_name: "mistral-executor"

View File

@ -79,6 +79,24 @@
notify:
- Restart {{ item.key }} container
- name: Copying over event_definitions.yaml
become: true
vars:
service: "{{ mistral_services['mistral-event-engine'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/mistral-event-engine/event_definitions.yaml"
register: mistral_event_definitions_confs
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
with_first_found:
- "{{ node_custom_config }}/mistral/{{ inventory_hostname }}/event_definitions.yaml"
- "{{ node_custom_config }}/mistral/event_definitions.yaml"
- "{{ role_path }}/templates/event_definitions.yaml.j2"
notify:
- "Restart mistral-event-engine container"
- name: Check mistral containers
become: true
kolla_docker:

View File

@ -5,6 +5,7 @@
- include_tasks: config.yml
when: inventory_hostname in groups['mistral-api'] or
inventory_hostname in groups['mistral-engine'] or
inventory_hostname in groups['mistral-event-engne'] or
inventory_hostname in groups['mistral-executor']
- include_tasks: clone.yml

View File

@ -0,0 +1,6 @@
- event_types:
- compute.instance.create.*
properties:
resource_id: <% $.payload.instance_id %>
project_id: <% $.context.project_id %>
user_id: <% $.context.user_id %>

View File

@ -0,0 +1,30 @@
{
"command": "mistral-server --server event-engine --config-file /etc/mistral/mistral.conf",
"config_files": [
{
"source": "{{ container_config_directory }}/mistral.conf",
"dest": "/etc/mistral/mistral.conf",
"owner": "mistral",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/event_definitions.yaml",
"dest": "/etc/mistral/event_definitions.yaml",
"owner": "mistral",
"perm": "0600"
}{% if mistral_policy_file is defined %},
{
"source": "{{ container_config_directory }}/{{ mistral_policy_file }}",
"dest": "/etc/mistral/{{ mistral_policy_file }}",
"owner": "mistral",
"perm": "0600"
}{% endif %}
],
"permissions": [
{
"path": "/var/log/kolla/mistral",
"owner": "mistral:mistral",
"recurse": true
}
]
}

View File

@ -4,6 +4,8 @@ debug = {{ mistral_logging_debug }}
log_dir = /var/log/kolla/mistral
{% if service_name == 'mistral-engine' %}
log_file = /var/log/kolla/mistral/mistral-engine.log
{% elif service_name == 'mistral-event-engine' %}
log_file = /var/log/kolla/mistral/mistral-event-engine.log
{% elif service_name == 'mistral-executor' %}
log_file = /var/log/kolla/mistral/mistral-executor.log
{% endif %}
@ -22,6 +24,9 @@ api_workers = {{ openstack_service_workers }}
{% elif service_name == 'mistral-engine' %}
[engine]
host = {{ api_interface_address }}
{% elif service_name == 'mistral-event-engine' %}
[event_engine]
host = {{ api_interface_address }}
{% elif service_name == 'mistral-executor' %}
[executor]
host = {{ api_interface_address }}

View File

@ -476,6 +476,9 @@ mistral
[mistral-engine:children]
mistral
[mistral-event-engine:children]
mistral
# Aodh
[aodh-api:children]
aodh