From 7ce05f9782c9b3ab1e9be6c1a24d44ae599b32f0 Mon Sep 17 00:00:00 2001
From: zhubingbing <1392607554@qq.com>
Date: Thu, 4 Aug 2016 06:51:11 +0000
Subject: [PATCH] Add aodh role
Partially-Implements: blueprint ansible-aodh
Change-Id: I9e20f4bf5e7d8f37f243ae15746e2b7bb49eb20c
---
ansible/group_vars/all.yml | 3 +
ansible/inventory/all-in-one | 17 ++++
ansible/inventory/multinode | 16 ++++
ansible/roles/aodh/defaults/main.yml | 43 ++++++++++
ansible/roles/aodh/meta/main.yml | 3 +
ansible/roles/aodh/tasks/bootstrap.yml | 41 ++++++++++
.../roles/aodh/tasks/bootstrap_service.yml | 21 +++++
ansible/roles/aodh/tasks/config.yml | 50 ++++++++++++
ansible/roles/aodh/tasks/deploy.yml | 18 +++++
ansible/roles/aodh/tasks/do_reconfigure.yml | 79 +++++++++++++++++++
ansible/roles/aodh/tasks/main.yml | 2 +
ansible/roles/aodh/tasks/pull.yml | 28 +++++++
ansible/roles/aodh/tasks/reconfigure.yml | 7 ++
ansible/roles/aodh/tasks/register.yml | 40 ++++++++++
ansible/roles/aodh/tasks/start.yml | 45 +++++++++++
ansible/roles/aodh/templates/aodh-api.json.j2 | 25 ++++++
.../aodh/templates/aodh-evaluator.json.j2 | 11 +++
.../aodh/templates/aodh-listener.json.j2 | 11 +++
.../aodh/templates/aodh-notifier.json.j2 | 11 +++
ansible/roles/aodh/templates/aodh.conf.j2 | 45 +++++++++++
.../roles/aodh/templates/wsgi-aodh.conf.j2 | 25 ++++++
ansible/roles/common/tasks/config.yml | 2 +
.../templates/cron-logrotate-aodh.conf.j2 | 3 +
ansible/roles/common/templates/cron.json.j2 | 2 +-
.../roles/common/templates/heka-aodh.toml.j2 | 13 +++
ansible/site.yml | 9 +++
etc/kolla/passwords.yml | 3 +
.../notes/add-aodh-a5de8a339f25c1a2.yaml | 3 +
28 files changed, 575 insertions(+), 1 deletion(-)
create mode 100644 ansible/roles/aodh/defaults/main.yml
create mode 100644 ansible/roles/aodh/meta/main.yml
create mode 100644 ansible/roles/aodh/tasks/bootstrap.yml
create mode 100644 ansible/roles/aodh/tasks/bootstrap_service.yml
create mode 100644 ansible/roles/aodh/tasks/config.yml
create mode 100644 ansible/roles/aodh/tasks/deploy.yml
create mode 100644 ansible/roles/aodh/tasks/do_reconfigure.yml
create mode 100644 ansible/roles/aodh/tasks/main.yml
create mode 100644 ansible/roles/aodh/tasks/pull.yml
create mode 100644 ansible/roles/aodh/tasks/reconfigure.yml
create mode 100644 ansible/roles/aodh/tasks/register.yml
create mode 100644 ansible/roles/aodh/tasks/start.yml
create mode 100644 ansible/roles/aodh/templates/aodh-api.json.j2
create mode 100644 ansible/roles/aodh/templates/aodh-evaluator.json.j2
create mode 100644 ansible/roles/aodh/templates/aodh-listener.json.j2
create mode 100644 ansible/roles/aodh/templates/aodh-notifier.json.j2
create mode 100644 ansible/roles/aodh/templates/aodh.conf.j2
create mode 100644 ansible/roles/aodh/templates/wsgi-aodh.conf.j2
create mode 100644 ansible/roles/common/templates/cron-logrotate-aodh.conf.j2
create mode 100644 ansible/roles/common/templates/heka-aodh.toml.j2
create mode 100644 releasenotes/notes/add-aodh-a5de8a339f25c1a2.yaml
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index 2f6c55b6fa..910429f583 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -110,6 +110,8 @@ tunnel_interface: "{{ network_interface }}"
neutron_plugin_agent: "openvswitch"
# The default ports used by each service.
+aodh_api_port: "8042"
+
ceilometer_api_port: "8777"
iscsi_port: "3260"
@@ -213,6 +215,7 @@ enable_nova: "yes"
enable_rabbitmq: "yes"
# Additional optional OpenStack services are specified here
+enable_aodh: "no"
enable_ceilometer: "no"
enable_central_logging: "no"
enable_ceph: "no"
diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one
index 507a30b060..5fd2c8b2f5 100644
--- a/ansible/inventory/all-in-one
+++ b/ansible/inventory/all-in-one
@@ -87,6 +87,10 @@ control
[ceilometer:children]
control
+[aodh:children]
+control
+
+# Tempest
[tempest:children]
control
@@ -235,6 +239,19 @@ mistral
[mistral-engine:children]
mistral
+# Aodh
+[aodh-api:children]
+aodh
+
+[aodh-evaluator:children]
+aodh
+
+[aodh-listener:children]
+aodh
+
+[aodh-notifier:children]
+aodh
+
# Ceilometer
[ceilometer-api:children]
ceilometer
diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode
index d1f9bf0657..1de7afb289 100644
--- a/ansible/inventory/multinode
+++ b/ansible/inventory/multinode
@@ -99,6 +99,9 @@ control
[ceilometer:children]
control
+[aodh:children]
+control
+
# Tempest
[tempest:children]
control
@@ -264,6 +267,19 @@ ceilometer
[ceilometer-compute:children]
compute
+# Aodh
+[aodh-api:children]
+aodh
+
+[aodh-evaluator:children]
+aodh
+
+[aodh-listener:children]
+aodh
+
+[aodh-notifier:children]
+aodh
+
# Multipathd
[multipathd:children]
compute
diff --git a/ansible/roles/aodh/defaults/main.yml b/ansible/roles/aodh/defaults/main.yml
new file mode 100644
index 0000000000..66e2b94590
--- /dev/null
+++ b/ansible/roles/aodh/defaults/main.yml
@@ -0,0 +1,43 @@
+---
+project_name: "aodh"
+
+
+####################
+# Database
+####################
+aodh_database_name: "aodh"
+aodh_database_user: "aodh"
+aodh_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}"
+
+####################
+# Docker
+####################
+aodh_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-aodh-api"
+aodh_api_tag: "{{ openstack_release }}"
+aodh_api_image_full: "{{ aodh_api_image }}:{{ aodh_api_tag }}"
+
+aodh_evaluator_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-aodh-evaluator"
+aodh_evaluator_tag: "{{ openstack_release }}"
+aodh_evaluator_image_full: "{{ aodh_evaluator_image }}:{{ aodh_evaluator_tag }}"
+
+aodh_listener_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-aodh-listener"
+aodh_listener_tag: "{{ openstack_release }}"
+aodh_listener_image_full: "{{ aodh_listener_image }}:{{ aodh_listener_tag }}"
+
+aodh_notifier_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-aodh-notifier"
+aodh_notifier_tag: "{{ openstack_release }}"
+aodh_notifier_image_full: "{{ aodh_notifier_image }}:{{ aodh_notifier_tag }}"
+
+
+####################
+# OpenStack
+####################
+aodh_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ aodh_api_port }}"
+aodh_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ aodh_api_port }}"
+aodh_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ aodh_api_port }}"
+
+aodh_logging_debug: "{{ openstack_logging_debug }}"
+
+aodh_keystone_user: "aodh"
+
+openstack_aodh_auth: "{'auth_url':'{{ openstack_auth.auth_url }}','username':'{{ openstack_auth.username }}','password':'{{ openstack_auth.password }}','project_name':'{{ openstack_auth.project_name }}','domain_name':'default'}"
diff --git a/ansible/roles/aodh/meta/main.yml b/ansible/roles/aodh/meta/main.yml
new file mode 100644
index 0000000000..6b4fff8fef
--- /dev/null
+++ b/ansible/roles/aodh/meta/main.yml
@@ -0,0 +1,3 @@
+---
+dependencies:
+ - { role: common }
diff --git a/ansible/roles/aodh/tasks/bootstrap.yml b/ansible/roles/aodh/tasks/bootstrap.yml
new file mode 100644
index 0000000000..e532e899d9
--- /dev/null
+++ b/ansible/roles/aodh/tasks/bootstrap.yml
@@ -0,0 +1,41 @@
+---
+- name: Creating aodh database
+ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
+ -m mysql_db
+ -a "login_host='{{ database_address }}'
+ login_port='{{ database_port }}'
+ login_user='{{ database_user }}'
+ login_password='{{ database_password }}'
+ name='{{ aodh_database_name }}'"
+ register: database
+ changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and
+ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
+ failed_when: database.stdout.split()[2] != 'SUCCESS'
+ run_once: True
+ delegate_to: "{{ groups['aodh-api'][0] }}"
+
+- name: Reading json from variable
+ set_fact:
+ database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
+
+- name: Creating aodh database user and setting permissions
+ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
+ -m mysql_user
+ -a "login_host='{{ database_address }}'
+ login_port='{{ database_port }}'
+ login_user='{{ database_user }}'
+ login_password='{{ database_password }}'
+ name='{{ aodh_database_name }}'
+ password='{{ aodh_database_password }}'
+ host='%'
+ priv='{{ aodh_database_name }}.*:ALL'
+ append_privs='yes'"
+ register: database_user_create
+ changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and
+ (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
+ failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
+ run_once: True
+ delegate_to: "{{ groups['aodh-api'][0] }}"
+
+- include: bootstrap_service.yml
+ when: database_created
diff --git a/ansible/roles/aodh/tasks/bootstrap_service.yml b/ansible/roles/aodh/tasks/bootstrap_service.yml
new file mode 100644
index 0000000000..84ed6ec983
--- /dev/null
+++ b/ansible/roles/aodh/tasks/bootstrap_service.yml
@@ -0,0 +1,21 @@
+---
+- name: Running aodh bootstrap container
+ kolla_docker:
+ action: "start_container"
+ common_options: "{{ docker_common_options }}"
+ detach: False
+ environment:
+ KOLLA_BOOTSTRAP:
+ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
+ image: "{{ aodh_api_image_full }}"
+ labels:
+ BOOTSTRAP:
+ name: "bootstrap_aodh"
+ restart_policy: "never"
+ volumes:
+ - "{{ node_config_directory }}/aodh-api/:{{ container_config_directory }}/:ro"
+ - "aodh:/var/lib/aodh/"
+ - "/etc/localtime:/etc/localtime:ro"
+ - "kolla_logs:/var/log/kolla/"
+ run_once: True
+ delegate_to: "{{ groups['aodh-api'][0] }}"
diff --git a/ansible/roles/aodh/tasks/config.yml b/ansible/roles/aodh/tasks/config.yml
new file mode 100644
index 0000000000..6d09e4ae83
--- /dev/null
+++ b/ansible/roles/aodh/tasks/config.yml
@@ -0,0 +1,50 @@
+---
+- name: Ensuring config directories exist
+ file:
+ path: "{{ node_config_directory }}/{{ item }}"
+ state: "directory"
+ recurse: yes
+ with_items:
+ - "aodh-api"
+ - "aodh-evaluator"
+ - "aodh-listener"
+ - "aodh-notifier"
+
+- name: Copying over config.json files for services
+ template:
+ src: "{{ item }}.json.j2"
+ dest: "{{ node_config_directory }}/{{ item }}/config.json"
+ with_items:
+ - "aodh-api"
+ - "aodh-listener"
+ - "aodh-evaluator"
+ - "aodh-notifier"
+
+- name: Copying over aodh.conf
+ merge_configs:
+ vars:
+ service_name: "{{ item }}"
+ sources:
+ - "{{ role_path }}/templates/aodh.conf.j2"
+ - "{{ node_custom_config }}/global.conf"
+ - "{{ node_custom_config }}/database.conf"
+ - "{{ node_custom_config }}/messaging.conf"
+ - "{{ node_custom_config }}/aodh.conf"
+ - "{{ node_custom_config }}/aodh/{{ item }}.conf"
+ - "{{ node_custom_config }}/aodh/{{ inventory_hostname }}/{{ item }}.conf"
+ dest: "{{ node_config_directory }}/{{ item }}/aodh.conf"
+ with_items:
+ - "aodh-api"
+ - "aodh-evaluator"
+ - "aodh-listener"
+ - "aodh-notifier"
+
+- name: Copying over wsgi-aodh files for services
+ template:
+ src: "wsgi-aodh.conf.j2"
+ dest: "{{ node_config_directory }}/{{ item }}/wsgi-aodh.conf"
+ with_items:
+ - "aodh-api"
+ - "aodh-evaluator"
+ - "aodh-listener"
+ - "aodh-notifier"
diff --git a/ansible/roles/aodh/tasks/deploy.yml b/ansible/roles/aodh/tasks/deploy.yml
new file mode 100644
index 0000000000..bb4533fa0d
--- /dev/null
+++ b/ansible/roles/aodh/tasks/deploy.yml
@@ -0,0 +1,18 @@
+---
+- include: register.yml
+ when: inventory_hostname in groups['aodh-api']
+
+- include: config.yml
+ when: inventory_hostname in groups['aodh-api'] or
+ inventory_hostname in groups['aodh-evaluator'] or
+ inventory_hostname in groups['aodh-listener'] or
+ inventory_hostname in groups['aodh-notifier']
+
+- include: bootstrap.yml
+ when: inventory_hostname in groups['aodh-api']
+
+- include: start.yml
+ when: inventory_hostname in groups['aodh-api'] or
+ inventory_hostname in groups['aodh-evaluator'] or
+ inventory_hostname in groups['aodh-listener'] or
+ inventory_hostname in groups['aodh-notifier']
diff --git a/ansible/roles/aodh/tasks/do_reconfigure.yml b/ansible/roles/aodh/tasks/do_reconfigure.yml
new file mode 100644
index 0000000000..c915b500d1
--- /dev/null
+++ b/ansible/roles/aodh/tasks/do_reconfigure.yml
@@ -0,0 +1,79 @@
+---
+- name: Ensuring the containers up
+ kolla_docker:
+ name: "{{ item.name }}"
+ action: "get_container_state"
+ register: container_state
+ failed_when: container_state.Running == false
+ when: inventory_hostname in groups[item.group]
+ with_items:
+ - { name: aodh_api, group: aodh-api }
+ - { name: aodh_listener, group: aodh-listener }
+ - { name: aodh_evaluator, group: aodh-evaluator }
+ - { name: aodh_notifier, group: aodh-notifier }
+
+- include: config.yml
+
+- name: Check the configs
+ command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
+ changed_when: false
+ failed_when: false
+ register: check_results
+ when: inventory_hostname in groups[item.group]
+ with_items:
+ - { name: aodh_api, group: aodh-api }
+ - { name: aodh_listener, group: aodh-listener }
+ - { name: aodh_evaluator, group: aodh-evaluator }
+ - { name: aodh_notifier, group: aodh-notifier }
+
+# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS'
+# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE',
+# just remove the container and start again
+- name: Containers config strategy
+ kolla_docker:
+ name: "{{ item.name }}"
+ action: "get_container_env"
+ register: container_envs
+ when: inventory_hostname in groups[item.group]
+ with_items:
+ - { name: aodh_api, group: aodh-api }
+ - { name: aodh_listener, group: aodh-listener }
+ - { name: aodh_evaluator, group: aodh-evaluator }
+ - { name: aodh_notifier, group: aodh-notifier }
+
+- name: Remove the containers
+ kolla_docker:
+ name: "{{ item[0]['name'] }}"
+ action: "remove_container"
+ register: remove_containers
+ when:
+ - inventory_hostname in groups[item[0]['group']]
+ - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
+ - item[2]['rc'] == 1
+ with_together:
+ - [{ name: aodh_api, group: aodh-api },
+ { name: aodh_listener, group: aodh-listener },
+ { name: aodh_evaluator, group: aodh-evaluator },
+ { name: aodh_notifier, group: aodh-notifier }]
+ - "{{ container_envs.results }}"
+ - "{{ check_results.results }}"
+
+- include: start.yml
+ when: remove_containers.changed
+
+- name: Restart containers
+ kolla_docker:
+ name: "{{ item[0]['name'] }}"
+ action: "restart_container"
+ when:
+ - inventory_hostname in groups[item[0]['group']]
+ - config_strategy == 'COPY_ALWAYS'
+ - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
+ - item[2]['rc'] == 1
+ with_together:
+ - [{ name: aodh_api, group: aodh-api },
+ { name: aodh_listener, group: aodh-listener },
+ { name: aodh_evaluator, group: aodh-evaluator },
+ { name: aodh_notifier, group: aodh-notifier }]
+ - "{{ container_envs.results }}"
+ - "{{ check_results.results }}"
diff --git a/ansible/roles/aodh/tasks/main.yml b/ansible/roles/aodh/tasks/main.yml
new file mode 100644
index 0000000000..b017e8b4ad
--- /dev/null
+++ b/ansible/roles/aodh/tasks/main.yml
@@ -0,0 +1,2 @@
+---
+- include: "{{ action }}.yml"
diff --git a/ansible/roles/aodh/tasks/pull.yml b/ansible/roles/aodh/tasks/pull.yml
new file mode 100644
index 0000000000..20030c2612
--- /dev/null
+++ b/ansible/roles/aodh/tasks/pull.yml
@@ -0,0 +1,28 @@
+---
+- name: Pulling aodh-api image
+ kolla_docker:
+ action: "pull_image"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ aodh_api_image_full }}"
+ when: inventory_hostname in groups['aodh-api']
+
+- name: Pulling aodh-listener image
+ kolla_docker:
+ action: "pull_image"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ aodh_listener_image_full }}"
+ when: inventory_hostname in groups['aodh-listener']
+
+- name: Pulling aodh-evaluator image
+ kolla_docker:
+ action: "pull_image"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ aodh_evaluator_image_full }}"
+ when: inventory_hostname in groups['aodh-evaluator']
+
+- name: Pulling aodh-notifier image
+ kolla_docker:
+ action: "pull_image"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ aodh_notifier_image_full }}"
+ when: inventory_hostname in groups['aodh-notifier']
\ No newline at end of file
diff --git a/ansible/roles/aodh/tasks/reconfigure.yml b/ansible/roles/aodh/tasks/reconfigure.yml
new file mode 100644
index 0000000000..72e421b794
--- /dev/null
+++ b/ansible/roles/aodh/tasks/reconfigure.yml
@@ -0,0 +1,7 @@
+---
+- include: do_reconfigure.yml
+ serial: "30%"
+ when: inventory_hostname in groups['aodh-api']
+ or inventory_hostname in groups['aodh-listener']
+ or inventory_hostname in groups['aodh-evaluator']
+ or inventory_hostname in groups['aodh-notifier']
\ No newline at end of file
diff --git a/ansible/roles/aodh/tasks/register.yml b/ansible/roles/aodh/tasks/register.yml
new file mode 100644
index 0000000000..202a11fffc
--- /dev/null
+++ b/ansible/roles/aodh/tasks/register.yml
@@ -0,0 +1,40 @@
+---
+- name: Creating the aodh service and endpoint
+ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
+ -m kolla_keystone_service
+ -a "service_name=aodh
+ service_type=alarming
+ description='OpenStack Alarming Service'
+ endpoint_region={{ openstack_region_name }}
+ url='{{ item.url }}'
+ interface='{{ item.interface }}'
+ region_name={{ openstack_region_name }}
+ auth={{ '{{ openstack_aodh_auth }}' }}"
+ -e "{'openstack_aodh_auth':{{ openstack_aodh_auth }}}"
+ register: aodh_endpoint
+ changed_when: "{{ aodh_endpoint.stdout.find('localhost | SUCCESS => ') != -1 and (aodh_endpoint.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
+ until: aodh_endpoint.stdout.split()[2] == 'SUCCESS'
+ retries: 10
+ delay: 5
+ run_once: True
+ with_items:
+ - {'interface': 'admin', 'url': '{{ aodh_admin_endpoint }}'}
+ - {'interface': 'internal', 'url': '{{ aodh_internal_endpoint }}'}
+ - {'interface': 'public', 'url': '{{ aodh_public_endpoint }}'}
+
+- name: Creating the aodh project, user, and role
+ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
+ -m kolla_keystone_user
+ -a "project=service
+ user=aodh
+ password={{ aodh_keystone_password }}
+ role=admin
+ region_name={{ openstack_region_name }}
+ auth={{ '{{ openstack_aodh_auth }}' }}"
+ -e "{'openstack_aodh_auth':{{ openstack_aodh_auth }}}"
+ register: aodh_user
+ changed_when: "{{ aodh_user.stdout.find('localhost | SUCCESS => ') != -1 and (aodh_user.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
+ until: aodh_user.stdout.split()[2] == 'SUCCESS'
+ retries: 10
+ delay: 5
+ run_once: True
diff --git a/ansible/roles/aodh/tasks/start.yml b/ansible/roles/aodh/tasks/start.yml
new file mode 100644
index 0000000000..5db52b65eb
--- /dev/null
+++ b/ansible/roles/aodh/tasks/start.yml
@@ -0,0 +1,45 @@
+---
+- name: Starting aodh-api container
+ kolla_docker:
+ action: "start_container"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ aodh_api_image_full }}"
+ name: "aodh_api"
+ volumes:
+ - "{{ node_config_directory }}/aodh-api/:{{ container_config_directory }}/:ro"
+ - "aodh:/var/lib/aodh/"
+ - "kolla_logs:/var/log/kolla/"
+ when: inventory_hostname in groups['aodh-api']
+
+- name: Starting aodh-evaluator container
+ kolla_docker:
+ action: "start_container"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ aodh_evaluator_image_full }}"
+ name: "aodh_evaluator"
+ volumes:
+ - "{{ node_config_directory }}/aodh-evaluator/:{{ container_config_directory }}/:ro"
+ - "kolla_logs:/var/log/kolla/"
+ when: inventory_hostname in groups['aodh-evaluator']
+
+- name: Starting aodh-listener container
+ kolla_docker:
+ action: "start_container"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ aodh_listener_image_full }}"
+ name: "aodh_listener"
+ volumes:
+ - "{{ node_config_directory }}/aodh-listener/:{{ container_config_directory }}/:ro"
+ - "kolla_logs:/var/log/kolla/"
+ when: inventory_hostname in groups['aodh-listener']
+
+- name: Starting aodh-notifier container
+ kolla_docker:
+ action: "start_container"
+ common_options: "{{ docker_common_options }}"
+ image: "{{ aodh_notifier_image_full }}"
+ name: "aodh_notifier"
+ volumes:
+ - "{{ node_config_directory }}/aodh-notifier/:{{ container_config_directory }}/:ro"
+ - "kolla_logs:/var/log/kolla/"
+ when: inventory_hostname in groups['aodh-notifier']
diff --git a/ansible/roles/aodh/templates/aodh-api.json.j2 b/ansible/roles/aodh/templates/aodh-api.json.j2
new file mode 100644
index 0000000000..59fdc733c7
--- /dev/null
+++ b/ansible/roles/aodh/templates/aodh-api.json.j2
@@ -0,0 +1,25 @@
+{% set aodh_cmd = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
+{% set aodh_dir = 'apache2/conf-enabled' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd/conf.d' %}
+{
+ "command": "{{ aodh_cmd }} -DFOREGROUND",
+ "config_files": [
+ {
+ "source": "{{ container_config_directory }}/aodh.conf",
+ "dest": "/etc/aodh/aodh.conf",
+ "owner": "aodh",
+ "perm": "0644"
+ },
+ {
+ "source": "{{ container_config_directory }}/api_paste.ini",
+ "dest": "/etc/aodh/api_paste.ini",
+ "owner": "aodh",
+ "perm": "0644"
+ },
+ {
+ "source": "{{ container_config_directory }}/wsgi-aodh.conf",
+ "dest": "/etc/{{ aodh_dir }}/wsgi-aodh.conf",
+ "owner": "aodh",
+ "perm": "0644"
+ }
+ ]
+}
diff --git a/ansible/roles/aodh/templates/aodh-evaluator.json.j2 b/ansible/roles/aodh/templates/aodh-evaluator.json.j2
new file mode 100644
index 0000000000..220be5a1e0
--- /dev/null
+++ b/ansible/roles/aodh/templates/aodh-evaluator.json.j2
@@ -0,0 +1,11 @@
+{
+ "command": "aodh-evaluator",
+ "config_files": [
+ {
+ "source": "{{ container_config_directory }}/aodh.conf",
+ "dest": "/etc/aodh/aodh.conf",
+ "owner": "aodh",
+ "perm": "0600"
+ }
+ ]
+}
diff --git a/ansible/roles/aodh/templates/aodh-listener.json.j2 b/ansible/roles/aodh/templates/aodh-listener.json.j2
new file mode 100644
index 0000000000..3b75e64c80
--- /dev/null
+++ b/ansible/roles/aodh/templates/aodh-listener.json.j2
@@ -0,0 +1,11 @@
+{
+ "command": "aodh-listener",
+ "config_files": [
+ {
+ "source": "{{ container_config_directory }}/aodh.conf",
+ "dest": "/etc/aodh/aodh.conf",
+ "owner": "aodh",
+ "perm": "0600"
+ }
+ ]
+}
diff --git a/ansible/roles/aodh/templates/aodh-notifier.json.j2 b/ansible/roles/aodh/templates/aodh-notifier.json.j2
new file mode 100644
index 0000000000..da910cd2ba
--- /dev/null
+++ b/ansible/roles/aodh/templates/aodh-notifier.json.j2
@@ -0,0 +1,11 @@
+{
+ "command": "aodh-notifier",
+ "config_files": [
+ {
+ "source": "{{ container_config_directory }}/aodh.conf",
+ "dest": "/etc/aodh/aodh.conf",
+ "owner": "aodh",
+ "perm": "0600"
+ }
+ ]
+}
diff --git a/ansible/roles/aodh/templates/aodh.conf.j2 b/ansible/roles/aodh/templates/aodh.conf.j2
new file mode 100644
index 0000000000..d432b59025
--- /dev/null
+++ b/ansible/roles/aodh/templates/aodh.conf.j2
@@ -0,0 +1,45 @@
+[DEFAULT]
+auth_strategy = keystone
+log_dir = /var/log/kolla/aodh
+debug = {{ aodh_logging_debug }}
+rpc_backend = rabbit
+notification_topics = notifications
+
+[oslo_messaging_rabbit]
+rabbit_userid = {{ rabbitmq_user }}
+rabbit_password = {{ rabbitmq_password }}
+rabbit_ha_queues = true
+rabbit_hosts = {% for host in groups['rabbitmq'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ rabbitmq_port }}{% if not loop.last %},{% endif %}{% endfor %}
+
+
+[api]
+port = {{ aodh_api_port }}
+host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
+
+[database]
+connection = mysql+pymysql://{{ aodh_database_user }}:{{ aodh_database_password }}@{{ aodh_database_address }}/{{ aodh_database_name }}
+
+
+[keystone_authtoken]
+memcache_security_strategy = ENCRYPT
+memcache_secret_key = {{ memcache_secret_key }}
+memcache_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address']
+auth_uri = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }}
+project_domain_name = default
+project_name = service
+user_domain_name = default
+username = {{ aodh_keystone_user }}
+password = {{ aodh_keystone_password }}
+auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}
+auth_type = password
+
+
+[service_credentials]
+auth_url = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }}/v3
+region_name = {{ openstack_region_name }}
+password = {{ aodh_keystone_password }}
+username = {{ aodh_keystone_user }}
+project_name = service
+project_domain_id = default
+user_domain_id = default
+auth_type = password
diff --git a/ansible/roles/aodh/templates/wsgi-aodh.conf.j2 b/ansible/roles/aodh/templates/wsgi-aodh.conf.j2
new file mode 100644
index 0000000000..448820469f
--- /dev/null
+++ b/ansible/roles/aodh/templates/wsgi-aodh.conf.j2
@@ -0,0 +1,25 @@
+{% set python_path = '/usr/lib/python2.7/site-packages' if kolla_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %}
+Listen {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ aodh_api_port }}
+
+
+
+ ## Vhost docroot
+ DocumentRoot "/var/www/cgi-bin/aodh"
+
+ ## Directories, there should at least be a declaration for /var/www/cgi-bin/aodh
+
+
+ Options Indexes FollowSymLinks MultiViews
+ AllowOverride None
+ Require all granted
+
+
+ ## Logging
+ ErrorLog "/var/log/kolla/aodh/aodh_wsgi_error.log"
+ ServerSignature Off
+ CustomLog "/var/log/kolla/aodh/aodh_wsgi_access.log" combined
+ WSGIApplicationGroup %{GLOBAL}
+ WSGIDaemonProcess aodh group=aodh processes=2 threads=2 user=aodh python-path={{ python_path }}
+ WSGIProcessGroup aodh
+ WSGIScriptAlias / "/var/www/cgi-bin/aodh/app.wsgi"
+
diff --git a/ansible/roles/common/tasks/config.yml b/ansible/roles/common/tasks/config.yml
index 27a98576c4..d46f86385b 100644
--- a/ansible/roles/common/tasks/config.yml
+++ b/ansible/roles/common/tasks/config.yml
@@ -23,6 +23,7 @@
dest: "{{ node_config_directory }}/heka/heka-{{ item.name }}.toml"
when: item.enabled | bool
with_items:
+ - { name: "aodh", enabled: "{{ enable_aodh }}" }
- { name: "elasticsearch", enabled: "{{ enable_central_logging }}" }
- { name: "global", enabled: "yes" }
- { name: "haproxy", enabled: "{{ enable_haproxy }}" }
@@ -54,6 +55,7 @@
dest: "{{ node_config_directory }}/cron/logrotate/{{ item }}.conf"
with_items:
- "ansible"
+ - "aodh"
- "cinder"
- "glance"
- "global"
diff --git a/ansible/roles/common/templates/cron-logrotate-aodh.conf.j2 b/ansible/roles/common/templates/cron-logrotate-aodh.conf.j2
new file mode 100644
index 0000000000..fd333f6e41
--- /dev/null
+++ b/ansible/roles/common/templates/cron-logrotate-aodh.conf.j2
@@ -0,0 +1,3 @@
+"/var/log/kolla/aodh/*.log"
+{
+}
diff --git a/ansible/roles/common/templates/cron.json.j2 b/ansible/roles/common/templates/cron.json.j2
index d6c51d8f0c..4c8d32b95a 100644
--- a/ansible/roles/common/templates/cron.json.j2
+++ b/ansible/roles/common/templates/cron.json.j2
@@ -1,5 +1,5 @@
{% set cron_cmd = 'cron -f' if kolla_base_distro in ['ubuntu', 'debian'] else 'crond -s -n' %}
-{% set services = ["ansible", "cinder", "glance", "haproxy", "heat", "keepalived", "keystone", "magnum", "manila", "mariadb", "mistral", "murano", "neutron", "nova", "rabbitmq", "swift"] %}
+{% set services = ["ansible", "aodh", "cinder", "glance", "haproxy", "heat", "keepalived", "keystone", "magnum", "manila", "mariadb", "mistral", "murano", "neutron", "nova", "rabbitmq", "swift"] %}
{
"command": "{{ cron_cmd }}",
"config_files": [
diff --git a/ansible/roles/common/templates/heka-aodh.toml.j2 b/ansible/roles/common/templates/heka-aodh.toml.j2
new file mode 100644
index 0000000000..419d923e98
--- /dev/null
+++ b/ansible/roles/common/templates/heka-aodh.toml.j2
@@ -0,0 +1,13 @@
+[aodh_apache_log_decoder]
+type = "SandboxDecoder"
+filename = "lua_decoders/os_aodh_apache_log.lua"
+ [aodh_apache_log_decoder.config]
+ apache_log_pattern = '%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"'
+
+[aodh_apache_logstreamer_input]
+type = "LogstreamerInput"
+decoder = "aodh_apache_log_decoder"
+log_directory = "/var/log/kolla"
+file_match = 'aodh/aodh-apache-(?P.+)-access\.log\.?(?P\d*)$'
+priority = ["^Seq"]
+differentiator = ["aodh-apache-", "Service"]
diff --git a/ansible/site.yml b/ansible/site.yml
index 44c163ae63..fde2f6aef5 100644
--- a/ansible/site.yml
+++ b/ansible/site.yml
@@ -239,6 +239,15 @@
tags: ceilometer,
when: enable_ceilometer | bool }
+- hosts:
+ - aodh
+ - rabbitmq
+ - memcached
+ roles:
+ - { role: aodh,
+ tags: aodh,
+ when: enable_aodh | bool }
+
- hosts:
- tempest
roles:
diff --git a/etc/kolla/passwords.yml b/etc/kolla/passwords.yml
index b026cb89a7..217e9f5910 100644
--- a/etc/kolla/passwords.yml
+++ b/etc/kolla/passwords.yml
@@ -21,6 +21,9 @@ docker_registry_password:
####################
# OpenStack options
####################
+aodh_database_password:
+aodh_keystone_password:
+
keystone_admin_password:
keystone_database_password:
diff --git a/releasenotes/notes/add-aodh-a5de8a339f25c1a2.yaml b/releasenotes/notes/add-aodh-a5de8a339f25c1a2.yaml
new file mode 100644
index 0000000000..9ccf4c26e8
--- /dev/null
+++ b/releasenotes/notes/add-aodh-a5de8a339f25c1a2.yaml
@@ -0,0 +1,3 @@
+---
+features:
+ - Implement Aodh ansible role