├── README.rst ├── .gitreview ├── .gitignore ├── Rakefile ├── Gemfile ├── README.md ├── metadata.json ├── example └── example.pp ├── templates ├── savanna-api.conf.erb ├── savanna-api.erb └── savanna.conf.erb ├── manifests ├── service.pp ├── db │ ├── mysql │ │ └── host_access.pp │ └── mysql.pp ├── params.pp ├── keystone │ └── auth.pp ├── dashboard.pp ├── init.pp └── install.pp ├── Modulefile ├── spec └── spec_helper.rb └── tests └── init.pp /README.rst: -------------------------------------------------------------------------------- 1 | This repo will contain puppet manifests for Savanna 2 | -------------------------------------------------------------------------------- /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=review.openstack.org 3 | port=29418 4 | project=stackforge/puppet-sahara.git 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | Gemfile.lock 3 | spec/fixtures/modules/* 4 | spec/fixtures/manifests/site.pp 5 | *.swp 6 | pkg 7 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/rake_tasks' 2 | require 'puppet-lint/tasks/puppet-lint' 3 | 4 | PuppetLint.configuration.fail_on_warnings = true 5 | PuppetLint.configuration.send('disable_80chars') 6 | PuppetLint.configuration.send('disable_class_inherits_from_params_class') 7 | PuppetLint.configuration.send('disable_class_parameter_defaults') 8 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | group :development, :test do 4 | gem 'puppetlabs_spec_helper', :require => false 5 | gem 'puppet-lint', '~> 0.3.2' 6 | gem 'rake', '~> 10.1.1' 7 | end 8 | 9 | if puppetversion = ENV['PUPPET_GEM_VERSION'] 10 | gem 'puppet', puppetversion, :require => false 11 | else 12 | gem 'puppet', :require => false 13 | end 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # puppet-savanna 2 | 3 | Installs the OpenStack [savanna UI and backend](https://launchpad.net/savanna) 4 | 5 | If you want an example of how it's used see example/example.pp. 6 | 7 | Pull requests and suggestions gladly received! 8 | 9 | If you wish to participate in the Savanna project please 10 | [see the Savanna OpenStack wiki page](http://docs.openstack.org/developer/savanna/devref/how_to_participate.html) 11 | for more information. -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "puppet-savanna", 3 | "version": "0.0.1", 4 | "summary": "Installs the savanna backend", 5 | "author": "andy@edmonds.be", 6 | "description": "Installs the savanna backend and can also install the savanna UI in OpenStack horizon", 7 | "dependencies": [], 8 | "types": [], 9 | "checksums": {}, 10 | "source": "https://github.com/stackforge/puppet-savanna", 11 | "project_page": "https://github.com/stackforge/puppet-savanna", 12 | "license": "Apache License, Version 2.0" 13 | } -------------------------------------------------------------------------------- /example/example.pp: -------------------------------------------------------------------------------- 1 | 2 | class { 'savanna::db::mysql': password => 'savanna', } 3 | 4 | class { 'savanna::keystone::auth': 5 | password => 'savanna', 6 | public_address => '127.0.0.1', 7 | admin_address => '127.0.0.1', 8 | internal_address => '127.0.0.1', 9 | } 10 | 11 | class { 'savanna': 12 | savanna_host => '127.0.0.1', 13 | db_host => '127.0.0.1', 14 | savanna_db_password => 'savanna', 15 | keystone_auth_host => '127.0.0.1', 16 | keystone_password => 'savanna', 17 | savanna_verbose => true, 18 | } 19 | 20 | class { 'savanna::dashboard': 21 | savanna_host => '127.0.0.1', 22 | use_neutron => true, 23 | require => Class['Openstack::Horizon'] 24 | } 25 | -------------------------------------------------------------------------------- /templates/savanna-api.conf.erb: -------------------------------------------------------------------------------- 1 | description "Savanna API Server upstart job" 2 | author "Andy Edmonds " 3 | 4 | start on runlevel [2345] 5 | stop on runlevel [!2345] 6 | 7 | 8 | chdir <%= scope.lookupvar("savanna::params::sys_rundir") %> 9 | 10 | pre-start script 11 | mkdir -p <%= scope.lookupvar("savanna::params::savanna_rundir") %> 12 | chown savanna:root <%= scope.lookupvar("savanna::params::savanna_rundir") %> 13 | 14 | mkdir -p <%= scope.lookupvar("savanna::params::savanna_lockdir") %> 15 | chown savanna:root <%= scope.lookupvar("savanna::params::savanna_lockdir") %> 16 | end script 17 | 18 | exec start-stop-daemon --start --chuid savanna --exec /usr/local/bin/<%= scope.lookupvar("savanna::params::savanna_service") %> -- --config-file=<%= scope.lookupvar("savanna::params::savanna_conf_file") %> -------------------------------------------------------------------------------- /manifests/service.pp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | class savanna::service ($enable = true,) { 17 | service { 'savanna-api': 18 | ensure => running, 19 | enable => $enable, 20 | hasrestart => true, 21 | hasstatus => true, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Modulefile: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zürcher Hochschule für Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | name 'puppet-savanna' 17 | version '0.0.1' 18 | source 'https://github.com/stackforge/puppet-savanna' 19 | author 'andy@edmonds.be' 20 | license 'Apache License, Version 2.0' 21 | summary 'Installs the savanna backend' 22 | description 'Installs the savanna backend and can also install the savanna UI in OpenStack horizon' 23 | project_page 'https://github.com/stackforge/puppet-savanna' 24 | 25 | ## Add dependencies, if any: 26 | # dependency 'username/name', '>= 1.2.0' 27 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zürcher Hochschule für Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | dir = File.expand_path(File.dirname(__FILE__)) 17 | $LOAD_PATH.unshift File.join(dir, 'lib') 18 | 19 | require 'mocha' 20 | require 'puppet' 21 | require 'rspec' 22 | require 'spec/autorun' 23 | 24 | Spec::Runner.configure do |config| 25 | config.mock_with :mocha 26 | end 27 | 28 | # We need this because the RAL uses 'should' as a method. This 29 | # allows us the same behaviour but with a different method name. 30 | class Object 31 | alias :must :should 32 | end 33 | -------------------------------------------------------------------------------- /tests/init.pp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zürcher Hochschule für Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | # The baseline for module testing used by Puppet Labs is that each manifest 17 | # should have a corresponding test manifest that declares that class or defined 18 | # type. 19 | # 20 | # Tests are then run by using puppet apply --noop (to check for compilation errors 21 | # and view a log of events) or by fully applying the test in a virtual environment 22 | # (to compare the resulting system state to the desired state). 23 | # 24 | # Learn more about module testing here: http://docs.puppetlabs.com/guides/tests_smoke.html 25 | # 26 | include savanna 27 | -------------------------------------------------------------------------------- /manifests/db/mysql/host_access.pp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | # 17 | # Used to grant access to the savanna mysql DB 18 | # 19 | 20 | define savanna::db::mysql::host_access ($user, $password, $database) { 21 | database_user { "${user}@${name}": 22 | password_hash => mysql_password($password), 23 | provider => 'mysql', 24 | require => Database[$database], 25 | } 26 | 27 | database_grant { "${user}@${name}/${database}": 28 | # TODO figure out which privileges to grant. 29 | privileges => 'all', 30 | provider => 'mysql', 31 | require => Database_user["${user}@${name}"] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /manifests/params.pp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | class savanna::params { 17 | $sys_rundir = '/var/run' 18 | $savanna_service = 'savanna-api' 19 | $savanna_logdir = '/var/log/savanna' 20 | $savanna_rundir = '/var/run/savanna' 21 | $savanna_lockdir = '/var/lock/savanna' 22 | $savanna_conf_file = '/etc/savanna/savanna.conf' 23 | $savanna_syslog = false 24 | $savanna_usefips = false 25 | $savanna_node_domain = 'novalocal' 26 | # installs source version from github builds 27 | $development = false 28 | $development_build_url = 29 | 'http://tarballs.openstack.org/savanna/savanna-master.tar.gz' 30 | $development_dashboard_build_url = 31 | 'http://tarballs.openstack.org/savanna-dashboard/savanna-dashboard-master.tar.gz' 32 | 33 | # these two paths are OS specific - on redhat they're diff 34 | $horizon_settings = 35 | '/usr/share/openstack-dashboard/openstack_dashboard/settings.py' 36 | $horizon_local_settings = 37 | '/usr/share/openstack-dashboard/openstack_dashboard/local/local_settings.py' 38 | } 39 | -------------------------------------------------------------------------------- /manifests/db/mysql.pp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | # 17 | # Used to create the savanna db 18 | # 19 | 20 | class savanna::db::mysql ( 21 | $password = 'savanna', 22 | $dbname = 'savanna', 23 | $user = 'savanna', 24 | $host = '127.0.0.1', 25 | $allowed_hosts = undef, # ['127.0.0.1'], 26 | $charset = 'latin1',) { 27 | Class['mysql::server'] -> Class['savanna::db::mysql'] 28 | 29 | require mysql::python 30 | 31 | mysql::db { $dbname: 32 | user => $user, 33 | password => $password, 34 | host => $host, 35 | charset => $charset, 36 | require => Class['mysql::config'], 37 | } 38 | 39 | # Check allowed_hosts to avoid duplicate resource declarations 40 | if is_array($allowed_hosts) and delete($allowed_hosts, $host) != [] { 41 | $real_allowed_hosts = delete($allowed_hosts, $host) 42 | } elsif is_string($allowed_hosts) and ($allowed_hosts != $host) { 43 | $real_allowed_hosts = $allowed_hosts 44 | } 45 | 46 | if $real_allowed_hosts { 47 | savanna::db::mysql::host_access { $real_allowed_hosts: 48 | user => $user, 49 | password => $password, 50 | database => $dbname, 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /manifests/keystone/auth.pp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | # 17 | # Used to setup the savanna keystone user 18 | # 19 | 20 | class savanna::keystone::auth ( 21 | $password = 'savanna', 22 | $auth_name = 'savanna', 23 | $email = 'savanna@localhost', 24 | $tenant = 'services', 25 | $configure_endpoint = true, 26 | $service_type = 'mapreduce', 27 | $public_address = '127.0.0.1', 28 | $admin_address = '127.0.0.1', 29 | $internal_address = '127.0.0.1', 30 | $port = '8386', 31 | $public_port = undef, 32 | $region = 'RegionOne', 33 | $public_protocol = 'http', 34 | $internal_protocol = 'http', 35 | ) { 36 | 37 | Keystone_user_role["${auth_name}@${tenant}"] ~> 38 | Service <| name == 'savanna-api' |> 39 | 40 | if !$public_port { 41 | $real_public_port = $port 42 | } else { 43 | $real_public_port = $public_port 44 | } 45 | 46 | keystone_user { $auth_name: 47 | ensure => present, 48 | password => $password, 49 | email => $email, 50 | tenant => $tenant, 51 | } 52 | 53 | keystone_user_role { "${auth_name}@${tenant}": 54 | ensure => present, 55 | roles => 'admin', 56 | } 57 | 58 | keystone_service { $auth_name: 59 | ensure => present, 60 | type => $service_type, 61 | description => 'Savanna MapReduce Service', 62 | } 63 | 64 | if $configure_endpoint { 65 | keystone_endpoint { "${region}/${auth_name}": 66 | ensure => present, 67 | public_url => 68 | "${public_protocol}://${public_address}:${real_public_port}/", 69 | internal_url => "${internal_protocol}://${internal_address}:${port}/", 70 | admin_url => "${internal_protocol}://${admin_address}:${port}/", 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /manifests/dashboard.pp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | # 17 | # Used to install savanna's horizon component 18 | # 19 | 20 | class savanna::dashboard ( 21 | $savanna_host = '127.0.0.1', 22 | $savanna_port = '8386', 23 | $use_neutron = false, 24 | ) { 25 | 26 | include savanna::params 27 | 28 | if use_neutron { 29 | $neutron = 'True' 30 | } else { 31 | $neutron = 'False' 32 | } 33 | 34 | if !defined(Package['python-pip']) { 35 | package { 'python-pip': ensure => latest, } 36 | } 37 | 38 | if $savanna::params::development { 39 | info('Installing the developement version of savanna dashboard') 40 | 41 | package { 'savanna-dashboard': 42 | ensure => installed, 43 | provider => pip, 44 | source => $savanna::params::development_dashboard_build_url, 45 | require => Package['python-pip'], 46 | } 47 | } else { 48 | package { 'savanna-dashboard': 49 | ensure => installed, 50 | provider => pip, 51 | require => Package['python-pip'], 52 | } 53 | } 54 | 55 | exec { 'savanna-horizon-config': 56 | command => "echo \"HORIZON_CONFIG['dashboards'] += ('savanna',)\" >> ${savanna::params::horizon_settings}", 57 | path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 58 | unless => "grep \"HORIZON_CONFIG\['dashboards'\] +=\" ${savanna::params::horizon_settings}", 59 | require => Package['savanna-dashboard'], 60 | } 61 | 62 | exec { 'savanna-installed-apps': 63 | command => "echo \"INSTALLED_APPS += ('savannadashboard',)\" >> ${savanna::params::horizon_settings}", 64 | path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 65 | unless => "grep \"INSTALLED_APPS +=\" ${savanna::params::horizon_settings}", 66 | require => Package['savanna-dashboard'], 67 | } 68 | 69 | exec { 'savanna-use-neutron': 70 | command => "echo 'SAVANNA_USE_NEUTRON = ${neutron}' >> ${savanna::params::horizon_local_settings}", 71 | path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 72 | unless => "grep \"SAVANNA_USE_NEUTRON\" ${savanna::params::horizon_local_settings}", 73 | require => Package['savanna-dashboard'], 74 | } 75 | 76 | exec { 'savanna-url': 77 | command => "echo \"SAVANNA_URL = 'http://${savanna_host}:${savanna_port}/v1.1'\" >> ${savanna::params::horizon_local_settings}", 78 | path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', 79 | unless => "grep \"SAVANNA_URL\" ${savanna::params::horizon_local_settings}", 80 | require => Package['savanna-dashboard'], 81 | } 82 | } -------------------------------------------------------------------------------- /manifests/init.pp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | # == Class: savanna 17 | # 18 | # Installs the savanna backend. 19 | # 20 | # === Parameters 21 | # 22 | # Document parameters here. 23 | # 24 | # [*sample_parameter*] 25 | # Explanation of what this parameter affects and what it defaults to. 26 | # e.g. "Specify one or more upstream ntp servers as an array." 27 | # 28 | # === Variables 29 | # 30 | # Here you should define a list of variables that this module would require. 31 | # 32 | # [*savanna_host*] 33 | # The host on which the savanna process (API) runs. Defaults to '127.0.0.1' 34 | # [*savanna_port*] 35 | # The port on which the savanna process (API) runs on. Defaults to 3836 36 | # [*db_host*] 37 | # The host where the database is running. Savanna will use this to persist 38 | # information about clusters. Defaults to '127.0.0.1' 39 | # [*savanna_db_name*] 40 | # [*savanna_db_password*] 41 | # [*keystone_auth_protocol*] 42 | # Defaults to 'http', 43 | # [*keystone_auth_host*] 44 | # Defaults to '127.0.0.1' 45 | # [*keystone_auth_port*] 46 | # Defaults to '35357' 47 | # [*keystone_user*] 48 | # Defaults to 'savanna' 49 | # [*keystone_password*] 50 | # Defaults to 'savanna' 51 | # [*keystone_tenant*] 52 | # Defaults to undef 53 | # [*savanna_verbose*] 54 | # Defaults to false 55 | # [*savanna_debug*] 56 | # Defaults to false 57 | # === Examples 58 | # 59 | # class{'savanna': 60 | # savanna_host => '127.0.0.1', 61 | # db_host => '127.0.0.1', 62 | # savanna_db_password => 'savanna', 63 | # keystone_auth_host => '127.0.0.1', 64 | # keystone_password => 'admin', 65 | # savanna_verbose => True, 66 | #} 67 | # 68 | # === Authors 69 | # 70 | # Andy Edmonds 71 | # 72 | # 73 | # TODOs 74 | # - need to install disk builder and create image 75 | # or generate and install 76 | # - use a puppet type for configuration file 77 | # - clean up documentation 78 | 79 | class savanna ( 80 | $savanna_host = '127.0.0.1', 81 | $savanna_port = '8386', 82 | $savanna_verbose = false, 83 | $savanna_debug = false, 84 | # db 85 | $db_host = '127.0.0.1', 86 | $savanna_db_name = 'savanna', 87 | $savanna_db_user = 'savanna', 88 | $savanna_db_password = 'savanna', 89 | # keystone 90 | $keystone_auth_protocol = 'http', 91 | $keystone_auth_host = '127.0.0.1', 92 | $keystone_auth_port = '35357', 93 | $keystone_user = 'savanna', 94 | $keystone_password = 'savanna', 95 | $keystone_tenant = undef,) { 96 | include savanna::params 97 | 98 | # move keystone and db classes here? 99 | 100 | if !$keystone_tenant { 101 | $int_keystone_tenant = $keystone_user 102 | } else { 103 | $int_keystone_tenant = $keystone_tenant 104 | } 105 | 106 | class { '::savanna::install': 107 | } -> 108 | class { '::savanna::service': } 109 | } 110 | -------------------------------------------------------------------------------- /manifests/install.pp: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | class savanna::install { 17 | include savanna::params 18 | 19 | # this is here until this fix is released 20 | # https://bugs.launchpad.net/ubuntu/+source/python-pbr/+bug/1245676 21 | if !defined(Package['git']) { 22 | package { 'git': ensure => latest, } 23 | } 24 | 25 | if !defined(Package['python-pip']) { 26 | package { 'python-pip': 27 | ensure => latest, 28 | require => Package['git'] 29 | } 30 | } 31 | 32 | if !defined(Package['python-dev']) { 33 | package { 'python-dev': 34 | ensure => latest, 35 | require => Package['python-pip'] 36 | } 37 | } 38 | 39 | if $savanna::params::development { 40 | info("Installing and using the savanna development version. URL: 41 | ${savanna::params::development_build_url}") 42 | 43 | package { 'savanna': 44 | ensure => installed, 45 | provider => pip, 46 | source => $savanna::params::development_build_url, 47 | require => Package['python-pip'], 48 | } 49 | } else { 50 | package { 'savanna': 51 | ensure => installed, 52 | provider => pip, 53 | require => Package['python-pip'], 54 | } 55 | } 56 | 57 | group { 'savanna': 58 | ensure => present, 59 | system => true, 60 | } -> 61 | user { 'savanna': 62 | ensure => present, 63 | gid => 'savanna', 64 | system => true, 65 | home => '/var/lib/savanna', 66 | shell => '/bin/false' 67 | } -> 68 | file { '/var/lib/savanna': 69 | ensure => 'directory', 70 | owner => 'savanna', 71 | group => 'savanna', 72 | mode => '0750', 73 | } -> 74 | file { '/var/log/savanna': 75 | ensure => 'directory', 76 | owner => 'savanna', 77 | group => 'savanna', 78 | mode => '0750', 79 | } -> 80 | file { '/var/log/savanna/savanna.log': 81 | ensure => 'file', 82 | owner => 'savanna', 83 | group => 'savanna', 84 | mode => '0640', 85 | } -> 86 | file { '/etc/savanna': 87 | ensure => 'directory', 88 | owner => 'savanna', 89 | group => 'savanna', 90 | mode => '0750', 91 | } -> 92 | file { '/etc/savanna/savanna.conf': 93 | ensure => file, 94 | path => '/etc/savanna/savanna.conf', 95 | content => template('savanna/savanna.conf.erb'), 96 | owner => 'savanna', 97 | group => 'savanna', 98 | mode => '0640', 99 | } 100 | 101 | if $::osfamily == 'Debian' { 102 | file { '/etc/init.d/savanna-api': 103 | ensure => file, 104 | path => '/etc/init.d/savanna-api', 105 | content => template('savanna/savanna-api.erb'), 106 | mode => '0750', 107 | owner => 'root', 108 | group => 'root', 109 | } -> 110 | file { '/etc/savanna/savanna-api.conf': 111 | ensure => file, 112 | path => '/etc/init/savanna-api.conf', 113 | content => template('savanna/savanna-api.conf.erb'), 114 | mode => '0750', 115 | owner => 'root', 116 | group => 'root', 117 | notify => Service['savanna-api'], 118 | } 119 | } else { 120 | error('Savanna cannot be installed on this operating system. 121 | It does not have the supported initscripts. There is only 122 | support for Debian-based systems.') 123 | } 124 | } -------------------------------------------------------------------------------- /templates/savanna-api.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # upstart-job 3 | # 4 | # Symlink target for initscripts that have been converted to Upstart. 5 | 6 | set -e 7 | 8 | UPSTART_JOB_CONF="/etc/default/upstart-job" 9 | INITSCRIPT="$(basename "$0")" 10 | JOB="${INITSCRIPT%.sh}" 11 | 12 | if [ "$JOB" = "upstart-job" ]; then 13 | if [ -z "$1" ]; then 14 | echo "Usage: upstart-job JOB COMMAND" 1>&2 15 | exit 1 16 | fi 17 | 18 | JOB="$1" 19 | INITSCRIPT="$1" 20 | shift 21 | else 22 | if [ -z "$1" ]; then 23 | echo "Usage: $0 COMMAND" 1>&2 24 | exit 1 25 | fi 26 | fi 27 | 28 | COMMAND="$1" 29 | shift 30 | 31 | ECHO=echo 32 | ECHO_ERROR=echo 33 | if [ -e "$UPSTART_JOB_CONF" ]; then 34 | . "$UPSTART_JOB_CONF" 35 | fi 36 | if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ]; then 37 | ECHO=: 38 | ECHO_ERROR=: 39 | fi 40 | 41 | $ECHO "Rather than invoking init scripts through /etc/init.d, use the service(8)" 42 | $ECHO "utility, e.g. service $INITSCRIPT $COMMAND" 43 | 44 | # Only check if jobs are disabled if the currently _running_ version of 45 | # Upstart (which may be older than the latest _installed_ version) 46 | # supports such a query. 47 | # 48 | # This check is necessary to handle the scenario when upgrading from a 49 | # release without the 'show-config' command (introduced in 50 | # Upstart for Ubuntu version 0.9.7) since without this check, all 51 | # installed packages with associated Upstart jobs would be considered 52 | # disabled. 53 | # 54 | # Once Upstart can maintain state on re-exec, this change can be 55 | # dropped (since the currently running version of Upstart will always 56 | # match the latest installed version). 57 | 58 | UPSTART_VERSION_RUNNING=$(initctl version|awk '{print $3}'|tr -d ')') 59 | 60 | if dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 0.9.7 61 | then 62 | initctl show-config -e "$JOB"|grep -q '^ start on' || DISABLED=1 63 | fi 64 | 65 | case $COMMAND in 66 | status) 67 | $ECHO 68 | $ECHO "Since the script you are attempting to invoke has been converted to an" 69 | $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" 70 | $COMMAND "$JOB" 71 | ;; 72 | start|stop) 73 | $ECHO 74 | $ECHO "Since the script you are attempting to invoke has been converted to an" 75 | $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" 76 | if status "$JOB" 2>/dev/null | grep -q ' start/'; then 77 | RUNNING=1 78 | fi 79 | if [ -z "$RUNNING" ] && [ "$COMMAND" = "stop" ]; then 80 | exit 0 81 | elif [ -n "$RUNNING" ] && [ "$COMMAND" = "start" ]; then 82 | exit 0 83 | elif [ -n "$DISABLED" ] && [ "$COMMAND" = "start" ]; then 84 | exit 0 85 | fi 86 | $COMMAND "$JOB" 87 | ;; 88 | restart) 89 | $ECHO 90 | $ECHO "Since the script you are attempting to invoke has been converted to an" 91 | $ECHO "Upstart job, you may also use the stop(8) and then start(8) utilities," 92 | $ECHO "e.g. stop $JOB ; start $JOB. The restart(8) utility is also available." 93 | if status "$JOB" 2>/dev/null | grep -q ' start/'; then 94 | RUNNING=1 95 | fi 96 | if [ -n "$RUNNING" ] ; then 97 | stop "$JOB" 98 | fi 99 | # If the job is disabled and is not currently running, the job is 100 | # not restarted. However, if the job is disabled but has been forced into the 101 | # running state, we *do* stop and restart it since this is expected behaviour 102 | # for the admin who forced the start. 103 | if [ -n "$DISABLED" ] && [ -z "$RUNNING" ]; then 104 | exit 0 105 | fi 106 | start "$JOB" 107 | ;; 108 | reload|force-reload) 109 | $ECHO 110 | $ECHO "Since the script you are attempting to invoke has been converted to an" 111 | $ECHO "Upstart job, you may also use the reload(8) utility, e.g. reload $JOB" 112 | reload "$JOB" 113 | ;; 114 | *) 115 | $ECHO_ERROR 116 | $ECHO_ERROR "The script you are attempting to invoke has been converted to an Upstart" 1>&2 117 | $ECHO_ERROR "job, but $COMMAND is not supported for Upstart jobs." 1>&2 118 | exit 1 119 | esac 120 | -------------------------------------------------------------------------------- /templates/savanna.conf.erb: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | 3 | # 4 | # Options defined in savanna.config 5 | # 6 | 7 | # set host (string value) 8 | host=<%= @savanna_host %> 9 | 10 | # set port (integer value) 11 | port=<%= @savanna_port %> 12 | 13 | 14 | # 15 | # Options defined in savanna.main 16 | # 17 | 18 | # Protocol used to access OpenStack Identity service (string 19 | # value) 20 | os_auth_protocol=<%= @keystone_auth_protocol %> 21 | 22 | # IP or hostname of machine on which OpenStack Identity 23 | # service is located (string value) 24 | os_auth_host=<%= @keystone_auth_host %> 25 | 26 | # Port of OpenStack Identity service (string value) 27 | os_auth_port=<%= @keystone_auth_port %> 28 | 29 | # This OpenStack user is used to verify provided tokens. The 30 | # user must have admin role in tenant 31 | # (string value) 32 | os_admin_username=<%= @keystone_user %> 33 | 34 | # Password of the admin user (string value) 35 | os_admin_password=<%= @keystone_password %> 36 | 37 | # Name of tenant where the user is admin (string value) 38 | 39 | os_admin_tenant_name=<%= scope.lookupvar("savanna::keystone::auth::tenant") %> 40 | 41 | 42 | # 43 | # Options defined in savanna.openstack.common.db.sqlalchemy.session 44 | # 45 | 46 | # the filename to use with sqlite (string value) 47 | #sqlite_db=savanna.sqlite 48 | 49 | # If true, use synchronous mode for sqlite (boolean value) 50 | #sqlite_synchronous=true 51 | 52 | 53 | # 54 | # Options defined in savanna.openstack.common.lockutils 55 | # 56 | 57 | # Whether to disable inter-process locks (boolean value) 58 | #disable_process_locking=false 59 | 60 | # Directory to use for lock files. Default to a temp directory 61 | # (string value) 62 | lock_path=<%= scope.lookupvar("savanna::params::savanna_lockdir") %> 63 | 64 | 65 | # 66 | # Options defined in savanna.openstack.common.log 67 | # 68 | 69 | # Print debugging output (set logging level to DEBUG instead 70 | # of default WARNING level). (boolean value) 71 | debug=<%= @savanna_debug %> 72 | 73 | # Print more verbose output (set logging level to INFO instead 74 | # of default WARNING level). (boolean value) 75 | verbose=<%= @savanna_verbose %> 76 | 77 | # Log output to standard error (boolean value) 78 | #use_stderr=true 79 | 80 | # format string to use for log messages with context (string 81 | # value) 82 | #logging_context_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user)s %(tenant)s] %(instance)s%(message)s 83 | 84 | # format string to use for log messages without context 85 | # (string value) 86 | #logging_default_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s 87 | 88 | # data to append to log format when level is DEBUG (string 89 | # value) 90 | #logging_debug_format_suffix=%(funcName)s %(pathname)s:%(lineno)d 91 | 92 | # prefix each line of exception output with this format 93 | # (string value) 94 | #logging_exception_prefix=%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s 95 | 96 | # list of logger=LEVEL pairs (list value) 97 | #default_log_levels=amqplib=WARN,sqlalchemy=WARN,boto=WARN,suds=INFO,keystone=INFO,eventlet.wsgi.server=WARN 98 | 99 | # publish error events (boolean value) 100 | #publish_errors=false 101 | 102 | # make deprecations fatal (boolean value) 103 | #fatal_deprecations=false 104 | 105 | # If an instance is passed with the log message, format it 106 | # like this (string value) 107 | #instance_format="[instance: %(uuid)s] " 108 | 109 | # If an instance UUID is passed with the log message, format 110 | # it like this (string value) 111 | #instance_uuid_format="[instance: %(uuid)s] " 112 | 113 | # If this option is specified, the logging configuration file 114 | # specified is used and overrides any other logging options 115 | # specified. Please see the Python logging module 116 | # documentation for details on logging configuration files. 117 | # (string value) 118 | #log_config= 119 | 120 | # A logging.Formatter log message format string which may use 121 | # any of the available logging.LogRecord attributes. This 122 | # option is deprecated. Please use 123 | # logging_context_format_string and 124 | # logging_default_format_string instead. (string value) 125 | #log_format= 126 | 127 | # Format string for %%(asctime)s in log records. Default: 128 | # %(default)s (string value) 129 | #log_date_format=%Y-%m-%d %H:%M:%S 130 | 131 | # (Optional) Name of log file to output to. If no default is 132 | # set, logging will go to stdout. (string value) 133 | log_file=<%= scope.lookupvar("savanna::params::savanna_logdir") %>/savanna.log 134 | 135 | # (Optional) The base directory used for relative --log-file 136 | # paths (string value) 137 | # log_dir=<%= scope.lookupvar("savanna::params::savanna_logdir") %> 138 | 139 | # Use syslog for logging. (boolean value) 140 | use_syslog=<%= scope.lookupvar("savanna::params::savanna_syslog") %> 141 | 142 | # syslog facility to receive log lines (string value) 143 | #syslog_log_facility=LOG_USER 144 | 145 | 146 | # 147 | # Options defined in savanna.openstack.common.notifier.api 148 | # 149 | 150 | # Driver or drivers to handle sending notifications (multi 151 | # valued) 152 | #notification_driver= 153 | 154 | # Default notification level for outgoing notifications 155 | # (string value) 156 | #default_notification_level=INFO 157 | 158 | # Default publisher_id for outgoing notifications (string 159 | # value) 160 | #default_publisher_id=$host 161 | 162 | 163 | # 164 | # Options defined in savanna.plugins.base 165 | # 166 | 167 | # TODO(dizz): parameterise the following! 168 | # List of plugins to be loaded. Savanna preserves the order of 169 | # the list when returning it. (list value) - vanilla, hdp 170 | plugins=vanilla 171 | 172 | [plugin:vanilla] 173 | plugin_class=savanna.plugins.vanilla.plugin:VanillaProvider 174 | 175 | #[plugin:hdp] 176 | #plugin_class=savanna.plugins.hdp.plugin:AmbariPlugin 177 | 178 | # 179 | # Options defined in savanna.service.networks 180 | # 181 | 182 | # When set to false, Savanna uses only internal IP of VMs. 183 | # When set to true, Savanna expects OpenStack to auto-assign 184 | # floating IPs to cluster nodes. Internal IPs will be used for 185 | # inter-cluster communication, while floating ones will be 186 | # used by Savanna to configure nodes. Also floating IPs will 187 | # be exposed in service URLs. (boolean value) 188 | use_floating_ips=<%= scope.lookupvar("savanna::params::savanna_usefips") %> 189 | 190 | # The suffix of the node's FQDN. In nova-network that is 191 | # dhcp_domain config parameter (string value) 192 | node_domain=<%= scope.lookupvar("savanna::params::savanna_node_domain") %> 193 | 194 | 195 | [database] 196 | 197 | # 198 | # Options defined in savanna.db.migration.cli 199 | # 200 | 201 | # URL to database (string value) 202 | # connection=sqlite:////tmp/savanna-server.db 203 | connection=mysql://<%= @savanna_db_user %>:<%= @savanna_db_password %>@<%= @db_host %>/<%= @savanna_db_name %> 204 | 205 | 206 | # 207 | # Options defined in savanna.openstack.common.db.api 208 | # 209 | 210 | # The backend to use for db (string value) 211 | #backend=sqlalchemy 212 | 213 | # Enable the experimental use of thread pooling for all DB API 214 | # calls (boolean value) 215 | #use_tpool=false 216 | 217 | 218 | # 219 | # Options defined in savanna.openstack.common.db.sqlalchemy.session 220 | # 221 | 222 | # The SQLAlchemy connection string used to connect to the 223 | # database (string value) 224 | #connection=sqlite:////savanna/openstack/common/db/$sqlite_db 225 | 226 | # The SQLAlchemy connection string used to connect to the 227 | # slave database (string value) 228 | #slave_connection= 229 | 230 | # timeout before idle sql connections are reaped (integer 231 | # value) 232 | #idle_timeout=3600 233 | 234 | # Minimum number of SQL connections to keep open in a pool 235 | # (integer value) 236 | #min_pool_size=1 237 | 238 | # Maximum number of SQL connections to keep open in a pool 239 | # (integer value) 240 | #max_pool_size= 241 | 242 | # maximum db connection retries during startup. (setting -1 243 | # implies an infinite retry count) (integer value) 244 | #max_retries=10 245 | 246 | # interval between retries of opening a sql connection 247 | # (integer value) 248 | #retry_interval=10 249 | 250 | # If set, use this value for max_overflow with sqlalchemy 251 | # (integer value) 252 | #max_overflow= 253 | 254 | # Verbosity of SQL debugging information. 0=None, 255 | # 100=Everything (integer value) 256 | #connection_debug=0 257 | 258 | # Add python stack traces to SQL as comment strings (boolean 259 | # value) 260 | #connection_trace=false 261 | 262 | # If set, use this value for pool_timeout with sqlalchemy 263 | # (integer value) 264 | #pool_timeout= 265 | 266 | 267 | # Total option count: 51 268 | --------------------------------------------------------------------------------