From deb4a8824a9b125cfaa27b708d233e81b6b16ce2 Mon Sep 17 00:00:00 2001 From: Mike Scherbakov Date: Tue, 11 Dec 2012 22:51:45 +0400 Subject: [PATCH] Renamed nailytest -> osnailyfacter --- iso/ks.cfg | 2 +- iso/module.mk | 2 +- puppet/nailytest/manifests/init.pp | 107 ---------------- puppet/osnailyfacter/examples/site.pp | 25 ++++ puppet/osnailyfacter/lib/facter/naily.rb | 14 ++ puppet/osnailyfacter/manifests/init.pp | 121 ++++++++++++++++++ .../osnailyfacter/manifests/network_setup.pp | 6 + .../osnailyfacter/manifests/test_compute.pp | 5 + .../manifests/test_controller.pp | 5 + 9 files changed, 178 insertions(+), 109 deletions(-) create mode 100644 puppet/osnailyfacter/examples/site.pp create mode 100644 puppet/osnailyfacter/lib/facter/naily.rb create mode 100644 puppet/osnailyfacter/manifests/init.pp create mode 100644 puppet/osnailyfacter/manifests/network_setup.pp create mode 100644 puppet/osnailyfacter/manifests/test_compute.pp create mode 100644 puppet/osnailyfacter/manifests/test_controller.pp diff --git a/iso/ks.cfg b/iso/ks.cfg index 740e5fb22..e75a1db35 100644 --- a/iso/ks.cfg +++ b/iso/ks.cfg @@ -152,7 +152,7 @@ mkdir -p /opt/nailgun_puppet tar zxf ${CD}/puppet-nailgun.tgz -C /opt/nailgun_puppet tar zxf ${CD}/puppet-slave.tgz -C /etc/puppet/modules mkdir -p /etc/puppet/manifests/ -cp /etc/puppet/modules/nailytest/examples/site.pp /etc/puppet/manifests/site.pp +cp /etc/puppet/modules/osnailyfacter/examples/site.pp /etc/puppet/manifests/site.pp # Prepare local repository specification rm /etc/yum.repos.d/CentOS*.repo diff --git a/iso/module.mk b/iso/module.mk index 92bd4137a..954b5fe5d 100644 --- a/iso/module.mk +++ b/iso/module.mk @@ -90,7 +90,7 @@ $(ISOROOT)/puppet-nailgun.tgz: $(ISOROOT)/puppet-slave.tgz: @rm -rf fuel/deployment/puppet/network - (cd puppet && tar cf $(BUILD_DIR)/puppet-slave.tar puppet-network nailytest) + (cd puppet && tar cf $(BUILD_DIR)/puppet-slave.tar puppet-network nailytest osnailyfacter) (cd fuel/deployment/puppet && tar rf $(BUILD_DIR)/puppet-slave.tar ./*) gzip -c -9 $(BUILD_DIR)/puppet-slave.tar > $@ diff --git a/puppet/nailytest/manifests/init.pp b/puppet/nailytest/manifests/init.pp index 03d86f7a4..ffc76a75f 100644 --- a/puppet/nailytest/manifests/init.pp +++ b/puppet/nailytest/manifests/init.pp @@ -1,119 +1,12 @@ class nailytest { - # credentials - $admin_email = 'root@localhost' - $admin_password = 'keystone_admin' - $keystone_db_password = 'keystone_db_pass' - $keystone_admin_token = 'keystone_admin_token' - $nova_db_password = 'nova_pass' - $nova_user_password = 'nova_pass' - $glance_db_password = 'glance_pass' - $glance_user_password = 'glance_pass' - $rabbit_password = 'openstack_rabbit_password' - $rabbit_user = 'openstack_rabbit_user' - # switch this to true to have all service log at verbose - $verbose = true - # by default it does not enable atomatically adding floating IPs - $auto_assign_floating_ip = false - - $manage_volumes = false # true - #$nv_physical_volume = ['/dev/sdz', '/dev/sdy', '/dev/sdx'] - $cinder = false # true - - $quantum = false # true - $quantum_user_password = 'quantum_pass' - $quantum_db_password = 'quantum_pass' - $quantum_db_user = 'quantum' - $quantum_db_dbname = 'quantum' - - $mirror_type="external" - #stage { 'openstack-custom-repo': before => Stage['main'] } - #class { 'openstack::mirantis_repos': stage => 'openstack-custom-repo', type => $mirror_type } - - $controller_node_internal = $controller_node_address - - $quantum_host = $controller_node_address - - $quantum_sql_connection = "mysql://${quantum_db_user}:${quantum_db_password}@${quantum_host}/${quantum_db_dbname}" - $sql_connection = "mysql://nova:${nova_db_password}@${controller_node_internal}/nova" - case $role { "controller" : { include nailytest::test_controller - - class { 'openstack::controller': - admin_address => $controller_node_internal, - public_address => $controller_node_public, - public_interface => $public_interface, - private_interface => $private_interface, - internal_address => $controller_node_internal, - floating_range => $floating_network_range, - fixed_range => $fixed_network_range, - # by default it does not enable multi-host mode - multi_host => true, - # by default is assumes flat dhcp networking mode - network_manager => 'nova.network.manager.FlatDHCPManager', - verbose => $verbose, - auto_assign_floating_ip => $auto_assign_floating_ip, - mysql_root_password => $mysql_root_password, - admin_email => $admin_email, - admin_password => $admin_password, - keystone_db_password => $keystone_db_password, - keystone_admin_token => $keystone_admin_token, - glance_db_password => $glance_db_password, - glance_user_password => $glance_user_password, - nova_db_password => $nova_db_password, - nova_user_password => $nova_user_password, - rabbit_password => $rabbit_password, - rabbit_user => $rabbit_user, - export_resources => false, - quantum => $quantum, - quantum_user_password => $quantum_user_password, - quantum_db_password => $quantum_db_password, - quantum_db_user => $quantum_db_user, - quantum_db_dbname => $quantum_db_dbname, - cinder => $cinder, - manage_volumes => $manage_volumes, - nv_physical_volume => $nv_physical_volume, - } - class { 'openstack::auth_file': - admin_password => $admin_password, - keystone_admin_token => $keystone_admin_token, - controller_node => $controller_node_internal, - } - Class[nailytest::network_setup] -> Class[openstack::controller] - Class[nailytest::network_setup] -> Class[openstack::auth_file] } "compute" : { include nailytest::test_compute - - class { 'openstack::compute': - public_interface => $public_interface, - private_interface => $private_interface, - internal_address => $ipaddress_eth0, - libvirt_type => 'kvm', - fixed_range => $fixed_network_range, - network_manager => 'nova.network.manager.FlatDHCPManager', - multi_host => true, - sql_connection => $sql_connection, - nova_user_password => $nova_user_password, - rabbit_nodes => [$controller_node_internal], - rabbit_password => $rabbit_password, - rabbit_user => $rabbit_user, - glance_api_servers => "${controller_node_internal}:9292", - vncproxy_host => $controller_node_public, - vnc_enabled => true, - #ssh_private_key => 'puppet:///ssh_keys/openstack', - #ssh_public_key => 'puppet:///ssh_keys/openstack.pub', - quantum => $quantum, - quantum_host => $quantum_host, - quantum_sql_connection => $quantum_sql_connection, - quantum_user_password => $quantum_user_password, - service_endpoint => $controller_node_internal, - verbose => $verbose, - } - Class[nailytest::network_setup] -> Class[openstack::compute] } } diff --git a/puppet/osnailyfacter/examples/site.pp b/puppet/osnailyfacter/examples/site.pp new file mode 100644 index 000000000..d6ce380c3 --- /dev/null +++ b/puppet/osnailyfacter/examples/site.pp @@ -0,0 +1,25 @@ +#$public_interface = 'eth0' # Provided by Astute +$internal_interface = $management_interface # provided by Astute # 'eth0.102' +$private_interface = $fixed_interface # provided by Astute # 'eth0.103' + +# It's provided by astute +#$fixed_network_range = '10.0.1.0/24' +#$floating_network_range = '10.0.204.128/28' + +# It's provided by astute +#$controller_node_address = '10.0.0.2' +#$controller_node_public = '10.0.203.72' + +$openstack_version = { + 'keystone' => latest, + 'glance' => latest, + 'horizon' => latest, + 'nova' => latest, + 'novncproxy' => latest, + 'cinder' => latest, +} + + +node default { + include osnailyfacter +} diff --git a/puppet/osnailyfacter/lib/facter/naily.rb b/puppet/osnailyfacter/lib/facter/naily.rb new file mode 100644 index 000000000..6c5ef356b --- /dev/null +++ b/puppet/osnailyfacter/lib/facter/naily.rb @@ -0,0 +1,14 @@ +require 'facter' + +if File.exist?("/etc/naily.facts") + File.readlines("/etc/naily.facts").each do |line| + if line =~ /^(.+)=(.+)$/ + var = $1.strip; + val = $2.strip + + Facter.add(var) do + setcode { val } + end + end + end +end diff --git a/puppet/osnailyfacter/manifests/init.pp b/puppet/osnailyfacter/manifests/init.pp new file mode 100644 index 000000000..a55c17c34 --- /dev/null +++ b/puppet/osnailyfacter/manifests/init.pp @@ -0,0 +1,121 @@ +class osnailyfacter { + + # credentials + $admin_email = 'root@localhost' + $admin_password = 'keystone_admin' + $keystone_db_password = 'keystone_db_pass' + $keystone_admin_token = 'keystone_admin_token' + $nova_db_password = 'nova_pass' + $nova_user_password = 'nova_pass' + $glance_db_password = 'glance_pass' + $glance_user_password = 'glance_pass' + $rabbit_password = 'openstack_rabbit_password' + $rabbit_user = 'openstack_rabbit_user' + # switch this to true to have all service log at verbose + $verbose = true + # by default it does not enable atomatically adding floating IPs + $auto_assign_floating_ip = false + + $manage_volumes = false # true + #$nv_physical_volume = ['/dev/sdz', '/dev/sdy', '/dev/sdx'] + $cinder = false # true + + $quantum = false # true + $quantum_user_password = 'quantum_pass' + $quantum_db_password = 'quantum_pass' + $quantum_db_user = 'quantum' + $quantum_db_dbname = 'quantum' + + $mirror_type="external" + #stage { 'openstack-custom-repo': before => Stage['main'] } + #class { 'openstack::mirantis_repos': stage => 'openstack-custom-repo', type => $mirror_type } + + $controller_node_internal = $controller_node_address + + $quantum_host = $controller_node_address + + $quantum_sql_connection = "mysql://${quantum_db_user}:${quantum_db_password}@${quantum_host}/${quantum_db_dbname}" + $sql_connection = "mysql://nova:${nova_db_password}@${controller_node_internal}/nova" + + case $role { + "controller" : { + include osnailyfacter::test_controller + + class { 'openstack::controller': + admin_address => $controller_node_internal, + public_address => $controller_node_public, + public_interface => $public_interface, + private_interface => $private_interface, + internal_address => $controller_node_internal, + floating_range => $floating_network_range, + fixed_range => $fixed_network_range, + # by default it does not enable multi-host mode + multi_host => true, + # by default is assumes flat dhcp networking mode + network_manager => 'nova.network.manager.FlatDHCPManager', + verbose => $verbose, + auto_assign_floating_ip => $auto_assign_floating_ip, + mysql_root_password => $mysql_root_password, + admin_email => $admin_email, + admin_password => $admin_password, + keystone_db_password => $keystone_db_password, + keystone_admin_token => $keystone_admin_token, + glance_db_password => $glance_db_password, + glance_user_password => $glance_user_password, + nova_db_password => $nova_db_password, + nova_user_password => $nova_user_password, + rabbit_password => $rabbit_password, + rabbit_user => $rabbit_user, + export_resources => false, + quantum => $quantum, + quantum_user_password => $quantum_user_password, + quantum_db_password => $quantum_db_password, + quantum_db_user => $quantum_db_user, + quantum_db_dbname => $quantum_db_dbname, + cinder => $cinder, + manage_volumes => $manage_volumes, + nv_physical_volume => $nv_physical_volume, + } + class { 'openstack::auth_file': + admin_password => $admin_password, + keystone_admin_token => $keystone_admin_token, + controller_node => $controller_node_internal, + } + Class[osnailyfacter::network_setup] -> Class[openstack::controller] + Class[osnailyfacter::network_setup] -> Class[openstack::auth_file] + } + + "compute" : { + include osnailyfacter::test_compute + + class { 'openstack::compute': + public_interface => $public_interface, + private_interface => $private_interface, + internal_address => $ipaddress_eth0, + libvirt_type => 'kvm', + fixed_range => $fixed_network_range, + network_manager => 'nova.network.manager.FlatDHCPManager', + multi_host => true, + sql_connection => $sql_connection, + nova_user_password => $nova_user_password, + rabbit_nodes => [$controller_node_internal], + rabbit_password => $rabbit_password, + rabbit_user => $rabbit_user, + glance_api_servers => "${controller_node_internal}:9292", + vncproxy_host => $controller_node_public, + vnc_enabled => true, + #ssh_private_key => 'puppet:///ssh_keys/openstack', + #ssh_public_key => 'puppet:///ssh_keys/openstack.pub', + quantum => $quantum, + quantum_host => $quantum_host, + quantum_sql_connection => $quantum_sql_connection, + quantum_user_password => $quantum_user_password, + service_endpoint => $controller_node_internal, + verbose => $verbose, + } + Class[osnailyfacter::network_setup] -> Class[openstack::compute] + } + } + + include osnailyfacter::network_setup +} diff --git a/puppet/osnailyfacter/manifests/network_setup.pp b/puppet/osnailyfacter/manifests/network_setup.pp new file mode 100644 index 000000000..9230d1c37 --- /dev/null +++ b/puppet/osnailyfacter/manifests/network_setup.pp @@ -0,0 +1,6 @@ +class osnailyfacter::network_setup { + +include puppet-network + create_resources(network_config,parsejson($network_data)) +} + diff --git a/puppet/osnailyfacter/manifests/test_compute.pp b/puppet/osnailyfacter/manifests/test_compute.pp new file mode 100644 index 000000000..fb8385fbf --- /dev/null +++ b/puppet/osnailyfacter/manifests/test_compute.pp @@ -0,0 +1,5 @@ +class nailytest::test_compute { + file { "/tmp/compute-file": + content => "Hello world! $role is installed", + } +} diff --git a/puppet/osnailyfacter/manifests/test_controller.pp b/puppet/osnailyfacter/manifests/test_controller.pp new file mode 100644 index 000000000..a7966ed27 --- /dev/null +++ b/puppet/osnailyfacter/manifests/test_controller.pp @@ -0,0 +1,5 @@ +class nailytest::test_controller { + file { "/tmp/controller-file": + content => "Hello world! $role is installed", + } +}