diff --git a/packstack/plugins/ceilometer_800.py b/packstack/plugins/ceilometer_800.py index f78e7306b..b709d575e 100644 --- a/packstack/plugins/ceilometer_800.py +++ b/packstack/plugins/ceilometer_800.py @@ -28,63 +28,91 @@ def initConfig(controllerObject): global controller controller = controllerObject logging.debug("Adding OpenStack Ceilometer configuration") - paramsList = [ - {"CMD_OPTION" : "ceilometer-host", - "USAGE" : ("The IP address of the server on which " - "to install Ceilometer"), - "PROMPT" : ("Enter the IP address of the Ceilometer " - "server"), - "OPTION_LIST" : [], - "VALIDATORS" : [validators.validate_ssh], - "DEFAULT_VALUE" : utils.get_localhost_ip(), - "MASK_INPUT" : False, - "LOOSE_VALIDATION": True, - "CONF_NAME" : "CONFIG_CEILOMETER_HOST", - "USE_DEFAULT" : False, - "NEED_CONFIRM" : False, - "CONDITION" : False}, - {"CMD_OPTION" : "ceilometer-secret", - "USAGE" : "Secret key for signing metering messages.", - "PROMPT" : "Enter the Ceilometer secret key", - "OPTION_LIST" : [], - "VALIDATORS" : [validators.validate_not_empty], - "DEFAULT_VALUE" : uuid.uuid4().hex[:16], - "MASK_INPUT" : True, - "LOOSE_VALIDATION": False, - "CONF_NAME" : "CONFIG_CEILOMETER_SECRET", - "USE_DEFAULT" : True, - "NEED_CONFIRM" : True, - "CONDITION" : False}, + ceilometer_params = { + "CEILOMETER" : [ + {"CMD_OPTION" : "ceilometer-host", + "USAGE" : ("The IP address of the server on which " + "to install Ceilometer"), + "PROMPT" : ("Enter the IP address of the Ceilometer " + "server"), + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_ssh], + "DEFAULT_VALUE" : utils.get_localhost_ip(), + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_CEILOMETER_HOST", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False}, + {"CMD_OPTION" : "ceilometer-secret", + "USAGE" : "Secret key for signing metering messages.", + "PROMPT" : "Enter the Ceilometer secret key", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_not_empty], + "DEFAULT_VALUE" : uuid.uuid4().hex[:16], + "MASK_INPUT" : True, + "LOOSE_VALIDATION": False, + "CONF_NAME" : "CONFIG_CEILOMETER_SECRET", + "USE_DEFAULT" : True, + "NEED_CONFIRM" : True, + "CONDITION" : False}, + {"CMD_OPTION" : "ceilometer-ks-passwd", + "USAGE" : "The password to use for Ceilometer to authenticate with Keystone", + "PROMPT" : "Enter the password for the Ceilometer Keystone access", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_not_empty], + "DEFAULT_VALUE" : uuid.uuid4().hex[:16], + "MASK_INPUT" : True, + "LOOSE_VALIDATION": False, + "CONF_NAME" : "CONFIG_CEILOMETER_KS_PW", + "USE_DEFAULT" : True, + "NEED_CONFIRM" : True, + "CONDITION" : False}, + ], + "MONGODB" : [ + {"CMD_OPTION" : "mongodb-host", + "USAGE" : ("The IP address of the server on which " + "to install mongodb"), + "PROMPT" : ("Enter the IP address of the mongodb server"), + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_ssh], + "DEFAULT_VALUE" : utils.get_localhost_ip(), + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_MONGODB_HOST", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False}, + ], + } - {"CMD_OPTION" : "ceilometer-ks-passwd", - "USAGE" : "The password to use for Ceilometer to authenticate with Keystone", - "PROMPT" : "Enter the password for the Ceilometer Keystone access", - "OPTION_LIST" : [], - "VALIDATORS" : [validators.validate_not_empty], - "DEFAULT_VALUE" : uuid.uuid4().hex[:16], - "MASK_INPUT" : True, - "LOOSE_VALIDATION": False, - "CONF_NAME" : "CONFIG_CEILOMETER_KS_PW", - "USE_DEFAULT" : True, - "NEED_CONFIRM" : True, - "CONDITION" : False}, + ceilometer_groups = [ + {"GROUP_NAME" : "CEILOMETER", + "DESCRIPTION" : "Ceilometer Config parameters", + "PRE_CONDITION" : "CONFIG_CEILOMETER_INSTALL", + "PRE_CONDITION_MATCH" : "y", + "POST_CONDITION" : False, + "POST_CONDITION_MATCH": True}, + {"GROUP_NAME" : "MONGODB", + "DESCRIPTION" : "MONGODB Config parameters", + "PRE_CONDITION" : "CONFIG_CEILOMETER_INSTALL", + "PRE_CONDITION_MATCH" : "y", + "POST_CONDITION" : False, + "POST_CONDITION_MATCH": True}, ] - groupDict = {"GROUP_NAME" : "CEILOMETER", - "DESCRIPTION" : "Ceilometer Config parameters", - "PRE_CONDITION" : "CONFIG_CEILOMETER_INSTALL", - "PRE_CONDITION_MATCH" : "y", - "POST_CONDITION" : False, - "POST_CONDITION_MATCH": True} - controller.addGroup(groupDict, paramsList) - + for group in ceilometer_groups: + paramList = ceilometer_params[group["GROUP_NAME"]] + controller.addGroup(group, paramList) def initSequences(controller): if controller.CONF['CONFIG_CEILOMETER_INSTALL'] != 'y': return - steps = [{'title': 'Adding Ceilometer manifest entries', + steps = [{'title': 'Adding MongoDB manifest entries', + 'functions': [create_mongodb_manifest]}, + {'title': 'Adding Ceilometer manifest entries', 'functions': [create_manifest]}, {'title': 'Adding Ceilometer Keystone manifest entries', 'functions': [create_keystone_manifest]}] @@ -108,6 +136,14 @@ def create_manifest(config): manifestdata += getManifestTemplate("ceilometer_nova_disabled.pp") appendManifestFile(manifestfile, manifestdata) +def create_mongodb_manifest(config): + manifestfile = "%s_mongodb.pp" % config['CONFIG_MONGODB_HOST'] + manifestdata = getManifestTemplate("mongodb.pp") + config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CEILOMETER_HOST'] + config['FIREWALL_SERVICE_NAME'] = 'mongodb-server' + config['FIREWALL_PORTS'] = "'27017'" + manifestdata += getManifestTemplate("firewall.pp") + appendManifestFile(manifestfile, manifestdata, 'pre') def create_keystone_manifest(config): manifestfile = "%s_keystone.pp" % config['CONFIG_KEYSTONE_HOST'] diff --git a/packstack/puppet/templates/ceilometer.pp b/packstack/puppet/templates/ceilometer.pp index 5d84acc1a..1c8afc01b 100644 --- a/packstack/puppet/templates/ceilometer.pp +++ b/packstack/puppet/templates/ceilometer.pp @@ -1,21 +1,5 @@ -class { 'mongodb::server': - port => '27017', - smallfiles => true, - before => Class['ceilometer::db'], - require => Firewall['001 mongodb incoming localhost'], -} - -firewall { '001 mongodb incoming localhost': - proto => 'tcp', - dport => ['27017'], - iniface => 'lo', - #source => 'localhost', - #destination => 'localhost', - action => 'accept', -} - class { 'ceilometer::db': - database_connection => 'mongodb://localhost:27017/ceilometer', + database_connection => 'mongodb://%(CONFIG_MONGODB_HOST)s:27017/ceilometer', require => Class['mongodb::server'], } diff --git a/packstack/puppet/templates/mongodb.pp b/packstack/puppet/templates/mongodb.pp new file mode 100644 index 000000000..b9b83af44 --- /dev/null +++ b/packstack/puppet/templates/mongodb.pp @@ -0,0 +1,5 @@ +class { 'mongodb::server': + smallfiles => true, + bind_ip => '%(CONFIG_MONGODB_HOST)s', + before => Class['ceilometer::db'], +}