diff --git a/docs/packstack.rst b/docs/packstack.rst index aea0b2da2..1f0c09554 100644 --- a/docs/packstack.rst +++ b/docs/packstack.rst @@ -59,6 +59,9 @@ Global Options **CONFIG_CEILOMETER_INSTALL** Specify 'y' to install OpenStack Metering (ceilometer). ['y', 'n'] +**CONFIG_AODH_INSTALL** + Specify 'y' to install OpenStack Telemetry Alarming (Aodh). Note Aodh requires Ceilometer to be installed as well. ['y', 'n'] + **CONFIG_HEAT_INSTALL** Specify 'y' to install OpenStack Orchestration (heat). ['y', 'n'] @@ -1052,6 +1055,12 @@ Redis Config parameters **CONFIG_REDIS_MASTER_NAME** Name of the master server watched by the Redis sentinel. ['[a-z]+'] +Aodh Config parameters +---------------------- + +**CONFIG_AODH_KS_PW** + Password to use for Telemetry Alarming to authenticate with the Identity service. + Sahara Config parameters ------------------------ diff --git a/packstack/plugins/aodh_810.py b/packstack/plugins/aodh_810.py new file mode 100644 index 000000000..138b8d0a6 --- /dev/null +++ b/packstack/plugins/aodh_810.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Installs and configures Aodh +""" + +from packstack.installer import basedefs +from packstack.installer import utils +from packstack.installer import validators +from packstack.installer import processors + +from packstack.modules.documentation import update_params_usage +from packstack.modules.shortcuts import get_mq +from packstack.modules.ospluginutils import appendManifestFile +from packstack.modules.ospluginutils import createFirewallResources +from packstack.modules.ospluginutils import getManifestTemplate +from packstack.modules.ospluginutils import generate_ssl_cert + +# ------------- Aodh Packstack Plugin Initialization -------------- + +PLUGIN_NAME = "OS-Aodh" +PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue') + + +def initConfig(controller): + aodh_params = { + "AODH": [ + {"CONF_NAME": "CONFIG_AODH_KS_PW", + "CMD_OPTION": "aodh-ks-passwd", + "PROMPT": "Enter the password for the Aodh Keystone access", + "OPTION_LIST": [], + "VALIDATORS": [validators.validate_not_empty], + "DEFAULT_VALUE": "PW_PLACEHOLDER", + "PROCESSORS": [processors.process_password], + "MASK_INPUT": True, + "LOOSE_VALIDATION": False, + "USE_DEFAULT": False, + "NEED_CONFIRM": True, + "CONDITION": False} + ] + } + + update_params_usage(basedefs.PACKSTACK_DOC, aodh_params) + + def use_aodh(config): + return (config['CONFIG_CEILOMETER_INSTALL'] == 'y' and + config['CONFIG_AODH_INSTALL'] == 'y') + + aodh_groups = [ + {"GROUP_NAME": "AODH", + "DESCRIPTION": "Aodh Config parameters", + "PRE_CONDITION": use_aodh, + "PRE_CONDITION_MATCH": True, + "POST_CONDITION": False, + "POST_CONDITION_MATCH": True}, + ] + for group in aodh_groups: + paramList = aodh_params[group["GROUP_NAME"]] + controller.addGroup(group, paramList) + + +def initSequences(controller): + if (controller.CONF['CONFIG_AODH_INSTALL'] != 'y' or + controller.CONF['CONFIG_CEILOMETER_INSTALL'] != 'y'): + return + + steps = [{'title': 'Adding Aodh manifest entries', + 'functions': [create_manifest]}, + {'title': 'Adding Aodh Keystone manifest entries', + 'functions': [create_keystone_manifest]}] + controller.addSequence("Installing OpenStack Aodh", [], [], + steps) + + +# -------------------------- step functions -------------------------- + +def create_manifest(config, messages): + manifestfile = "%s_aodh.pp" % config['CONFIG_CONTROLLER_HOST'] + manifestdata = getManifestTemplate(get_mq(config, "aodh")) + manifestdata += getManifestTemplate("aodh") + + if config['CONFIG_AMQP_ENABLE_SSL'] == 'y': + ssl_cert_file = config['CONFIG_AODH_SSL_CERT'] = ( + '/etc/pki/tls/certs/ssl_amqp_aodh.crt' + ) + ssl_key_file = config['CONFIG_AODH_SSL_KEY'] = ( + '/etc/pki/tls/private/ssl_amqp_aodh.key' + ) + ssl_host = config['CONFIG_CONTROLLER_HOST'] + service = 'aodh' + generate_ssl_cert(config, ssl_host, service, ssl_key_file, + ssl_cert_file) + + fw_details = dict() + key = "aodh_api" + fw_details.setdefault(key, {}) + fw_details[key]['host'] = "ALL" + fw_details[key]['service_name'] = "aodh-api" + fw_details[key]['chain'] = "INPUT" + fw_details[key]['ports'] = ['8042'] + fw_details[key]['proto'] = "tcp" + config['FIREWALL_AODH_RULES'] = fw_details + manifestdata += createFirewallResources('FIREWALL_AODH_RULES') + appendManifestFile(manifestfile, manifestdata, 'aodh') + + +def create_keystone_manifest(config, messages): + manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST'] + manifestdata = getManifestTemplate("keystone_aodh") + appendManifestFile(manifestfile, manifestdata) diff --git a/packstack/plugins/prescript_000.py b/packstack/plugins/prescript_000.py index 54e53e4ce..78c7feca3 100644 --- a/packstack/plugins/prescript_000.py +++ b/packstack/plugins/prescript_000.py @@ -205,6 +205,20 @@ def initConfig(controller): "NEED_CONFIRM": False, "CONDITION": False}, + {"CMD_OPTION": "os-aodh-install", + "PROMPT": ( + "Should Packstack install OpenStack Telemetry Alarming (Aodh)" + ), + "OPTION_LIST": ["y", "n"], + "VALIDATORS": [validators.validate_options], + "DEFAULT_VALUE": "y", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_AODH_INSTALL", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + {"CMD_OPTION": "os-sahara-install", "PROMPT": ( "Should Packstack install OpenStack Clustering (Sahara)." diff --git a/packstack/plugins/puppet_950.py b/packstack/plugins/puppet_950.py index ab07854d7..0e60b84ef 100644 --- a/packstack/plugins/puppet_950.py +++ b/packstack/plugins/puppet_950.py @@ -140,15 +140,15 @@ def run_cleanup(config, messages): def copy_puppet_modules(config, messages): - os_modules = ' '.join(('apache', 'ceilometer', 'certmonger', 'cinder', - 'concat', 'firewall', 'glance', 'galera', 'heat', - 'horizon', 'inifile', 'ironic', 'keystone', + os_modules = ' '.join(('aodh', 'apache', 'ceilometer', 'certmonger', + 'cinder', 'concat', 'firewall', 'glance', 'galera', + 'heat', 'horizon', 'inifile', 'ironic', 'keystone', 'manila', 'memcached', 'mongodb', 'mysql', 'neutron', 'nova', 'nssdb', 'openstack', - 'packstack', 'qpid', 'rabbitmq', 'redis', 'remote', - 'rsync', 'sahara', 'ssh', 'stdlib', 'swift', - 'sysctl', 'tempest', 'trove', 'vcsrepo', 'vlan', - 'vswitch', 'xinetd', 'openstacklib')) + 'openstacklib', 'packstack', 'qpid', 'rabbitmq', + 'redis', 'remote', 'rsync', 'sahara', 'ssh', + 'stdlib', 'swift', 'sysctl', 'tempest', 'trove', + 'vcsrepo', 'vlan', 'vswitch', 'xinetd', )) # write puppet manifest to disk manifestfiles.writeManifests() diff --git a/packstack/puppet/templates/aodh.pp b/packstack/puppet/templates/aodh.pp new file mode 100644 index 000000000..6acff831a --- /dev/null +++ b/packstack/puppet/templates/aodh.pp @@ -0,0 +1,50 @@ +$config_aodh_coordination_backend = hiera('CONFIG_CEILOMETER_COORDINATION_BACKEND') + +if $config_aodh_coordination_backend == 'redis' { + $redis_ha = hiera('CONFIG_REDIS_HA') + $redis_host = hiera('CONFIG_REDIS_MASTER_HOST_URL') + $redis_port = hiera('CONFIG_REDIS_PORT') + $sentinel_host = hiera('CONFIG_REDIS_SENTINEL_CONTACT_HOST') + $sentinel_host_url = hiera('CONFIG_REDIS_SENTINEL_CONTACT_HOST_URL') + $sentinel_fallbacks = hiera('CONFIG_REDIS_SENTINEL_FALLBACKS') + if ($sentinel_host != '' and $redis_ha == 'y') { + $master_name = hiera('CONFIG_REDIS_MASTER_NAME') + $sentinel_port = hiera('CONFIG_REDIS_SENTINEL_PORT') + $base_coordination_url = "redis://${sentinel_host_url}:${sentinel_port}?sentinel=${master_name}" + if $sentinel_fallbacks != '' { + $coordination_url = "${base_coordination_url}&${sentinel_fallbacks}" + } else { + $coordination_url = $base_coordination_url + } + } else { + $coordination_url = "redis://${redis_host}:${redis_port}" + } +} else { + $coordination_url = '' +} + +class { '::aodh::api': + enabled => true, + keystone_password => hiera('CONFIG_AODH_KS_PW'), + keystone_identity_uri => hiera('CONFIG_KEYSTONE_ADMIN_URL'), + service_name => 'httpd', +} + +class { '::apache': + purge_configs => false, +} + +class { '::aodh::wsgi::apache': + ssl => false, +} +class { '::aodh::auth': + auth_password => hiera('CONFIG_AODH_KS_PW'), +} +class { '::aodh::evaluator': + coordination_url => $coordination_url, +} +class { '::aodh::notifier': } +class { '::aodh::listener': } +class { '::aodh::client': } + + diff --git a/packstack/puppet/templates/aodh_rabbitmq.pp b/packstack/puppet/templates/aodh_rabbitmq.pp new file mode 100644 index 000000000..de5289760 --- /dev/null +++ b/packstack/puppet/templates/aodh_rabbitmq.pp @@ -0,0 +1,29 @@ +$kombu_ssl_ca_certs = hiera('CONFIG_AMQP_SSL_CACERT_FILE', undef) +$kombu_ssl_keyfile = hiera('CONFIG_AODH_SSL_KEY', undef) +$kombu_ssl_certfile = hiera('CONFIG_AODH_SSL_CERT', undef) + +if $kombu_ssl_keyfile { + $files_to_set_owner = [ $kombu_ssl_keyfile, $kombu_ssl_certfile ] + file { $files_to_set_owner: + owner => 'aodh', + group => 'aodh', + require => Package['openstack-aodh-common'], + } + File[$files_to_set_owner] ~> Service<||> +} + +$config_mongodb_host = hiera('CONFIG_MONGODB_HOST_URL') + +class { '::aodh': + verbose => true, + debug => hiera('CONFIG_DEBUG_MODE'), + rabbit_host => hiera('CONFIG_AMQP_HOST_URL'), + rabbit_port => hiera('CONFIG_AMQP_CLIENTS_PORT'), + rabbit_use_ssl => hiera('CONFIG_AMQP_SSL_ENABLED'), + rabbit_userid => hiera('CONFIG_AMQP_AUTH_USER'), + rabbit_password => hiera('CONFIG_AMQP_AUTH_PASSWORD'), + kombu_ssl_ca_certs => $kombu_ssl_ca_certs, + kombu_ssl_keyfile => $kombu_ssl_keyfile, + kombu_ssl_certfile => $kombu_ssl_certfile, + database_connection => "mongodb://${config_mongodb_host}:27017/aodh", +} diff --git a/packstack/puppet/templates/ceilometer.pp b/packstack/puppet/templates/ceilometer.pp index c5b8d76a2..1c92c3c7e 100644 --- a/packstack/puppet/templates/ceilometer.pp +++ b/packstack/puppet/templates/ceilometer.pp @@ -44,12 +44,6 @@ class { '::ceilometer::agent::central': coordination_url => $coordination_url, } -class { '::ceilometer::alarm::notifier':} - -class { '::ceilometer::alarm::evaluator': - coordination_url => $coordination_url, -} - $bind_host = hiera('CONFIG_IP_VERSION') ? { 'ipv6' => '::0', default => '0.0.0.0', diff --git a/packstack/puppet/templates/horizon.pp b/packstack/puppet/templates/horizon.pp index 3b8d4311c..23088eab9 100644 --- a/packstack/puppet/templates/horizon.pp +++ b/packstack/puppet/templates/horizon.pp @@ -60,6 +60,10 @@ if hiera('CONFIG_KEYSTONE_SERVICE_NAME') == 'httpd' { apache::listen { '35357': } } +if hiera('CONFIG_AODH_INSTALL') == 'y' { + apache::listen { '8042': } +} + # hack for memcached, for now we bind to localhost on ipv6 # https://bugzilla.redhat.com/show_bug.cgi?id=1210658 $memcached_bind_host = hiera('CONFIG_IP_VERSION') ? { diff --git a/packstack/puppet/templates/keystone_aodh.pp b/packstack/puppet/templates/keystone_aodh.pp new file mode 100644 index 000000000..ebea8a5fb --- /dev/null +++ b/packstack/puppet/templates/keystone_aodh.pp @@ -0,0 +1,9 @@ +$keystone_host_url = hiera('CONFIG_KEYSTONE_HOST_URL') + +class { '::aodh::keystone::auth': + region => hiera('CONFIG_KEYSTONE_REGION'), + password => hiera('CONFIG_AODH_KS_PW'), + public_url => "http://${keystone_host_url}:8042", + admin_url => "http://${keystone_host_url}:8042", + internal_url => "http://${keystone_host_url}:8042", +} diff --git a/packstack/puppet/templates/nagios_server.pp b/packstack/puppet/templates/nagios_server.pp index 58905d2a1..c7fabc45d 100644 --- a/packstack/puppet/templates/nagios_server.pp +++ b/packstack/puppet/templates/nagios_server.pp @@ -103,3 +103,7 @@ if hiera('CONFIG_KEYSTONE_SERVICE_NAME') == 'httpd' { apache::listen { '5000': } apache::listen { '35357': } } + +if hiera('CONFIG_AODH_INSTALL') == 'y' { + apache::listen { '8042': } +} diff --git a/packstack/puppet/templates/provision_tempest.pp b/packstack/puppet/templates/provision_tempest.pp index 5e1b87d37..78242bb55 100644 --- a/packstack/puppet/templates/provision_tempest.pp +++ b/packstack/puppet/templates/provision_tempest.pp @@ -62,6 +62,7 @@ $horizon_available = str2bool(hiera('CONFIG_HORIZON_INSTALL')) $nova_available = str2bool(hiera('CONFIG_NOVA_INSTALL')) $neutron_available = str2bool(hiera('CONFIG_NEUTRON_INSTALL')) $ceilometer_available = str2bool(hiera('CONFIG_CEILOMETER_INSTALL')) +$aodh_available = str2bool(hiera('CONFIG_AODH_INSTALL')) $trove_available = str2bool(hiera('CONFIG_TROVE_INSTALL')) $sahara_available = str2bool(hiera('CONFIG_SAHARA_INSTALL')) $heat_available = str2bool(hiera('CONFIG_HEAT_INSTALL')) @@ -103,6 +104,7 @@ class { '::tempest': nova_available => $nova_available, neutron_available => $neutron_available, ceilometer_available => $ceilometer_available, + aodh_available => $aodh_available, trove_available => $trove_available, sahara_available => $sahara_available, heat_available => $heat_available,