Created
September 24, 2014 06:41
-
-
Save yungyili/a1b877b0984e8b8dcfe1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class osnailyfacter::cluster_simple { | |
| if $::use_quantum { | |
| $novanetwork_params = {} | |
| $quantum_config = sanitize_neutron_config($::fuel_settings, 'quantum_settings') | |
| debug__dump_to_file('/tmp/neutron_cfg.yaml', $quantum_config) | |
| } else { | |
| $quantum_config = {} | |
| $novanetwork_params = $::fuel_settings['novanetwork_parameters'] | |
| $network_config = { | |
| 'vlan_start' => $novanetwork_params['vlan_start'], | |
| } | |
| } | |
| if $fuel_settings['cinder_nodes'] { | |
| $cinder_nodes_array = $::fuel_settings['cinder_nodes'] | |
| } else { | |
| $cinder_nodes_array = [] | |
| } | |
| # All hash assignment from a dimensional hash must be in the local scope or they will | |
| # be undefined (don't move to site.pp) | |
| #These aren't always present. | |
| if !$::fuel_settings['savanna'] { | |
| $savanna_hash={} | |
| } else { | |
| $savanna_hash = $::fuel_settings['savanna'] | |
| } | |
| if !$::fuel_settings['murano'] { | |
| $murano_hash = {} | |
| } else { | |
| $murano_hash = $::fuel_settings['murano'] | |
| } | |
| if !$::fuel_settings['heat'] { | |
| $heat_hash = {} | |
| } else { | |
| $heat_hash = $::fuel_settings['heat'] | |
| } | |
| if !$::fuel_settings['ceilometer'] { | |
| $ceilometer_hash = { | |
| enabled => false, | |
| db_password => 'ceilometer', | |
| user_password => 'ceilometer', | |
| metering_secret => 'ceilometer', | |
| } | |
| } else { | |
| $ceilometer_hash = $::fuel_settings['ceilometer'] | |
| } | |
| if $::fuel_settings['role'] == 'controller' { | |
| package { 'cirros-testvm': | |
| ensure => "present" | |
| } | |
| } | |
| $storage_hash = $::fuel_settings['storage'] | |
| $nova_hash = $::fuel_settings['nova'] | |
| $mysql_hash = $::fuel_settings['mysql'] | |
| $rabbit_hash = $::fuel_settings['rabbit'] | |
| $glance_hash = $::fuel_settings['glance'] | |
| $keystone_hash = $::fuel_settings['keystone'] | |
| $swift_hash = $::fuel_settings['swift'] | |
| $cinder_hash = $::fuel_settings['cinder'] | |
| $access_hash = $::fuel_settings['access'] | |
| $nodes_hash = $::fuel_settings['nodes'] | |
| $network_manager = "nova.network.manager.${novanetwork_params['network_manager']}" | |
| if !$rabbit_hash[user] { | |
| $rabbit_hash[user] = 'nova' | |
| } | |
| $controller = filter_nodes($nodes_hash,'role','controller') | |
| $controller_node_address = $controller[0]['internal_address'] | |
| $controller_node_public = $controller[0]['public_address'] | |
| # AMQP client configuration | |
| $amqp_port = '5672' | |
| $amqp_hosts = "${controller_node_address}:${amqp_port}" | |
| $rabbit_ha_queues = false | |
| # RabbitMQ server configuration | |
| $rabbitmq_bind_ip_address = 'UNSET' # bind RabbitMQ to 0.0.0.0 | |
| $rabbitmq_bind_port = $amqp_port | |
| $rabbitmq_cluster_nodes = [$controller[0]['name']] # has to be hostnames | |
| if ($::fuel_settings['cinder']) { | |
| if (member($cinder_nodes_array,'all')) { | |
| $is_cinder_node = true | |
| } elsif (member($cinder_nodes_array,$::hostname)) { | |
| $is_cinder_node = true | |
| } elsif (member($cinder_nodes_array,$internal_address)) { | |
| $is_cinder_node = true | |
| } elsif ($node[0]['role'] =~ /controller/ ) { | |
| $is_cinder_node = member($cinder_nodes_array,'controller') | |
| } else { | |
| $is_cinder_node = member($cinder_nodes_array,$node[0]['role']) | |
| } | |
| } else { | |
| $is_cinder_node = false | |
| } | |
| $cinder_iscsi_bind_addr = $::storage_address | |
| # do not edit the below line | |
| validate_re($::queue_provider, 'rabbitmq|qpid') | |
| $sql_connection = "mysql://nova:${nova_hash[db_password]}@${controller_node_address}/nova?read_timeout=60" | |
| $mirror_type = 'external' | |
| $multi_host = true | |
| Exec { logoutput => true } | |
| # from site.pp top scope | |
| $use_syslog = $::use_syslog | |
| $verbose = $::verbose | |
| $debug = $::debug | |
| # Determine who should get the volume service | |
| if ($::fuel_settings['role'] == 'cinder' or | |
| $storage_hash['volumes_lvm'] | |
| ) { | |
| $manage_volumes = 'iscsi' | |
| } elsif ($storage_hash['volumes_ceph']) { | |
| $manage_volumes = 'ceph' | |
| } elsif ($::use_federator) { | |
| $manage_volumes = 'federator' | |
| } else { | |
| $manage_volumes = false | |
| } | |
| #Determine who should be the default backend | |
| if ($storage_hash['images_ceph']) { | |
| $glance_backend = 'ceph' | |
| } else { | |
| $glance_backend = 'file' | |
| } | |
| if ($::use_ceph) { | |
| $primary_mons = $controller | |
| $primary_mon = $controller[0]['name'] | |
| class {'ceph': | |
| primary_mon => $primary_mon, | |
| cluster_node_address => $controller_node_public, | |
| use_rgw => $storage_hash['objects_ceph'], | |
| glance_backend => $glance_backend, | |
| } | |
| } | |
| if ($::fuel_settings['role'] == 'controller' or $::fuel_settings['role'] == 'compute' ) { | |
| #package {'open-iscsi': ensure => '2.0.873-3ubuntu5~ubuntu12.04.1'} -> | |
| package {'open-iscsi': ensure => '2.0.873-3ubuntu5~ubuntu12.04.1'} -> | |
| exec {'open-iscsi_running': | |
| command => '/usr/sbin/service open-iscsi start' | |
| } -> | |
| exec {'open-iscsi_defaul_enable': | |
| command => "/usr/sbin/update-rc.d open-iscsi enable" | |
| } -> | |
| package {'ifupdown': ensure => latest} | |
| #package {'ifupdown': ensure => '0.7~beta2ubuntu11'} | |
| } | |
| if ($::use_federator) { | |
| if $::fuel_settings['role'] == 'federator' { | |
| class {'federator_apt':} -> class {'federator':} | |
| } | |
| if (($::fuel_settings['role'] == 'controller') | |
| and (!$storage_hash['volumes_ceph'])) { | |
| notify {'osnailyfacter: start to deploy psstack_addon':} | |
| class {'federator_apt':} -> | |
| class {'psstack_addon':} -> | |
| class {'federator-driver':} -> | |
| class {'federator::ceph_tgt':} | |
| } else { | |
| notify {'osnailyfacter: this is not a controller node or not using federator as storage backend':} | |
| } | |
| } | |
| if $::fuel_settings['role'] == 'hypervisor-flexvisor' { | |
| class {'federator_apt':} -> class {'dpl':} | |
| } | |
| case $::fuel_settings['role'] { | |
| "controller" : { | |
| include osnailyfacter::test_controller | |
| class {'osnailyfacter::apache_api_proxy':} | |
| class { 'openstack::controller': | |
| admin_address => $controller_node_address, | |
| public_address => $controller_node_public, | |
| public_interface => $::public_int, | |
| private_interface => $::use_quantum ? { true=>false, default=>$::fuel_settings['fixed_interface']}, | |
| internal_address => $controller_node_address, | |
| service_endpoint => $controller_node_address, | |
| floating_range => false, #todo: remove as not needed ??? | |
| fixed_range => $::use_quantum ? { true=>false, default=>$::fuel_settings['fixed_network_range'] }, | |
| multi_host => $multi_host, | |
| network_manager => $network_manager, | |
| num_networks => $::use_quantum ? { true=>false, default=>$novanetwork_params['num_networks'] }, | |
| network_size => $::use_quantum ? { true=>false, default=>$novanetwork_params['network_size'] }, | |
| network_config => $::use_quantum ? { true=>false, default=>$network_config }, | |
| debug => $debug, | |
| verbose => $verbose, | |
| auto_assign_floating_ip => $::fuel_settings['auto_assign_floating_ip'], | |
| mysql_root_password => $mysql_hash[root_password], | |
| admin_email => $access_hash[email], | |
| admin_user => $access_hash[user], | |
| admin_password => $access_hash[password], | |
| keystone_db_password => $keystone_hash[db_password], | |
| keystone_admin_token => $keystone_hash[admin_token], | |
| keystone_admin_tenant => $access_hash[tenant], | |
| glance_db_password => $glance_hash[db_password], | |
| glance_user_password => $glance_hash[user_password], | |
| glance_backend => $glance_backend, | |
| glance_image_cache_max_size => $glance_hash[image_cache_max_size], | |
| nova_db_password => $nova_hash[db_password], | |
| nova_user_password => $nova_hash[user_password], | |
| nova_rate_limits => $nova_rate_limits, | |
| ceilometer => $ceilometer_hash[enabled], | |
| ceilometer_db_password => $ceilometer_hash[db_password], | |
| ceilometer_user_password => $ceilometer_hash[user_password], | |
| ceilometer_metering_secret => $ceilometer_hash[metering_secret], | |
| queue_provider => $::queue_provider, | |
| amqp_hosts => $amqp_hosts, | |
| amqp_user => $rabbit_hash['user'], | |
| amqp_password => $rabbit_hash['password'], | |
| rabbitmq_bind_ip_address => $rabbitmq_bind_ip_address, | |
| rabbitmq_bind_port => $rabbitmq_bind_port, | |
| rabbitmq_cluster_nodes => $rabbitmq_cluster_nodes, | |
| export_resources => false, | |
| quantum => $::use_quantum, | |
| quantum_config => $quantum_config, | |
| quantum_network_node => $::use_quantum, | |
| quantum_netnode_on_cnt => $::use_quantum, | |
| cinder => true, | |
| cinder_user_password => $cinder_hash[user_password], | |
| cinder_db_password => $cinder_hash[db_password], | |
| cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr, | |
| cinder_volume_group => "cinder", | |
| manage_volumes => $manage_volumes, | |
| use_syslog => $use_syslog, | |
| syslog_log_level => $syslog_log_level, | |
| syslog_log_facility_glance => $syslog_log_facility_glance, | |
| syslog_log_facility_cinder => $syslog_log_facility_cinder, | |
| syslog_log_facility_neutron => $syslog_log_facility_neutron, | |
| syslog_log_facility_nova => $syslog_log_facility_nova, | |
| syslog_log_facility_keystone=> $syslog_log_facility_keystone, | |
| cinder_rate_limits => $cinder_rate_limits, | |
| horizon_use_ssl => $horizon_use_ssl, | |
| nameservers => $::dns_nameservers, | |
| primary_controller => true, | |
| } | |
| nova_config { 'DEFAULT/start_guests_on_host_boot': value => $::fuel_settings['start_guests_on_host_boot'] } | |
| nova_config { 'DEFAULT/use_cow_images': value => $::fuel_settings['use_cow_images'] } | |
| nova_config { 'DEFAULT/compute_scheduler_driver': value => $::fuel_settings['compute_scheduler_driver'] } | |
| if $::use_quantum { | |
| class { '::openstack::neutron_router': | |
| debug => $debug, | |
| verbose => $verbose, | |
| # qpid_password => $rabbit_hash[password], | |
| # qpid_user => $rabbit_hash[user], | |
| # qpid_nodes => [$controller_node_address], | |
| neutron_config => $quantum_config, | |
| neutron_network_node => true, | |
| use_syslog => $use_syslog, | |
| syslog_log_level => $syslog_log_level, | |
| syslog_log_facility => $syslog_log_facility_neutron, | |
| } | |
| } | |
| class { 'openstack::auth_file': | |
| admin_user => $access_hash[user], | |
| admin_password => $access_hash[password], | |
| keystone_admin_token => $keystone_hash[admin_token], | |
| admin_tenant => $access_hash[tenant], | |
| controller_node => $controller_node_address, | |
| } | |
| if !$::use_quantum { | |
| $floating_ips_range = $::fuel_settings['floating_network_range'] | |
| if $floating_ips_range { | |
| nova_floating_range{ $floating_ips_range: | |
| ensure => 'present', | |
| pool => 'nova', | |
| username => $access_hash[user], | |
| api_key => $access_hash[password], | |
| auth_method => 'password', | |
| auth_url => "http://${controller_node_address}:5000/v2.0/", | |
| authtenant_name => $access_hash[tenant], | |
| api_retries => 10, | |
| } | |
| } | |
| Class[nova::api] -> Nova_floating_range <| |> | |
| } | |
| if ($::use_ceph){ | |
| Class['openstack::controller'] -> Class['ceph'] | |
| } | |
| if (($::use_federator) | |
| and (!$storage_hash['volumes_ceph'])) { | |
| Class['openstack::controller'] -> Class['psstack_addon'] | |
| Class['openstack::controller'] -> Class['Federator_apt'] | |
| } | |
| #ADDONS START | |
| if $savanna_hash['enabled'] { | |
| class { 'savanna' : | |
| savanna_api_host => $controller_node_address, | |
| savanna_db_password => $savanna_hash['db_password'], | |
| savanna_db_host => $controller_node_address, | |
| savanna_keystone_host => $controller_node_address, | |
| savanna_keystone_user => 'savanna', | |
| savanna_keystone_password => $savanna_hash['user_password'], | |
| savanna_keystone_tenant => 'services', | |
| use_neutron => $::use_quantum, | |
| use_floating_ips => $::fuel_settings['auto_assign_floating_ip'], | |
| syslog_log_facility_savanna => $syslog_log_facility_savanna, | |
| syslog_log_level => $syslog_log_level, | |
| debug => $debug, | |
| verbose => $verbose, | |
| use_syslog => $use_syslog, | |
| } | |
| } | |
| if ($::operatingsystem != 'RedHat') { | |
| class { 'heat' : | |
| pacemaker => false, | |
| external_ip => $controller_node_public, | |
| keystone_host => $controller_node_address, | |
| keystone_user => 'heat', | |
| keystone_password => 'heat', | |
| keystone_tenant => 'services', | |
| amqp_hosts => $amqp_hosts, | |
| amqp_user => $rabbit_hash['user'], | |
| amqp_password => $rabbit_hash['password'], | |
| db_host => $controller_node_address, | |
| db_password => $heat_hash['db_password'], | |
| debug => $debug, | |
| verbose => $verbose, | |
| use_syslog => $use_syslog, | |
| syslog_log_facility => $syslog_log_facility_heat, | |
| } | |
| } | |
| if $murano_hash['enabled'] { | |
| class { 'murano' : | |
| murano_api_host => $controller_node_address, | |
| murano_rabbit_host => $controller_node_public, | |
| murano_rabbit_login => 'murano', | |
| murano_rabbit_password => $heat_hash['rabbit_password'], | |
| murano_db_host => $controller_node_address, | |
| murano_db_password => $murano_hash['db_password'], | |
| murano_keystone_host => $controller_node_address, | |
| murano_metadata_host => $controller_node_address, | |
| murano_keystone_user => 'murano', | |
| murano_keystone_password => $murano_hash['user_password'], | |
| murano_keystone_tenant => 'services', | |
| use_neutron => $::use_quantum, | |
| use_syslog => $use_syslog, | |
| debug => $debug, | |
| verbose => $verbose, | |
| syslog_log_facility => $syslog_log_facility_murano, | |
| } | |
| Class['heat'] -> Class['murano'] | |
| } | |
| #ADDONS END | |
| } | |
| "compute" : { | |
| include osnailyfacter::test_compute | |
| class { 'openstack::compute': | |
| public_interface => $::public_int, | |
| private_interface => $::use_quantum ? { true=>false, default=>$::fuel_settings['fixed_interface'] }, | |
| internal_address => $internal_address, | |
| libvirt_type => $::fuel_settings['libvirt_type'], | |
| fixed_range => $::fuel_settings['fixed_network_range'], | |
| network_manager => $network_manager, | |
| network_config => $::use_quantum ? { true=>false, default=>$network_config }, | |
| multi_host => $multi_host, | |
| sql_connection => $sql_connection, | |
| nova_user_password => $nova_hash[user_password], | |
| ceilometer => $ceilometer_hash[enabled], | |
| ceilometer_metering_secret => $ceilometer_hash[metering_secret], | |
| ceilometer_user_password => $ceilometer_hash[user_password], | |
| queue_provider => $::queue_provider, | |
| amqp_hosts => $amqp_hosts, | |
| amqp_user => $rabbit_hash['user'], | |
| amqp_password => $rabbit_hash['password'], | |
| auto_assign_floating_ip => $::fuel_settings['auto_assign_floating_ip'], | |
| glance_api_servers => "${controller_node_address}:9292", | |
| vncproxy_host => $controller_node_public, | |
| vncserver_listen => '0.0.0.0', | |
| vnc_enabled => true, | |
| quantum => $::use_quantum, | |
| quantum_config => $quantum_config, | |
| # quantum_network_node => $::use_quantum, | |
| # quantum_netnode_on_cnt => $::use_quantum, | |
| service_endpoint => $controller_node_address, | |
| cinder => true, | |
| cinder_user_password => $cinder_hash[user_password], | |
| cinder_db_password => $cinder_hash[db_password], | |
| cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr, | |
| cinder_volume_group => "cinder", | |
| manage_volumes => $manage_volumes, | |
| db_host => $controller_node_address, | |
| debug => $debug, | |
| verbose => $verbose, | |
| use_syslog => $use_syslog, | |
| syslog_log_level => $syslog_log_level, | |
| syslog_log_facility => $syslog_log_facility_nova, | |
| syslog_log_facility_neutron => $syslog_log_facility_neutron, | |
| syslog_log_facility_cinder => $syslog_log_facility_cinder, | |
| state_path => $nova_hash[state_path], | |
| nova_rate_limits => $nova_rate_limits, | |
| cinder_rate_limits => $cinder_rate_limits | |
| } | |
| nova_config { 'DEFAULT/start_guests_on_host_boot': value => $::fuel_settings['start_guests_on_host_boot'] } | |
| nova_config { 'DEFAULT/use_cow_images': value => $::fuel_settings['use_cow_images'] } | |
| nova_config { 'DEFAULT/compute_scheduler_driver': value => $::fuel_settings['compute_scheduler_driver'] } | |
| if ($::use_ceph){ | |
| Class['openstack::compute'] -> Class['ceph'] | |
| } | |
| } # COMPUTE ENDS | |
| "cinder" : { | |
| include keystone::python | |
| package { 'python-amqp': | |
| ensure => present | |
| } | |
| $roles = node_roles($nodes_hash, $::fuel_settings['uid']) | |
| if member($roles, 'controller') or member($roles, 'primary-controller') { | |
| $bind_host = '0.0.0.0' | |
| } else { | |
| $bind_host = false | |
| } | |
| class { 'openstack::cinder': | |
| sql_connection => "mysql://cinder:${cinder_hash[db_password]}@${controller_node_address}/cinder?charset=utf8&read_timeout=60", | |
| glance_api_servers => "${controller_node_address}:9292", | |
| queue_provider => $::queue_provider, | |
| amqp_hosts => $amqp_hosts, | |
| amqp_user => $rabbit_hash['user'], | |
| amqp_password => $rabbit_hash['password'], | |
| bind_host => $bind_host, | |
| volume_group => 'cinder', | |
| manage_volumes => $manage_volumes, | |
| enabled => true, | |
| auth_host => $controller_node_address, | |
| iscsi_bind_host => $cinder_iscsi_bind_addr, | |
| cinder_user_password => $cinder_hash[user_password], | |
| syslog_log_facility => $syslog_log_facility_cinder, | |
| syslog_log_level => $syslog_log_level, | |
| debug => $debug, | |
| verbose => $verbose, | |
| use_syslog => $use_syslog, | |
| } | |
| } #CINDER ENDS | |
| "ceph-osd" : { | |
| #Nothing needs to be done Class Ceph is already defined | |
| notify {"ceph-osd: ${::ceph::osd_devices}": } | |
| notify {"osd_devices: ${::osd_devices_list}": } | |
| } #CEPH_OSD ENDS | |
| } # ROLE CASE ENDS | |
| } # CLUSTER_SIMPLE ENDS | |
| # vim: set ts=2 sw=2 et : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment