From 7acaad1c54e3faeb22134c11066e75ae540e3d95 Mon Sep 17 00:00:00 2001 From: Joe Topjian Date: Wed, 25 Jul 2012 22:11:47 +0000 Subject: [PATCH] Began putting params in individual manifests instead of a single params.pp file. --- manifests/all.pp | 108 ++++++----- manifests/compute.pp | 92 ++++++--- manifests/controller.pp | 128 ++++++++----- manifests/db/mysql.pp | 30 +-- manifests/glance.pp | 40 ++-- manifests/horizon.pp | 18 +- manifests/keystone.pp | 58 +++--- manifests/nova/compute.pp | 92 ++++++--- manifests/nova/controller.pp | 92 ++++++--- manifests/params.pp | 362 ----------------------------------- tests/all.pp | 16 +- tests/cloudcontroller.pp | 17 +- tests/compute.pp | 10 +- 13 files changed, 464 insertions(+), 599 deletions(-) delete mode 100644 manifests/params.pp diff --git a/manifests/all.pp b/manifests/all.pp index 7c01e90..b430cd5 100644 --- a/manifests/all.pp +++ b/manifests/all.pp @@ -10,12 +10,18 @@ # === Examples # # class { 'openstack::all': -# public_address => '192.168.0.3', -# public_interface => 'eth0', -# private_interface => 'eth1', +# public_address => '192.168.1.1', +# mysql_root_password => 'changeme', +# rabbit_password => 'changeme', +# keystone_db_password => 'changeme', +# keystone_admin_token => '12345', # admin_email => 'my_email@mw.com', # admin_password => 'my_admin_password', -# libvirt_type => 'kvm', +# nova_db_password => 'changeme', +# nova_user_password => 'changeme', +# glance_db_password => 'changeme', +# glance_user_password => 'changeme', +# secret_key => 'dummy_secret_key', # } # # === Authors @@ -25,57 +31,65 @@ # class openstack::all ( # Network - $public_address = $::openstack::params::public_address, - $public_interface = $::openstack::params::public_interface, - $private_interface = $::openstack::params::private_interface, - $fixed_range = $::openstack::params::fixed_range, - $network_manager = $::openstack::params::network_manager, - $network_config = $::openstack::params::network_config, - $auto_assign_floating_ip = $::openstack::params::auto_assign_floating_ip, - $floating_range = $::openstack::params::floating_range, - $create_networks = $::openstack::params::create_networks, - $num_networks = $::openstack::params::num_networks, + $public_interface = 'eth0', + $private_interface = 'eth1', + $fixed_range = '10.0.0.0/24', + $network_manager = 'nova.network.manager.FlatDHCPManager', + $network_config = {}, + $auto_assign_floating_ip = false, + $floating_range = false, + $create_networks = true, + $num_networks = 1, # MySQL - $db_type = $::openstack::params::db_type, - $mysql_root_password = $::openstack::params::mysql_root_password, - $mysql_account_security = $::openstack::params::mysql_account_security, + $db_type = 'mysql', + $mysql_account_security = true, + $allowed_hosts = ['127.0.0.%'], # Rabbit - $rabbit_password = $::openstack::params::rabbit_password, - $rabbit_user = $::openstack::params::rabbit_user, + $rabbit_user = 'nova', # Keystone - $admin_email = $::openstack::params::admin_email, - $admin_password = $::openstack::params::admin_password, - $keystone_db_user = $::openstack::params::keystone_db_user, - $keystone_db_password = $::openstack::params::keystone_db_password, - $keystone_db_dbname = $::openstack::params::keystone_db_dbname, - $keystone_admin_token = $::openstack::params::keystone_admin_token, + $keystone_db_user = 'keystone', + $keystone_db_dbname = 'keystone', # Nova - $nova_db_user = $::openstack::params::nova_db_user, - $nova_db_password = $::openstack::params::nova_db_password, - $nova_user_password = $::openstack::params::nova_user_password, - $nova_db_dbname = $::openstack::params::nova_db_dbname, - $purge_nova_config = $::openstack::params::purge_nova_config, + $nova_db_user = 'nova', + $nova_db_dbname = 'nova', + $purge_nova_config = true, # Glance - $glance_db_user = $::openstack::params::glance_db_user, - $glance_db_password = $::openstack::params::glance_db_password, - $glance_db_dbname = $::openstack::params::glance_db_dbname, - $glance_user_password = $::openstack::params::glance_user_password, + $glance_db_user = 'glance', + $glance_db_dbname = 'glance', # Horizon - $secret_key = $::openstack::params::secret_key, - $cache_server_ip = $::openstack::params::cache_server_ip, - $cache_server_port = $::openstack::params::cache_server_port, - $swift = $::openstack::params::swift, - $quantum = $::openstack::params::quantum, - $horizon_app_links = $::openstack::params::horizon_app_links, + $cache_server_ip = '127.0.0.1', + $cache_server_port = '11211', + $swift = false, + $quantum = false, + $horizon_app_links = undef, # Virtaulization - $libvirt_type = $::openstack::params::libvirt_type, + $libvirt_type = 'kvm', # Volume - $nova_volume = $::openstack::params::nova_volume, + $nova_volume = 'nova-volumes', # VNC - $vnc_enabled = $::openstack::params::vnc_enabled, + $vnc_enabled = true, # General - $enabled = $::openstack::params::enabled, - $verbose = $::openstack::params::verbose + $enabled = true, + $verbose = false, + # Network Required + $public_address, + # MySQL Required + $mysql_root_password, + # Rabbit Required + $rabbit_password, + # Keystone Required + $keystone_db_password, + $keystone_admin_token, + $admin_email, + $admin_password, + # Nova Required + $nova_db_password, + $nova_user_password, + # Glance Required + $glance_db_password, + $glance_user_password, + # Horizon Required + $secret_key, ) inherits openstack::params { # set up mysql server @@ -94,6 +108,7 @@ class openstack::all ( nova_db_user => $nova_db_user, nova_db_password => $nova_db_password, nova_db_dbname => $nova_db_dbname, + allowed_hosts => $allowed_hosts, } } } @@ -154,6 +169,8 @@ class openstack::all ( create_networks => $create_networks, num_networks => $num_networks, multi_host => false, + # Database + db_host => '127.0.0.1', # Nova nova_user_password => $nova_user_password, nova_db_password => $nova_db_password, @@ -181,6 +198,7 @@ class openstack::all ( network_manager => $network_manager, network_config => $network_config, multi_host => false, + internal_address => '127.0.0.1', # Virtualization libvirt_type => $libvirt_type, # Volumes diff --git a/manifests/compute.pp b/manifests/compute.pp index 172d1c1..318b0df 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -16,44 +16,51 @@ # === Examples # # class { 'openstack::compute': -# libvirt_type => 'kvm', +# internal_address => '192.168.1.12', +# vncproxy_host => '192.168.1.1', +# nova_user_password => 'changeme', +# rabbit_password => 'changeme', # } # class openstack::compute ( # Network - $public_address = $::openstack::params::public_address, - $public_interface = $::openstack::params::public_interface, - $private_interface = $::openstack::params::private_interface, - $internal_address = $::openstack::params::internal_address, - $fixed_range = $::openstack::params::fixed_range, - $network_manager = $::openstack::params::network_manager, - $multi_host = $::openstack::params::multi_host, - $network_config = $::openstack::params::network_config, + $public_address = undef, + $public_interface = 'eth0', + $private_interface = 'eth1', + $fixed_range = '10.0.0.0/24', + $network_manager = 'nova.network.manager.FlatDHCPManager', + $multi_host = false, + $network_config = {}, # DB - $sql_connection = $::openstack::params::sql_connection, + $sql_connection = false, # Nova - $nova_user_password = $::openstack::params::nova_user_password, - $purge_nova_config = $::openstack::params::purge_nova_config, + $purge_nova_config = true, # Rabbit - $rabbit_host = $::openstack::params::rabbit_host, - $rabbit_password = $::openstack::params::rabbit_password, - $rabbit_user = $::openstack::params::rabbit_user, + $rabbit_host = false, + $rabbit_user = 'nova', # Glance $glance_api_servers = false, # Virtualization - $libvirt_type = $::openstack::params::libvirt_type, + $libvirt_type = 'kvm', # VNC - $vncproxy_host = $::openstack::params::vncproxy_host, - $vnc_enabled = $::openstack::params::vnc_enabled, - $vncserver_proxyclient_address = $::openstack::params::vncserver_proxyclient_address, + $vnc_enabled = true, + $vncserver_listen = undef, + $vncproxy_host = undef, + $vncserver_proxyclient_address = undef, # Volumes - $manage_volumes = $::openstack::params::manage_volumes, - $nova_volume = $::openstack::params::nova_volume, + $manage_volumes = true, + $nova_volume = 'nova-volumes', # General - $verbose = $::openstack::params::verbose, - $exported_resources = $::openstack::params::exported_resources, - $enabled = $::openstack::params::enabled + $verbose = false, + $exported_resources = true, + $enabled = true, + # Required Network + $internal_address, + # Required Nova + $nova_user_password, + # Required Rabbit + $rabbit_password ) inherits openstack::params { # @@ -90,10 +97,41 @@ class openstack::compute ( } } + # Configure VNC variables + if ($vnc_enabled == true) { + if ($vncserver_listen == undef) { + $real_vncserver_listen = $internal_address + } else { + $real_vncserver_listen = $vncserver_listen + } + + if ($vncserver_proxyclient_address == undef) { + $real_vncserver_proxyclient_address = $internal_address + } else { + $real_vncserver_proxyclient_address = $vncserver_proxyclient_address + } + + if ($vncproxy_host == undef) { + if ($multi_host == true and $public_address != undef) { + $real_vncproxy_host = $public_address + } else { + fail('vncproxy_host must be set.') + } + } else { + # This should be the public IP of the cloud controller... + $real_vncproxy_host = $vncproxy_host + } + } else { + $real_vncserver_listen = undef + $real_vncserver_proxyclient_address = undef + $real_vncproxy_host = undef + } + if $enabled { class { 'openstack::nova::compute': # Network public_address => $public_address, + internal_address => $internal_address, private_interface => $private_interface, public_interface => $public_interface, fixed_range => $fixed_range, @@ -108,9 +146,9 @@ class openstack::compute ( iscsi_ip_address => $iscsi_ip_address, # VNC vnc_enabled => $vnc_enabled, - vncserver_listen => $vnc_server_listen, - vncserver_proxyclient_address => $vncserver_proxyclient_address, - vncproxy_host => $vncproxy_host, + vncserver_listen => $real_vncserver_listen, + vncserver_proxyclient_address => $real_vncserver_proxyclient_address, + vncproxy_host => $real_vncproxy_host, # Nova nova_user_password => $nova_user_password, # General diff --git a/manifests/controller.pp b/manifests/controller.pp index a2189a0..91d0127 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -8,68 +8,95 @@ # === Examples # # class { 'openstack::controller': -# public_address => '192.168.0.3', -# public_interface => 'eth0', -# private_interface => 'eth1', -# admin_email => 'my_email@mw.com', -# admin_password => 'my_admin_password', +# public_address => '192.168.0.3', +# mysql_root_password => 'changeme', +# allowed_hosts => ['127.0.0.%', '192.168.1.%'], +# admin_email => 'my_email@mw.com', +# admin_password => 'my_admin_password', +# keystone_db_password => 'changeme', +# keystone_admin_token => '12345', +# glance_db_password => 'changeme', +# glance_user_password => 'changeme', +# nova_db_password => 'changeme', +# nova_user_password => 'changeme', +# secret_key => 'dummy_secret_key', # } # class openstack::controller ( # Network - $public_address = $::openstack::params::public_address, - $public_interface = $::openstack::params::public_interface, - $private_interface = $::openstack::params::private_interface, - $internal_address = $::openstack::params::internal_address, - $admin_address = $::openstack::params::admin_address, - $network_manager = $::openstack::params::network_manager, - $fixed_range = $::openstack::params::fixed_range, - $floating_range = $::openstack::params::floating_range, - $create_networks = $::openstack::params::create_networks, - $num_networks = $::openstack::params::num_networks, - $multi_host = $::openstack::params::multi_host, - $auto_assign_floating_ip = $::openstack::params::auto_assign_floating_ip, - $network_config = $::openstack::params::network_config, + $public_interface = 'eth0', + $private_interface = 'eth1', + $internal_address = undef, + $admin_address = undef, + $network_manager = 'nova.network.manager.FlatDHCPManager', + $fixed_range = '10.0.0.0/24', + $floating_range = false, + $create_networks = true, + $num_networks = 1, + $multi_host = false, + $auto_assign_floating_ip = false, + $network_config = {}, # Database - $db_type = $::openstack::params::db_type, - $mysql_root_password = $::openstack::params::mysql_root_password, - $mysql_account_security = $::openstack::params::mysql_account_security, - $mysql_bind_address = $::openstack::params::mysql_bind_address, + $db_type = 'mysql', + $mysql_account_security = true, + $mysql_bind_address = '0.0.0.0', + $allowed_hosts = ['127.0.0.%'], # Keystone - $admin_email = $::openstack::params::admin_email, - $admin_password = $::openstack::params::admin_password, - $keystone_db_user = $::openstack::params::keystone_db_user, - $keystone_db_password = $::openstack::params::keystone_db_password, - $keystone_db_dbname = $::openstack::params::keystone_db_dbname, - $keystone_admin_token = $::openstack::params::keystone_admin_token, + $keystone_db_user = 'keystone', + $keystone_db_dbname = 'keystone', # Glance - $glance_db_user = $::openstack::params::glance_db_user, - $glance_db_password = $::openstack::params::glance_db_password, - $glance_db_dbname = $::openstack::params::glance_db_dbname, - $glance_user_password = $::openstack::params::glance_user_password, - $glance_api_servers = $::openstack::params::glance_api_servers, + $glance_db_user = 'glance', + $glance_db_dbname = 'glance', + $glance_api_servers = undef, # Nova - $nova_db_user = $::openstack::params::nova_db_user, - $nova_db_password = $::openstack::params::nova_db_password, - $nova_user_password = $::openstack::params::nova_user_password, - $nova_db_dbname = $::openstack::params::nova_db_dbname, - $purge_nova_config = $::openstack::params::purge_nova_config, + $nova_db_user = 'nova', + $nova_db_dbname = 'nova', + $purge_nova_config = true, # Rabbit - $rabbit_password = $::openstack::params::rabbit_password, - $rabbit_user = $::openstack::params::rabbit_user, + $rabbit_password, + $rabbit_user = 'nova', # Horizon - $secret_key = $::openstack::params::secret_key, - $cache_server_ip = $::openstack::params::cache_server_ip, - $cache_server_port = $::openstack::params::cache_server_port, - $swift = $::openstack::params::swift, - $quantum = $::openstack::params::quantum, - $horizon_app_links = $::openstack::params::horizon_app_links, + $cache_server_ip = '127.0.0.1', + $cache_server_port = '11211', + $swift = false, + $quantum = false, + $horizon_app_links = undef, # General - $verbose = $::openstack::params::verbose, - $exported_resources = $::openstack::params::exported_resources, - $enabled = $::openstack::params::enabled + $verbose = false, + $exported_resources = true, + $enabled = true, + # Required Network + $public_address, + # Required Database + $mysql_root_password, + # Required Keystone + $admin_email, + $admin_password, + $keystone_db_password, + $keystone_admin_token, + # Required Glance + $glance_db_password, + $glance_user_password, + # Required Nova + $nova_db_password, + $nova_user_password, + # Required Horizon + $secret_key ) inherits openstack::params { + # Configure admin_address and internal address if needed. + if (admin_address == undef) { + $real_admin_address = $public_address + } else { + $real_admin_address = $admin_address + } + + if (internal_address == undef) { + $real_internal_address = $public_address + } else { + $real_internal_address = $internal_address + } + ####### DATABASE SETUP ###### if $enabled { # set up mysql server @@ -79,6 +106,7 @@ class openstack::controller ( mysql_root_password => $mysql_root_password, mysql_bind_address => $mysql_bind_address, mysql_account_security => $mysql_account_security, + allowed_hosts => $allowed_hosts, keystone_db_user => $keystone_db_user, keystone_db_password => $keystone_db_password, keystone_db_dbname => $keystone_db_dbname, @@ -140,6 +168,8 @@ class openstack::controller ( if $enabled { class { 'openstack::nova::controller': + # Database + db_host => '127.0.0.1', # Network network_manager => $network_manager, network_config => $network_config, diff --git a/manifests/db/mysql.pp b/manifests/db/mysql.pp index aace0fa..967c5b3 100644 --- a/manifests/db/mysql.pp +++ b/manifests/db/mysql.pp @@ -11,7 +11,7 @@ # === Example # # class { 'openstack::db::mysql': -# mysql_root_password => 'changeme', +# mysql_root_password => 'changeme', # keystone_db_password => 'changeme', # glance_db_password => 'changeme', # nova_db_password => 'changeme', @@ -21,22 +21,24 @@ class openstack::db::mysql ( # MySQL - $mysql_bind_address = $::openstack::params::mysql_bind_address, - $allowed_hosts = $::openstack::params::mysql_allowed_hosts, - $mysql_root_password = $::openstack::params::mysql_root_password, - $mysql_account_security = $::openstack::params::mysql_account_security, + $mysql_bind_address = '0.0.0.0', + $mysql_account_security = true, # Keystone - $keystone_db_user = $::openstack::params::keystone_db_user, - $keystone_db_dbname = $::openstack::params::keystone_db_dbname, - $keystone_db_password = $::openstack::params::keystone_db_password, + $keystone_db_user = 'keystone', + $keystone_db_dbname = 'keystone', # Glance - $glance_db_user = $::openstack::params::glance_db_user, - $glance_db_dbname = $::openstack::params::glance_db_dbname, - $glance_db_password = $::openstack::params::glance_db_password, + $glance_db_user = 'glance', + $glance_db_dbname = 'glance', # Nova - $nova_db_user = $::openstack::params::nova_db_user, - $nova_db_dbname = $::openstack::params::nova_db_dbname, - $nova_db_password = $::openstack::params::nova_db_password + $nova_db_user = 'nova', + $nova_db_dbname = 'nova', + # Required MySQL + $allowed_hosts, + # Passwords + $mysql_root_password, + $keystone_db_password, + $glance_db_password, + $nova_db_password ) { # Install and configure MySQL Server diff --git a/manifests/glance.pp b/manifests/glance.pp index d3124d6..8513778 100644 --- a/manifests/glance.pp +++ b/manifests/glance.pp @@ -18,23 +18,35 @@ # glance_user_password => 'changeme', # db_password => 'changeme', # public_address => '192.168.1.1', -# admin_addresss => '192.168.1.1', -# internal_address => '192.168.1.1', +# db_host => '127.0.0.1', # } class openstack::glance ( - $db_type = $::openstack::params::db_type, - $db_host = $::openstack::params::db_host, - $glance_db_user = $::openstack::params::glance_db_user, - $glance_db_dbname = $::openstack::params::glance_db_dbname, - $glance_user_password = $::openstack::params::glance_user_password, - $glance_db_password = $::openstack::params::glance_db_password, - $public_address = $::openstack::params::public_address, - $admin_address = $::openstack::params::admin_address, - $internal_address = $::openstack::params::internal_address, - $verbose = $::openstack::params::verbose + $db_type = 'mysql', + $glance_db_user = 'glance', + $glance_db_dbname = 'glance', + $admin_address = undef, + $internal_address = undef, + $verbose = false, + $db_host, + $glance_user_password, + $glance_db_password, + $public_address, ) inherits openstack::params { + # Configure admin_address and internal address if needed. + if (admin_address == undef) { + $real_admin_address = $public_address + } else { + $real_admin_address = $admin_address + } + + if (internal_address == undef) { + $real_internal_address = $public_address + } else { + $real_internal_address = $internal_address + } + # Configure the db string case $db_type { 'mysql': { @@ -70,8 +82,8 @@ class openstack::glance ( class { 'glance::keystone::auth': password => $glance_user_password, public_address => $public_address, - admin_address => $admin_address, - internal_address => $internal_address, + admin_address => $real_admin_address, + internal_address => $real_internal_address, } } diff --git a/manifests/horizon.pp b/manifests/horizon.pp index 5dfabd0..43e5055 100644 --- a/manifests/horizon.pp +++ b/manifests/horizon.pp @@ -8,14 +8,20 @@ # # See params.pp # +# === Examples +# +# class { 'openstack::horizon': +# secret_key => 'dummy_secret_key', +# } +# class openstack::horizon ( - $secret_key = $::openstack::params::secret_key, - $cache_server_ip = $::openstack::params::cache_server_ip, - $cache_server_port = $::openstack::params::cache_server_port, - $swift = $::openstack::params::swift, - $quantum = $::openstack::params::quantum, - $horizon_app_links = $::openstack::params::horizon_app_links + $cache_server_ip = '127.0.0.1', + $cache_server_port = '11211', + $swift = false, + $quantum = false, + $horizon_app_links = undef, + $secret_key ) { class { 'memcached': diff --git a/manifests/keystone.pp b/manifests/keystone.pp index d7db56d..97f2757 100644 --- a/manifests/keystone.pp +++ b/manifests/keystone.pp @@ -10,31 +10,43 @@ # === Example # # class { 'openstack::keystone': -# db_password => 'changeme', -# admin_token => '12345', -# admin_email => 'root@localhost', -# admin_password => 'changeme', -# public_address => '192.168.1.1', -# admin_addresss => '192.168.1.1', -# internal_address => '192.168.1.1', +# db_host => '127.0.0.1', +# keystone_db_password => 'changeme', +# keystone_admin_token => '12345', +# admin_email => 'root@localhost', +# admin_password => 'changeme', +# public_address => '192.168.1.1', # } class openstack::keystone ( - $db_type = $::openstack::params::db_type, - $db_host = $::openstack::params::db_host, - $keystone_db_user = $::openstack::params::keystone_db_user, - $keystone_db_password = $::openstack::params::keystone_db_password, - $keystone_db_dbname = $::openstack::params::keystone_db_dbname, - $keystone_admin_tenant = $::openstack::params::keystone_admin_tenant, - $keystone_admin_token = $::openstack::params::keystone_admin_token, - $admin_email = $::openstack::params::admin_email, - $admin_password = $::openstack::params::admin_password, - $public_address = $::openstack::params::public_address, - $admin_address = $::openstack::params::admin_address, - $internal_address = $::openstack::params::internal_address, - $verbose = $::openstack::params::verbose + $db_type = 'mysql', + $keystone_db_user = 'keystone', + $keystone_db_dbname = 'keystone', + $keystone_admin_tenant = 'admin', + $admin_address = undef, + $internal_address = undef, + $verbose = false, + $db_host, + $keystone_db_password, + $keystone_admin_token, + $admin_email, + $admin_password, + $public_address ) inherits openstack::params { + # Configure admin_address and internal address if needed. + if (admin_address == undef) { + $real_admin_address = $public_address + } else { + $real_admin_address = $admin_address + } + + if (internal_address == undef) { + $real_internal_address = $public_address + } else { + $real_internal_address = $internal_address + } + # Install and configure Keystone class { '::keystone': log_verbose => $verbose, @@ -53,13 +65,12 @@ class openstack::keystone ( # Setup the Keystone Identity Endpoint class { 'keystone::endpoint': public_address => $public_address, - admin_address => $admin_address, - internal_address => $internal_address, + admin_address => $real_admin_address, + internal_address => $real_internal_address, } # Configure the Keystone database case $db_type { - 'mysql': { class { 'keystone::config::mysql': user => $keystone_db_user, @@ -68,7 +79,6 @@ class openstack::keystone ( dbname => $keystone_db_dbname, } } - } } diff --git a/manifests/nova/compute.pp b/manifests/nova/compute.pp index a5d4f23..8a81473 100644 --- a/manifests/nova/compute.pp +++ b/manifests/nova/compute.pp @@ -7,47 +7,93 @@ # # See params.pp # +# === Examples +# +# class { 'openstack::nova::compute': +# internal_address => '192.168.2.2', +# vncproxy_host => '192.168.1.1', +# nova_user_password => 'changeme', +# } class openstack::nova::compute ( # Network - $public_address = $::openstack::params::public_address, - $private_interface = $::openstack::params::private_interface, - $public_interface = $::openstack::params::public_interface, - $fixed_range = $::openstack::params::fixed_range, - $network_manager = $::openstack::params::network_manager, - $network_config = $::openstack::params::network_config, - $multi_host = $::openstack::params::multi_host, + $public_address = undef, + $public_interface = 'eth0', + $private_interface = 'eth1', + $fixed_range = '10.0.0.0/24', + $network_manager = 'nova.network.manager.FlatDHCPManager', + $network_config = {}, + $multi_host = false, # Virtualization - $libvirt_type = $::openstack::params::libvirt_type, + $libvirt_type = 'kvm', # Volumes - $nova_volume = $::openstack::params::nova_volume, - $manage_volumes = $::openstack::params::manage_volume, - $iscsi_ip_address = $::openstack::params::iscsi_ip_address, + $nova_volume = 'nova-volumes', + $manage_volumes = true, + $iscsi_ip_address = undef, # VNC - $vnc_enabled = $::openstack::params::vnc_enabled, - $vncserver_listen = $::openstack::params::vncserver_listen, - $vncserver_proxyclient_address = $::openstack::params::vncserver_proxyclient_address, - $vncproxy_host = $::openstack::params::vncproxy_host, - # Nova - $nova_user_password = $::openstack::params::nova_user_password, + $vnc_enabled = true, + $vncserver_listen = undef, + $vncserver_proxyclient_address = undef, + $vncproxy_host = undef, # General - $verbose = $::openstack::params::verbose, - $exported_resources = $::openstack::params::exported_resources, - $enabled = $::openstack::params::enabled + $verbose = false, + $exported_resources = true, + $enabled = true, + # Required Network + $internal_address, + # Required Nova + $nova_user_password ) inherits openstack::params { + # Set iscsi ip address if not set + if ($iscsi_ip_address == undef) { + $real_iscsi_ip_address = $internal_address + } else { + $real_iscsi_ip_address = $iscsi_ip_address + } + + # Configure VNC variables + if ($vnc_enabled == true) { + if ($vncserver_listen == undef) { + $real_vncserver_listen = $internal_address + } else { + $real_vncserver_listen = $vncserver_listen + } + + if ($vncserver_proxyclient_address == undef) { + $real_vncserver_proxyclient_address = $internal_address + } else { + $real_vncserver_proxyclient_address = $vncserver_proxyclient_address + } + + if ($vncproxy_host == undef) { + if ($multi_host == true and $public_address != undef) { + $real_vncproxy_host = $public_address + } else { + fail('vncproxy_host must be set.') + } + } else { + # This should be the public IP of the cloud controller... + $real_vncproxy_host = $vncproxy_host + } + } else { + $real_vncserver_listen = undef + $real_vncserver_proxyclient_address = undef + $real_vncproxy_host = undef + } + # Install / configure nova-compute class { '::nova::compute': enabled => true, vnc_enabled => $vnc_enabled, - vncserver_proxyclient_address => $vncserver_proxyclient_address, - vncproxy_host => $vncproxy_host, + vncserver_proxyclient_address => $real_vncserver_proxyclient_address, + vncproxy_host => $real_vncproxy_host, } # Configure libvirt for nova-compute class { 'nova::compute::libvirt': libvirt_type => $libvirt_type, - vncserver_listen => $vncserver_listen, + vncserver_listen => $real_vncserver_listen, } # if the compute node should be configured as a multi-host diff --git a/manifests/nova/controller.pp b/manifests/nova/controller.pp index 0ff235f..bc23cf3 100644 --- a/manifests/nova/controller.pp +++ b/manifests/nova/controller.pp @@ -8,43 +8,71 @@ # # See params.pp # +# === Examples +# +# class { 'openstack::nova::controller': +# public_address => '192.168.1.1', +# db_host => '127.0.0.1', +# rabbit_password => 'changeme', +# nova_user_password => 'changeme', +# nova_db_password => 'changeme', +# } +# class openstack::nova::controller ( # Network - $network_manager = $::openstack::params::network_manager, - $network_config = $::openstack::params::network_config, - $private_interface = $::openstack::params::private_interface, - $public_interface = $::openstack::params::public_interface, - $floating_range = $::openstack::params::floating_range, - $fixed_range = $::openstack::params::fixed_range, - $public_address = $::openstack::params::public_address, - $admin_address = $::openstack::params::admin_address, - $internal_address = $::openstack::params::internal_address, - $auto_assign_floating_ip = $::openstack::params::auto_assign_floating_ip, - $create_networks = $::openstack::params::create_networks, - $num_networks = $::openstack::params::num_networks, - $multi_host = $::openstack::params::multi_host, + $network_manager = 'nova.network.manager.FlatDHCPManager', + $network_config = {}, + $public_interface = 'eth0', + $private_interface = 'eth1', + $fixed_range = '10.0.0.0/24', + $floating_range = false, + $admin_address = undef, + $internal_address = undef, + $auto_assign_floating_ip = false, + $create_networks = true, + $num_networks = 1, + $multi_host = false, # Nova - $nova_user_password = $::openstack::params::nova_user_password, - $nova_db_user = $::openstack::params::nova_db_user, - $nova_db_password = $::openstack::params::nova_db_password, - $nova_db_dbname = $::openstack::params::nova_db_dbname, + $nova_db_user = 'nova', + $nova_db_dbname = 'nova', # Rabbit - $rabbit_user = $::openstack::params::rabbit_user, - $rabbit_password = $::openstack::params::rabbit_password, + $rabbit_user = 'nova', # Database - $db_type = $::openstack::params::db_type, - $db_host = $::openstack::params::db_host, + $db_type = 'mysql', # Glance - $glance_api_servers = $::openstack::params::glance_api_servers, + $glance_api_servers = undef, # VNC - $vnc_enabled = $::openstack::params::vnc_enabled, + $vnc_enabled = true, # General - $verbose = $::openstack::params::verbose, - $enabled = $::openstack::params::enabled, - $exported_resources = $::openstack::params::exported_resources + $verbose = false, + $enabled = true, + $exported_resources = true, + # Network Required + $public_address, + # Database Required + $db_host, + # Rabbit Required + $rabbit_password, + # Nova Required + $nova_user_password, + $nova_db_password, + ) inherits openstack::params { + # Configure admin_address and internal address if needed. + if (admin_address == undef) { + $real_admin_address = $public_address + } else { + $real_admin_address = $admin_address + } + + if (internal_address == undef) { + $real_internal_address = $public_address + } else { + $real_internal_address = $internal_address + } + # Configure the db string case $db_type { 'mysql': { @@ -52,8 +80,11 @@ class openstack::nova::controller ( } } - # Might need fixed - # $glance_api_servers = "${internal_address}:9292" + if ($glance_api_servers == undef) { + $real_glance_api_servers = "${public_address}:9292" + } else { + $real_glance_api_servers = $glance_api_servers + } if ($export_resources) { # export all of the things that will be needed by the clients @@ -63,7 +94,7 @@ class openstack::nova::controller ( @@nova_config { 'sql_connection': value => $nova_db } Nova_config <| title == 'sql_connection' |> - @@nova_config { 'glance_api_servers': value => $glance_api_servers } + @@nova_config { 'glance_api_servers': value => $real_glance_api_servers } Nova_config <| title == 'glance_api_servers' |> @@nova_config { 'novncproxy_base_url': value => "http://${public_address}:6080/vnc_auto.html" } @@ -73,7 +104,7 @@ class openstack::nova::controller ( $rabbit_connection = false } else { $sql_connection = $nova_db - $glance_connection = $glance_api_servers + $glance_connection = $real_glance_api_servers $rabbit_connection = $internal_address } @@ -148,7 +179,6 @@ class openstack::nova::controller ( class { [ 'nova::scheduler', 'nova::objectstore', - 'nova::volume', 'nova::cert', 'nova::consoleauth' ]: diff --git a/manifests/params.pp b/manifests/params.pp deleted file mode 100644 index 0d1ef06..0000000 --- a/manifests/params.pp +++ /dev/null @@ -1,362 +0,0 @@ -# -# == Class: Parameters -# -# Convenient location to store default parameters. -# Able to be overridden in individual classes. -# -# === Parameters -# -# ==== General -# -# [enabled] -# - Whether services should be enabled. This parameter can be used to -# implement services in active-passive modes for HA. Optional. -# - Defaults to true. -# -# [verbose] -# - If the services should log verbosely. Optional. -# - Defaults to false. -# -# [exported_resources] -# - Whether or not to use exported resources -# - Defautlts to true -# -# ==== Network -# -# [public_address] -# - Public address used by vnchost. Optional. -# - Defaults to ipaddress_eth0 -# -# [public_interface] -# - The interface used to route public traffic by the network service. Optional. -# - Defaults to eth0 -# -# [private_interface] -# - The private interface used to bridge the VMs into a common network. Optional. -# - Defaults to eth1 -# -# [internal_address] -# - Internal address used for management. -# - Defaults to ipaddress_eth1 -# -# [public_address] -# [admin_address] -# - IP addresses for Keystone services -# - default: ipaddress_eth0 -# -# [floating_range] -# - The floating ip range to be created. If it is false, then no floating ip range is created. Optional. -# - Defaults to false. -# -# [fixed_range] -# - The fixed private ip range to be created for the private VM network. Optional. -# - Defaults to '10.0.0.0/24'. -# -# [network_manager] -# - The network manager to use for the nova network service. Optional. -# - Defaults to 'nova.network.manager.FlatDHCPManager'. -# -# [iscsi_ip_address] -# - The IP address to use in the iscsi address -# - Defaults to $internal_address -# -# [auto_assign_floating_ip] -# - Rather configured to automatically allocate and assign a floating IP address to virtual instances when they are launched. -# - Defaults to false. -# -# [network_config] -# - Used to specify network manager specific parameters. Optional. -# - Defualts to {}. -# -# [create_networks] -# - Rather network and floating ips should be created. -# - Defaults to true -# -# [num_networks] -# - Number of networks that fixed range should be split into. -# - Defaults to 1 -# -# [multi_host] -# - Node should support multi-host networking mode for HA. -# - Optional. Defaults to false. -# -# -# ==== Virtualization -# -# [libvirt_type] -# - The virualization type being controlled by libvirt. Optional. -# - Defaults to 'kvm'. -# -# ==== Volumes -# -# [nova_volume] -# - The name of the volume group to use for nova volume allocation. Optional. -# - Defaults to 'nova-volumes'. -# -# [manage_volumes] -# - Rather nova-volume should be enabled on this compute node. -# - Defaults to false. -# -# ==== Database -# -# [db_type] -# - which type of database to use -# - Defaults to 'mysql' -# -# [db_host] -# - where the db server is located -# - default: 127.0.0.1 -# -# [sql_connection] -# - SQL connection information. -# - Defaults to false which indicates that exported resources will be used to determine connection information. -# -# ==== MySQL -# -# [mysql_root_password] -# - The root password to set for the mysql database. Optional. -# - Defaults to 'sql_pass'. -# -# [mysql_bind_address] -# - address for mysql to listen on -# - default: 0.0.0.0 -# -# [mysql_account_security] -# - whether to secure the mysql installation -# - default: true -# -# [allowed_hosts] -# - array of hosts that can access the mysql server -# - default: ['127.0.0.1'] -# -# ==== Rabbit -# -# [rabbit_password] -# - The password to use for the rabbitmq user. Optional. -# - Defaults to 'rabbit_pw' -# -# [rabbit_user] -# - The rabbitmq user to use for auth. Optional. -# - Defaults to 'nova'. -# -# [admin_email] -# - The admin's email address. Optional. -# - Defaults to 'root@localhost' -# -# [rabbit_host] -# - RabbitMQ host. False indicates it should be collected. -# - Defaults to false which indicates that exported resources will be used to determine connection information. -# -# ==== Keystone -# -# [keystone_db_user] -# - The name of the Keystone db user -# - Defaults to 'keystone' -# -# [keystone_db_password] -# - The default password for the keystone db user. Optional. -# - Defaults to 'keystone_pass'. -# -# [keystone_db_dbname] -# - The Keystone database name -# - Defaults to 'keystone' -# -# [keystone_admin_tenant] -# - The admin tenant name in Keystone -# - Defaults to 'admin' -# -# [keystone_admin_token] -# - The default auth token for keystone. Optional. -# - Defaults to 'keystone_admin_token'. -# -# [admin_email] -# - The email address for the Keystone admin user -# - Defaults to 'root@localhost' -# -# [admin_password] -# - The default password of the keystone admin. Optional. -# - Defaults to 'ChangeMe'. -# -# ==== Nova -# -# [nova_db_user] -# - The database user for Nova -# - Defaults to 'nova' -# -# [nova_db_password] -# - The nova db password. Optional. -# - Defaults to 'nova_pass'. -# -# [nova_user_password] -# - The password of the keystone user for the nova service. Optional. -# - Defaults to 'nova_pass'. -# -# [nova_db_dbname] -# - The database name for the Nova database -# - Defaults to 'nova' -# -# [purge_nova_config] -# - Whether unmanaged nova.conf entries should be purged. Optional. -# - Defaults to true. -# -# ==== Glance -# -# [glance_db_user] -# - The database user for Glance -# - Defaults to 'glance' -# -# [glance_db_password] -# - The password for the db user for glance. Optional. -# - Defaults to 'glance_pass'. -# -# [glance_user_password] -# - The password of the glance service user. Optional. -# - Defaults to 'glance_pass'. -# -# [glance_db_dbname] -# - The database name for the Glance database -# - Defaults to 'glance' -# -# [glance_api_servers] -# - List of glance api servers of the form HOST:PORT -# - Defaults to false which indicates that exported resources will be used to determine connection information. -# -# === Horizon related config - assumes puppetlabs-horizon code -# -# [secret_key] -# - secret key to encode cookies, -# - Defaults to 'dummy_secret_key' -# -# [cache_server_ip] -# - local memcached instance ip -# - Defaults to '127.0.0.1' -# -# [cache_server_port] -# - local memcached instance port -# - Defaults to '11211' -# -# [swift] -# - (bool) is swift installed -# - Defaults to false -# -# [quantum] -# - (bool) is quantum installed -# - Defaults to false -# -# [horizon_app_links] -# - array as in '[ ["Nagios","http://nagios_addr:port/path"],["Ganglia","http://ganglia_addr"] ]' -# - an array of arrays, that can be used to add call-out links to the dashboard for other apps. -# - There is no specific requirement for these apps to be for monitoring, that's just the defacto purpose. -# - Each app is defined in two parts, the display name, and the URI -# - Defaults to false -# -# === VNC -# -# [vnc_enabled] -# - Rather vnc console should be enabled. -# - Defaults to 'true', -# -# [vncserver_listen] -# - The address on the compute node where VNC should listen -# - Defaults to $internal_address -# -# [vncserver_proxyclient_address] -# - The address where the controller should contact the vnc server on the compute node -# - Defaults to $internal_address -# -# [vncproxy_host] -# - Host that serves as vnc proxy. This should be the public address of your controller. -# - Defaults to $public_address -# - -class openstack::params { - - # Generic - $enabled = true - $verbose = false - $exported_resources = true - - # Network - $public_address = $::ipaddress_eth0 - $public_interface = 'eth0' - $internal_address = $::ipaddress_eth1 - $admin_address = $internal_address - $private_interface = 'eth2' - $fixed_range = '192.168.30.0/24' - $floating_range = false - $network_manager = 'nova.network.manager.FlatDHCPManager' - $iscsi_ip_address = $internal_address - $auto_assign_floating_ip = false - $network_config = {} - $create_networks = true - $num_networks = 1 - $multi_host = false - - # Virtualization - $libvirt_type = 'qemu' - - # Volumes - $nova_volume = 'nova-volumes' - $manage_volumes = false - - # Database - $db_type = 'mysql' - $db_host = $internal_address - $sql_connection = false - - # MySQL params - $mysql_root_password = 'sql_pass' - $mysql_bind_address = '0.0.0.0' - $mysql_allowed_hosts = ['127.0.0.%', '10.0.0.%'] - $mysql_account_security = true - - # Rabbit params - $rabbit_password = 'rabbit_pw' - $rabbit_user = 'nova' - $rabbit_host = false - - # Keystone params - $keystone_db_user = 'keystone' - $keystone_db_password = 'keystone_pass' - $keystone_db_dbname = 'keystone' - $keystone_admin_tenant = 'admin' - $keystone_admin_token = 'keystone_admin_token' - $admin_email = 'root@localhost' - $admin_password = 'ChangeMe' - - # Glance params - $glance_db_user = 'glance' - $glance_db_password = 'glance_pass' - $glance_user_password = 'glance_pass' - $glance_db_dbname = 'glance' - $glance_api_servers = "${public_address}:9292" - - # Nova params - $nova_db_user = 'nova' - $nova_db_password = 'nova_pass' - $nova_user_password = 'nova_pass' - $nova_db_dbname = 'nova' - $purge_nova_config = true - - # Horizon params - $secret_key = 'dummy_secret_key' - $cache_server_ip = '127.0.0.1' - $cache_server_port = '11211' - $swift = false - $quantum = false - $horizon_app_links = undef - - # vnc - $vnc_enabled = true - $vncserver_listen = $internal_address - $vncserver_proxyclient_address = $internal_address - $vncproxy_host = $public_address - - # OS-specific params - case $::osfamily { - 'Debian': { - } - 'RedHat': { - } - } -} diff --git a/tests/all.pp b/tests/all.pp index 2f43b70..56758ee 100644 --- a/tests/all.pp +++ b/tests/all.pp @@ -1 +1,15 @@ -class { 'openstack::all': } +class { 'openstack::all': + public_address => $::ipaddress_eth0, + mysql_root_password => 'password', + rabbit_password => 'password', + keystone_db_password => 'password', + keystone_admin_token => '12345', + admin_email => 'root@localhost', + admin_password => 'password', + nova_db_password => 'password', + nova_user_password => 'password', + glance_db_password => 'password', + glance_user_password => 'password', + libvirt_type => 'qemu', + secret_key => '12345', +} diff --git a/tests/cloudcontroller.pp b/tests/cloudcontroller.pp index 31f396a..79b2453 100644 --- a/tests/cloudcontroller.pp +++ b/tests/cloudcontroller.pp @@ -1 +1,16 @@ -class { 'openstack::controller': } +class { 'openstack::controller': + public_address => $::ipaddress_eth0, + mysql_root_password => 'password', + allowed_hosts => ['127.0.0.%', '192.168.1.%'], + rabbit_password => 'password', + keystone_db_password => 'password', + keystone_admin_token => '12345', + admin_email => 'root@localhost', + admin_password => 'password', + nova_db_password => 'password', + nova_user_password => 'password', + glance_db_password => 'password', + glance_user_password => 'password', + secret_key => '12345', + exported_resources => false, +} diff --git a/tests/compute.pp b/tests/compute.pp index d0f3238..f5e122b 100644 --- a/tests/compute.pp +++ b/tests/compute.pp @@ -1,4 +1,10 @@ class { 'openstack::compute': - sql_connection => 'mysql://foo:bar@192.168.1.1/nova', - glance_api_servers => '192.168.1.1:9292', + exported_resources => false, + sql_connection => 'mysql://foo:bar@192.168.1.1/nova', + glance_api_servers => '192.168.1.1:9292', + internal_address => $::ipaddress_eth1, + rabbit_password => 'password', + nova_user_password => 'password', + libvirt_type => 'qemu', + vncproxy_host => '192.168.1.1', }