diff --git a/docs/packstack.rst b/docs/packstack.rst index 681d128c7..bcce6aabb 100644 --- a/docs/packstack.rst +++ b/docs/packstack.rst @@ -41,6 +41,9 @@ Global Options **CONFIG_SWIFT_INSTALL** Set to 'y' if you would like Packstack to install Swift ['y', 'n']. +**CONFIG_SAHARA_INSTALL** + Set to 'y' if you would like Packstack to install Sahara ['y', 'n']. + **CONFIG_CLIENT_INSTALL** Set to 'y' if you would like Packstack to install the OpenStack Client packages. An admin "rc" file will also be installed ['y', 'n']. @@ -509,7 +512,6 @@ Neutron Config Parameters **CONFIG_NEUTRON_ML2_VNI_RANGES** A comma separated list of **:** tuples enumerating ranges of VXLAN VNI IDs that are available for tenant network allocation. Min value is 0 and Max value is 16777215. - Provision Config Parameters --------------------------- @@ -540,6 +542,18 @@ Provision Config Parameters **CONFIG_PROVISION_TEMPEST_REPO_URI** The uri of the tempest git repository to use. +Sahara Config Parameters +------------------------ + +**CONFIG_SAHARA_DB_PW** + The password to use for Sahara to access DB. + +**CONFIG_SAHARA_HOST** + The IP address of the server on which to install Sahara if Sahara is being installed. + +**CONFIG_SAHARA_KS_PW** + The password to use for Sahara to authenticate with Keystone. + Log files and Debug info ------------------------ diff --git a/packstack/plugins/mariadb_003.py b/packstack/plugins/mariadb_003.py index 91d542421..915def2ff 100644 --- a/packstack/plugins/mariadb_003.py +++ b/packstack/plugins/mariadb_003.py @@ -105,7 +105,7 @@ def create_manifest(config, messages): manifestdata.append(getManifestTemplate(template)) append_for("keystone", suffix) - for mod in ['nova', 'cinder', 'glance', 'neutron', 'heat']: + for mod in ['nova', 'cinder', 'glance', 'neutron', 'heat', 'sahara']: if config['CONFIG_%s_INSTALL' % mod.upper()] == 'y': append_for(mod, suffix) diff --git a/packstack/plugins/prescript_000.py b/packstack/plugins/prescript_000.py index 4a6152c88..1336b8d48 100644 --- a/packstack/plugins/prescript_000.py +++ b/packstack/plugins/prescript_000.py @@ -234,6 +234,24 @@ def initConfig(controller): "NEED_CONFIRM": False, "CONDITION": False}, + {"CMD_OPTION": "os-sahara-install", + "USAGE": ( + "Set to 'y' if you would like Packstack to install " + "OpenStack Clustering (Sahara)" + ), + "PROMPT": ( + "Should Packstack install OpenStack Clustering (Sahara)" + ), + "OPTION_LIST": ["y", "n"], + "VALIDATORS": [validators.validate_options], + "DEFAULT_VALUE": "n", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_SAHARA_INSTALL", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, + {"CMD_OPTION": "os-client-install", "USAGE": ( "Set to 'y' if you would like Packstack to install " @@ -528,6 +546,23 @@ def initConfig(controller): "USE_DEFAULT": False, "NEED_CONFIRM": False, "CONDITION": False}, + + {"CONF_NAME": "CONFIG_SAHARA_HOST", + "CMD_OPTION": "os-sahara-host", + "USAGE": ( + "(Unsupported!) The IP address of the server on which " + "to install OpenStack services specific to Sahara" + ), + "PROMPT": "Enter the IP address of the Sahara host", + "OPTION_LIST": [], + "VALIDATORS": [validators.validate_ip, + validators.validate_ssh], + "DEFAULT_VALUE": utils.get_localhost_ip(), + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, ] } diff --git a/packstack/plugins/puppet_950.py b/packstack/plugins/puppet_950.py index ae8bb0594..803a00d4c 100644 --- a/packstack/plugins/puppet_950.py +++ b/packstack/plugins/puppet_950.py @@ -176,9 +176,9 @@ def copy_puppet_modules(config, messages): 'inifile', 'keystone', 'memcached', 'mongodb', 'mysql', 'neutron', 'nova', 'nssdb', 'openstack', 'packstack', 'qpid', 'rabbitmq', 'redis', 'remote', - 'rsync', 'ssh', 'stdlib', 'swift', 'sysctl', - 'tempest', 'vcsrepo', 'vlan', 'vswitch', 'xinetd', - 'openstacklib')) + 'rsync', 'sahara', 'ssh', 'stdlib', 'swift', + 'sysctl', 'tempest', 'vcsrepo', 'vlan', 'vswitch', + 'xinetd', 'openstacklib')) # write puppet manifest to disk manifestfiles.writeManifests() diff --git a/packstack/plugins/sahara_800.py b/packstack/plugins/sahara_800.py new file mode 100644 index 000000000..d3e7c11f7 --- /dev/null +++ b/packstack/plugins/sahara_800.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +""" +Installs and configures Sahara +""" + +from packstack.installer import utils +from packstack.installer import validators +from packstack.installer import processors +from packstack.modules.shortcuts import get_mq +from packstack.modules.ospluginutils import (getManifestTemplate, + appendManifestFile, + createFirewallResources) + +#------------------ Sahara installer initialization ------------------ + +PLUGIN_NAME = "OS-Sahara" +PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, "blue") + + +def initConfig(controller): + params = [ + {"CONF_NAME": "CONFIG_SAHARA_DB_PW", + "CMD_OPTION": "sahara-db-passwd", + "PROMPT": "Enter the password to use for Sahara to access the DB", + "USAGE": "The password to use for the Sahara DB 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}, + + {"CONF_NAME": "CONFIG_SAHARA_KS_PW", + "CMD_OPTION": "sahara-ks-passwd", + "USAGE": ("The password to use for Sahara to authenticate " + "with Keystone"), + "PROMPT": "Enter the password for Sahara 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}, + ] + group = {"GROUP_NAME": "SAHARA", + "DESCRIPTION": "Sahara Config parameters", + "PRE_CONDITION": "CONFIG_SAHARA_INSTALL", + "PRE_CONDITION_MATCH": "y", + "POST_CONDITION": False, + "POST_CONDITION_MATCH": True} + controller.addGroup(group, params) + + +def initSequences(controller): + conf = controller.CONF + if conf["CONFIG_SAHARA_INSTALL"] != 'y': + return + + saharasteps = [ + {"title": "Adding Sahara Keystone manifest entries", + "functions": [create_keystone_manifest]}, + {"title": "Adding Sahara manifest entries", + "functions": [create_manifest]}, + ] + controller.addSequence("Installing Sahara", [], [], saharasteps) + +#-------------------------- step functions -------------------------- + + +def create_keystone_manifest(config, messages): + if config['CONFIG_UNSUPPORTED'] != 'y': + config['CONFIG_SAHARA_HOST'] = config['CONFIG_CONTROLLER_HOST'] + + manifestfile = "%s_keystone.pp" % config['CONFIG_CONTROLLER_HOST'] + manifestdata = getManifestTemplate("keystone_sahara") + appendManifestFile(manifestfile, manifestdata) + + +def create_manifest(config, messages): + if config['CONFIG_UNSUPPORTED'] != 'y': + config['CONFIG_STORAGE_HOST'] = config['CONFIG_CONTROLLER_HOST'] + + manifestfile = "%s_sahara.pp" % config['CONFIG_STORAGE_HOST'] + manifestdata = getManifestTemplate(get_mq(config, "sahara")) + manifestdata += getManifestTemplate("sahara.pp") + + fw_details = dict() + key = "sahara-api" + fw_details.setdefault(key, {}) + fw_details[key]["host"] = "ALL" + fw_details[key]["service_name"] = "sahara api" + fw_details[key]["chain"] = "INPUT" + fw_details[key]["ports"] = ["8386"] + fw_details[key]["proto"] = "tcp" + config["FIREWALL_SAHARA_CFN_RULES"] = fw_details + + manifestdata += createFirewallResources("FIREWALL_SAHARA_CFN_RULES") + appendManifestFile(manifestfile, manifestdata, marker='sahara') diff --git a/packstack/puppet/templates/keystone_sahara.pp b/packstack/puppet/templates/keystone_sahara.pp new file mode 100644 index 000000000..e8b3ea3c4 --- /dev/null +++ b/packstack/puppet/templates/keystone_sahara.pp @@ -0,0 +1,6 @@ +class { 'sahara::keystone::auth': + password => hiera('CONFIG_SAHARA_KS_PW'), + public_address => hiera('CONFIG_SAHARA_HOST'), + admin_address => hiera('CONFIG_SAHARA_HOST'), + internal_address => hiera('CONFIG_SAHARA_HOST'), +} diff --git a/packstack/puppet/templates/mariadb_sahara_install.pp b/packstack/puppet/templates/mariadb_sahara_install.pp new file mode 100644 index 000000000..d284aed82 --- /dev/null +++ b/packstack/puppet/templates/mariadb_sahara_install.pp @@ -0,0 +1,5 @@ +class { 'sahara::db::mysql': + password => hiera('CONFIG_SAHARA_DB_PW'), + host => '%%', + allowed_hosts => '%%', +} diff --git a/packstack/puppet/templates/mariadb_sahara_noinstall.pp b/packstack/puppet/templates/mariadb_sahara_noinstall.pp new file mode 100644 index 000000000..3d7968ce3 --- /dev/null +++ b/packstack/puppet/templates/mariadb_sahara_noinstall.pp @@ -0,0 +1,28 @@ +remote_database { 'sahara': + ensure => 'present', + charset => 'utf8', + db_host => hiera('CONFIG_MARIADB_HOST'), + db_user => hiera('CONFIG_MARIADB_USER'), + db_password => hiera('CONFIG_MARIADB_PW'), + provider => 'mysql', +} + +$sahara_cfg_sahara_db_pw = hiera('CONFIG_SAHARA_DB_PW') + +remote_database_user { 'sahara@%%': + password_hash => mysql_password($sahara_cfg_sahara_db_pw), + db_host => hiera('CONFIG_MARIADB_HOST'), + db_user => hiera('CONFIG_MARIADB_USER'), + db_password => hiera('CONFIG_MARIADB_PW'), + provider => 'mysql', + require => Remote_database['sahara'], +} + +remote_database_grant { 'sahara@%%/sahara': + privileges => 'all', + db_host => hiera('CONFIG_MARIADB_HOST'), + db_user => hiera('CONFIG_MARIADB_USER'), + db_password => hiera('CONFIG_MARIADB_PW'), + provider => 'mysql', + require => Remote_database_user['sahara@%%'], +} diff --git a/packstack/puppet/templates/sahara.pp b/packstack/puppet/templates/sahara.pp new file mode 100644 index 000000000..b9d23a81b --- /dev/null +++ b/packstack/puppet/templates/sahara.pp @@ -0,0 +1,19 @@ +$sahara_cfg_sahara_db_pw = hiera('CONFIG_SAHARA_DB_PW') +$sahara_cfg_sahara_mariadb_host = hiera('CONFIG_MARIADB_HOST') + +$sahara_cfg_config_neutron_install = hiera('CONFIG_NEUTRON_INSTALL') + +$sahara_cfg_controller_host = hiera('CONFIG_CONTROLLER_HOST') +class { 'sahara': + database_connection => + "mysql://sahara:${sahara_cfg_sahara_db_pw}@${sahara_cfg_sahara_mariadb_host}/sahara", + verbose => true, + debug => hiera('CONFIG_DEBUG_MODE'), + os_username => 'admin', + os_password => hiera('CONFIG_KEYSTONE_ADMIN_PW'), + os_tenant_name => 'admin', + os_auth_url => "http://${sahara_cfg_controller_host}:5000/v2.0", + identity_url => "http://${sahara_cfg_controller_host}:35357/", + use_neutron => ($sahara_cfg_controller_host == 'y'), + service_host => hiera('CONFIG_SAHARA_HOST'), +} diff --git a/packstack/puppet/templates/sahara_qpid.pp b/packstack/puppet/templates/sahara_qpid.pp new file mode 100644 index 000000000..19fb8b861 --- /dev/null +++ b/packstack/puppet/templates/sahara_qpid.pp @@ -0,0 +1,7 @@ +class { 'sahara::notify::qpid': + qpid_hostname => hiera('CONFIG_AMQP_HOST'), + qpid_port => hiera('CONFIG_AMQP_CLIENTS_PORT'), + qpid_protocol => hiera('CONFIG_AMQP_PROTOCOL'), + qpid_username => hiera('CONFIG_AMQP_AUTH_USER'), + qpid_password => hiera('CONFIG_AMQP_PASSWORD'), +} diff --git a/packstack/puppet/templates/sahara_rabbitmq.pp b/packstack/puppet/templates/sahara_rabbitmq.pp new file mode 100644 index 000000000..125df13df --- /dev/null +++ b/packstack/puppet/templates/sahara_rabbitmq.pp @@ -0,0 +1,6 @@ +class { 'sahara::notify::rabbitmq': + rabbit_host => hiera('CONFIG_AMQP_HOST'), + rabbit_port => hiera('CONFIG_AMQP_CLIENTS_PORT'), + rabbit_userid => hiera('CONFIG_AMQP_AUTH_USER'), + rabbit_password => hiera('CONFIG_AMQP_AUTH_PASSWORD'), +}