checking Nova integration work 5/26/11
This commit is contained in:
parent
35933a2616
commit
e2eaf1313d
|
@ -0,0 +1,33 @@
|
|||
require 'puppet/provider/parsedfile'
|
||||
|
||||
novaconf = "/etc/nova/nova.conf"
|
||||
|
||||
Puppet::Type.type(:nova_config).provide(
|
||||
:parsed,
|
||||
:parent => Puppet::Provider::ParsedFile,
|
||||
:default_target => novaconf,
|
||||
:filetype => :flat
|
||||
) do
|
||||
|
||||
confine :exists => novaconf
|
||||
text_line :comment, :match => /^\s*#/;
|
||||
text_line :blank, :match => /^\s*$/;
|
||||
|
||||
record_line :parsed,
|
||||
:fields => %w{line},
|
||||
:match => /--(.*)/ ,
|
||||
:post_parse => proc { |hash|
|
||||
Puppet.debug("nova config line:#{hash[:line]} has been parsed")
|
||||
if hash[:line] =~ /(\S+)\s*=\s*(\S+)/
|
||||
hash[:name]=$1
|
||||
hash[:value]=$2
|
||||
else
|
||||
raise Puppet::Error, "Invalid line: #{hash[:line]}"
|
||||
end
|
||||
}
|
||||
|
||||
def self.to_line(hash)
|
||||
"--#{hash[:name]}=#{hash[:value]}"
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
Puppet::Type.newtype(:nova_config) do
|
||||
|
||||
ensurable
|
||||
|
||||
newparam(:name, :namevar => true) do
|
||||
newvalues(/\S+/)
|
||||
end
|
||||
|
||||
newproperty(:value) do
|
||||
newvalues(/\S+/)
|
||||
end
|
||||
|
||||
newproperty(:target) do
|
||||
desc "Path to our nova config file"
|
||||
defaultto {
|
||||
if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
|
||||
@resource.class.defaultprovider.default_target
|
||||
else
|
||||
nil
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
end
|
|
@ -2,6 +2,7 @@ class nova::all(
|
|||
$xenapi_connection_url,
|
||||
$xenapi_connection_username,
|
||||
$xenapi_connection_password,
|
||||
$xenapi_inject_image = 'false',
|
||||
$sql_connection,
|
||||
$network_manager,
|
||||
$image_service,
|
||||
|
@ -9,7 +10,6 @@ class nova::all(
|
|||
$nodaemon = 'undef',
|
||||
$flat_network_bridge = 'xenbr0',
|
||||
$connection_type = 'xenapi',
|
||||
$xenapi_inject_image = 'false',
|
||||
$rescue_timeout = '86400',
|
||||
$allow_admin_api = 'true',
|
||||
$xenapi_inject_image = 'false',
|
||||
|
@ -43,4 +43,10 @@ class nova::all(
|
|||
class { "nova::network": isServiceEnabled => false }
|
||||
class { "nova::objectstore": isServiceEnabled => false }
|
||||
class { "nova::scheduler": isServiceEnabled => false }
|
||||
class { 'nova::db':
|
||||
password => 'password',
|
||||
name => 'nova',
|
||||
user => 'nova',
|
||||
host => 'localhost',
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,24 @@
|
|||
class nova::compute( $isServiceEnabled=false ) inherits nova {
|
||||
class nova::compute(
|
||||
$enabled = false,
|
||||
$nova_config = '/etc/nova/nova.conf'
|
||||
) {
|
||||
|
||||
Nova_config<| |>~>Service['nova_compute']
|
||||
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
|
||||
package { "nova-compute":
|
||||
ensure => present,
|
||||
require => Package["python-greenlet"]
|
||||
require => Class['nova']
|
||||
}
|
||||
|
||||
service { "nova-compute":
|
||||
ensure => $isServiceEnabled,
|
||||
ensure => $service_ensure,
|
||||
enable => $enabled,
|
||||
require => Package["nova-compute"],
|
||||
subscribe => File["/etc/nova/nova.conf"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
class nova::compute::xenserver(
|
||||
$enabled = false
|
||||
$xenapi_connection_url,
|
||||
$xenapi_connection_username,
|
||||
$xenapi_connection_password,
|
||||
$xenapi_inject_image=false,
|
||||
) inherits nova {
|
||||
|
||||
class { 'nova::compute':
|
||||
enabled => $enabled,
|
||||
}
|
||||
|
||||
nova_config { 'xenapi_connection_url':
|
||||
value => $xenapi_connection_url,
|
||||
}
|
||||
nova_config { 'xenapi_connection_username':
|
||||
value => $xenapi_connection_username,
|
||||
}
|
||||
nova_config { 'xenapi_connection_password':
|
||||
value => $xenapi_connection_password,
|
||||
}
|
||||
nova_config { 'xenapi_inject_image':
|
||||
value => $xenapi_inject_image,
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
class nova::db(
|
||||
$db_pw,
|
||||
$db_user = 'nova'
|
||||
$db_name = 'nova',
|
||||
$db_host => 'localhost'
|
||||
$password,
|
||||
$name = 'nova',
|
||||
$user = 'nova',
|
||||
$host = 'localhost'
|
||||
) {
|
||||
mysql::db { $db_name:
|
||||
db_user => $db_user,
|
||||
db_pw => $db_pw,
|
||||
db_hostname => $db_hostname,
|
||||
mysql::db { $name:
|
||||
user => $user,
|
||||
password => $password,
|
||||
host => $host,
|
||||
# I may want to inject some sql
|
||||
# sql='',
|
||||
require => Class['mysql::server']
|
||||
require => Class['mysql::server'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
class nova( $novaConfHash ) {
|
||||
class nova(
|
||||
$verbose = false,
|
||||
$nodaemon = false,
|
||||
sql_connection,
|
||||
# just for network?
|
||||
network_manager
|
||||
) {
|
||||
|
||||
class { 'puppet': }
|
||||
class {
|
||||
|
@ -18,9 +24,5 @@ class nova( $novaConfHash ) {
|
|||
require => Package["python-greenlet"]
|
||||
}
|
||||
|
||||
file { "/etc/nova/nova.conf":
|
||||
ensure => present,
|
||||
content => template("nova/nova.conf.erb"),
|
||||
require => Package["nova-common"]
|
||||
}
|
||||
Nova_config<| require +> Package["nova-common"] |>
|
||||
}
|
||||
|
|
|
@ -23,3 +23,10 @@ class nova-compute-test {
|
|||
class { "nova::compute": isServiceEnabled => false }
|
||||
}
|
||||
include nova-compute-test
|
||||
|
||||
|
||||
class { 'nova::compute':
|
||||
|
||||
}
|
||||
|
||||
class { 'nova': }
|
|
@ -0,0 +1,9 @@
|
|||
class { 'mysql::server':
|
||||
root_password => 'password'
|
||||
}
|
||||
class { 'nova::db':
|
||||
password => 'password',
|
||||
name => 'nova',
|
||||
user => 'nova',
|
||||
host => 'localhost',
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
resources { 'nova_config':
|
||||
purge => true
|
||||
}
|
||||
nova_config { ['verbose', 'nodaemomize']:
|
||||
value => 'true',
|
||||
}
|
||||
nova_config { 'xenapi_connection_username':
|
||||
value => 'rootty',
|
||||
}
|
|
@ -9,6 +9,9 @@ class { 'apt':
|
|||
class { 'nova::repo':
|
||||
stage => 'repo-setup',
|
||||
}
|
||||
class { 'mysql::server':
|
||||
root_password => 'password'
|
||||
}
|
||||
class { 'nova::all':
|
||||
verbose => 'undef',
|
||||
nodaemon => 'undef',
|
||||
|
@ -28,17 +31,3 @@ class { 'nova::all':
|
|||
ipv6_backend => 'account_identifier',
|
||||
}
|
||||
|
||||
# this will probably be on its own machine
|
||||
class mysql::server {
|
||||
mysql_root_pw => 'foo',
|
||||
}
|
||||
|
||||
mysql::db {
|
||||
db_user,
|
||||
db_pw,
|
||||
db_charset = 'utf8',
|
||||
host = 'localhost',
|
||||
grant='all',
|
||||
sql=''
|
||||
) {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue