Configuring AODH DB now that it uses MySQL.

AODH now uses MySQL and needs Ansible tasks
to setup the respective DB and user.

Related: I94a585f9c1da51c4f278f4a12e29d395a261e716x
Change-Id: Ie5705ead548f2ceed50348131cdc5ab8f72e12f4
This commit is contained in:
Miguel Alex Cantu 2016-06-13 18:16:07 +00:00
parent 96e2f9553b
commit 5db330d9dc
4 changed files with 36 additions and 92 deletions

View File

@ -9,74 +9,6 @@ The Telemetry (ceilometer) alarming services perform the following functions:
- Allows you to set alarms based on threshold evaluation for a collection of samples. - Allows you to set alarms based on threshold evaluation for a collection of samples.
Aodh on OpenStack-Ansible requires a configured MongoDB backend prior to running
the Aodh playbooks. To specify the connection data, edit the
``user_variables.yml`` file (see section `Configuring the user data`_
below).
Setting up a MongoDB database for Aodh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Install the MongoDB package:
.. code-block:: console
# apt-get install mongodb-server mongodb-clients python-pymongo
2. Edit the ``/etc/mongodb.conf`` file and change ``bind_ip`` to the
management interface of the node running Aodh:
.. code-block:: ini
bind_ip = 10.0.0.11
3. Edit the ``/etc/mongodb.conf`` file and enable ``smallfiles``:
.. code-block:: ini
smallfiles = true
4. Restart the MongoDB service:
.. code-block:: console
# service mongodb restart
5. Create the Aodh database:
.. code-block:: console
# mongo --host controller --eval 'db = db.getSiblingDB("aodh"); db.addUser({user: "aodh", pwd: "AODH_DBPASS", roles: [ "readWrite", "dbAdmin" ]});'
This returns:
.. code-block:: console
MongoDB shell version: 2.4.x
connecting to: controller:27017/test
{
"user" : "aodh",
"pwd" : "72f25aeee7ad4be52437d7cd3fc60f6f",
"roles" : [
"readWrite",
"dbAdmin"
],
"_id" : ObjectId("5489c22270d7fad1ba631dc3")
}
.. note::
Ensure ``AODH_DBPASS`` matches the
``aodh_container_db_password`` in the
``/etc/openstack_deploy/user_secrets.yml`` file. This
allows Ansible to configure the connection string within
the Aodh configuration files.
Configuring the hosts Configuring the hosts
@ -120,19 +52,6 @@ The ``metering-alarm_hosts`` provides several services:
These services communicate by using the OpenStack messaging bus. Only These services communicate by using the OpenStack messaging bus. Only
the API server has access to the data store. the API server has access to the data store.
Configuring the user data
~~~~~~~~~~~~~~~~~~~~~~~~~
Specify the following considerations in
``/etc/openstack_deploy/user_variables.yml``:
- The type of database backend Aodh uses. Currently, only MongoDB
is supported: ``aodh_db_type: mongodb``
- The IP address of the MonogoDB host: ``aodh_db_ip: localhost``
- The port of the MongoDB service: ``aodh_db_port: 27017``
Run the ``os-aodh-install.yml`` playbook. If deploying a new OpenStack Run the ``os-aodh-install.yml`` playbook. If deploying a new OpenStack
(instead of only Aodh), run ``setup-openstack.yml``. (instead of only Aodh), run ``setup-openstack.yml``.
The Aodh playbooks run as part of this playbook. The Aodh playbooks run as part of this playbook.

View File

@ -36,11 +36,6 @@ debug: false
# neutron_ceilometer_enabled: True # neutron_ceilometer_enabled: True
# keystone_ceilometer_enabled: True # keystone_ceilometer_enabled: True
## Common Aodh Overrides
# aodh_db_type: mongodb
# aodh_db_ip: localhost
# aodh_db_port: 27017
## Common Glance Overrides ## Common Glance Overrides
# Set glance_default_store to "swift" if using Cloud Files or swift backend # Set glance_default_store to "swift" if using Cloud Files or swift backend
# or "rbd" if using ceph backend; the latter will trigger ceph to get # or "rbd" if using ceph backend; the latter will trigger ceph to get

View File

@ -86,12 +86,11 @@ dhcp_domain: openstacklocal
service_ldap_backend_enabled: "{{ keystone_ldap is defined and keystone_ldap.Default is defined }}" service_ldap_backend_enabled: "{{ keystone_ldap is defined and keystone_ldap.Default is defined }}"
## Aodh DB info ## Aodh DB info
aodh_database_name: aodh aodh_galera_user: aodh
aodh_database_user: aodh aodh_galera_database: aodh
aodh_db_type: mongodb aodh_galera_address: "{{ internal_lb_vip_address }}"
aodh_db_ip: localhost aodh_connection_string: "mysql+pymysql://{{ aodh_galera_user }}:{{ aodh_container_db_password }}@{{ aodh_galera_address }}/{{ aodh_galera_database }}?charset=utf8"
aodh_db_port: 27017
aodh_connection_string: "{{ aodh_db_type }}://{{ aodh_database_user }}:{{ aodh_container_db_password }}@{{ aodh_db_ip }}:{{ aodh_db_port }}/{{ aodh_database_name }}"
## Ceilometer ## Ceilometer
ceilometer_service_user_name: ceilometer ceilometer_service_user_name: ceilometer

View File

@ -91,6 +91,34 @@
tags: tags:
- aodh-rabbitmq - aodh-rabbitmq
- aodh-rabbitmq-user - aodh-rabbitmq-user
- name: Create DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ aodh_galera_address }}"
name: "{{ aodh_galera_database }}"
state: "present"
when: inventory_hostname == groups['aodh_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
tags:
- mysql-db-setup
- name: Grant access to the DB for the service
mysql_user:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ aodh_galera_address }}"
name: "{{ aodh_galera_user }}"
password: "{{ aodh_container_db_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ aodh_galera_database }}.*:ALL"
when: inventory_hostname == groups['aodh_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
with_items:
- "localhost"
- "%"
tags:
- mysql-db-setup
roles: roles:
- role: "os_aodh" - role: "os_aodh"
aodh_venv_tag: "{{ openstack_release }}" aodh_venv_tag: "{{ openstack_release }}"
@ -107,6 +135,9 @@
- "aodh-rsyslog-client" - "aodh-rsyslog-client"
vars: vars:
is_metal: "{{ properties.is_metal|default(false) }}" is_metal: "{{ properties.is_metal|default(false) }}"
aodh_galera_address: "{{ internal_lb_vip_address }}"
aodh_galera_user: aodh
aodh_galera_database: aodh
aodh_rabbitmq_userid: aodh aodh_rabbitmq_userid: aodh
aodh_rabbitmq_vhost: /aodh aodh_rabbitmq_vhost: /aodh
aodh_rabbitmq_servers: "{{ rabbitmq_servers }}" aodh_rabbitmq_servers: "{{ rabbitmq_servers }}"