From 5db330d9dc6deb4277522f4dc8f1af7138baa2df Mon Sep 17 00:00:00 2001 From: Miguel Alex Cantu Date: Mon, 13 Jun 2016 18:16:07 +0000 Subject: [PATCH] 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 --- doc/source/install-guide/configure-aodh.rst | 81 --------------------- etc/openstack_deploy/user_variables.yml | 5 -- playbooks/inventory/group_vars/all.yml | 11 ++- playbooks/os-aodh-install.yml | 31 ++++++++ 4 files changed, 36 insertions(+), 92 deletions(-) diff --git a/doc/source/install-guide/configure-aodh.rst b/doc/source/install-guide/configure-aodh.rst index 67dae46234..eb235545ce 100644 --- a/doc/source/install-guide/configure-aodh.rst +++ b/doc/source/install-guide/configure-aodh.rst @@ -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. -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 @@ -120,19 +52,6 @@ The ``metering-alarm_hosts`` provides several services: These services communicate by using the OpenStack messaging bus. Only 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 (instead of only Aodh), run ``setup-openstack.yml``. The Aodh playbooks run as part of this playbook. diff --git a/etc/openstack_deploy/user_variables.yml b/etc/openstack_deploy/user_variables.yml index e50cd2b9a8..c87bbb6b6d 100644 --- a/etc/openstack_deploy/user_variables.yml +++ b/etc/openstack_deploy/user_variables.yml @@ -36,11 +36,6 @@ debug: false # neutron_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 # 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 diff --git a/playbooks/inventory/group_vars/all.yml b/playbooks/inventory/group_vars/all.yml index 828f8d7663..aa9b4161a1 100644 --- a/playbooks/inventory/group_vars/all.yml +++ b/playbooks/inventory/group_vars/all.yml @@ -86,12 +86,11 @@ dhcp_domain: openstacklocal service_ldap_backend_enabled: "{{ keystone_ldap is defined and keystone_ldap.Default is defined }}" ## Aodh DB info -aodh_database_name: aodh -aodh_database_user: aodh -aodh_db_type: mongodb -aodh_db_ip: localhost -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 }}" +aodh_galera_user: aodh +aodh_galera_database: aodh +aodh_galera_address: "{{ internal_lb_vip_address }}" +aodh_connection_string: "mysql+pymysql://{{ aodh_galera_user }}:{{ aodh_container_db_password }}@{{ aodh_galera_address }}/{{ aodh_galera_database }}?charset=utf8" + ## Ceilometer ceilometer_service_user_name: ceilometer diff --git a/playbooks/os-aodh-install.yml b/playbooks/os-aodh-install.yml index f3c5aa11c5..b763d8d619 100644 --- a/playbooks/os-aodh-install.yml +++ b/playbooks/os-aodh-install.yml @@ -91,6 +91,34 @@ tags: - aodh-rabbitmq - 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: - role: "os_aodh" aodh_venv_tag: "{{ openstack_release }}" @@ -107,6 +135,9 @@ - "aodh-rsyslog-client" vars: 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_vhost: /aodh aodh_rabbitmq_servers: "{{ rabbitmq_servers }}"