Skip to content
This repository has been archived by the owner on Aug 31, 2019. It is now read-only.

Commit

Permalink
Merge pull request #37 from eucalyptus/master
Browse files Browse the repository at this point in the history
Fixes and updates to work with Puppet 3.0
  • Loading branch information
dkavanagh committed Oct 30, 2012
2 parents 2b49116 + 8823225 commit 8bea498
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 103 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -3,4 +3,7 @@ Eucalyptus-Puppet Integration

This module is designed to configure Eucalyptus components on physical nodes. It contains classes for the 5 main software components as well as certain OS dependencies. So far, it has been tested with CentOS and Puppet 2.7.3

To find out more on using this module, read the quickstart guide:
https://github.com/eucalyptus/puppetlabs-eucalyptus/wiki/Quickstart:-Puppet-&-Eucalyptus

[Eucalyptus](http://www.eucalyptus.com)
10 changes: 9 additions & 1 deletion eucalyptus/lib/facter/eucakeys.rb
Expand Up @@ -37,7 +37,15 @@
Facter.add("eucakeys_" + clustername + "_#{keyname.sub('.pem','').sub('-','_')}") do
setcode do
File.read("#{eucakey_dir}/#{clustername}/#{keyname}")
end
end
end
end
# Collect VPN tunnel passwords for VNET_TUNNELLING
if keyname.match(/vtunpass/)
Facter.add("eucakeys_" + clustername + "_#{keyname}") do
setcode do
File.read("#{eucakey_dir}/#{clustername}/#{keyname}")
end
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions eucalyptus/lib/puppet/type/eucalyptus_config.rb
Expand Up @@ -3,14 +3,14 @@
ensurable

newparam(:name, :namevar => true) do
newvalues(/^\S+$/)
newvalues(/^\S+(.*?)$/)
end

newproperty(:value) do
munge do |value|
value.to_s
end
newvalues(/^\S+$/)
newvalues(/^\S+(.*?)$/)
end

newproperty(:target) do
Expand Down
47 changes: 47 additions & 0 deletions eucalyptus/manifests/arbitrator.pp
@@ -0,0 +1,47 @@
# Arbitrator support (For use in HA mode)
#
# Eucalyptus uses a periodic ICMP echo / ping test to an external IP address.
# This test approximates an end user's ability to access the system. If Eucalyptus determines
# that it cannot reach the host associated with a registered Arbitrator, all Eucalyptus
# services operating on that host attempt to failover to the alternate hosts running those services
#
# == Parameters
#
# [*partition_name*] Unique name for the arbitrator in the cloud
# [*service_host*] Host this arbitrator/ping will run from
# [*gateway_host*] Host to ping to check for connectivity, could be the gateway
#
# == Examples
#
# eucalyptus::arbitrator { 'clc_arbitrator01':
# partition_name => 'clc_arbitrator01',
# service_host => '192.168.0.50',
# gateway_host => '192.168.0.1',
# }
#
# == Authors
#
# Tom Ellis <tom.ellis@eucalyptus.com\>
#
# == Copyright
#
# Copyright 2012 Eucalyptus INC under the Apache 2.0 license

define eucalyptus::arbitrator(
$partition_name,
$service_host,
$gateway_host,
) {
# Exec using euca-register-arbitrator
exec { "arbitrator_${partition_name}":
command => "/usr/sbin/euca-register-arbitrator -P $partition_name -H $service_host $partition_name",
unless => "/usr/sbin/euca-describe-arbitrators | /bin/grep -i '$partition_name' | /bin/grep -qi '$service_host'",
}
# Use cloud_properties to set the gateway address
# TODO: Get this to run after exec above, since property will not exist unless above has run.
# Can't wrap this in a class. Works at the moment after second puppet run.
eucalyptus::cloud_properties { "arbitrator_gateway_${partition_name}":
property_name => "$partition_name.arbitrator.gatewayhost",
property_value => "$gateway_host",
}
}
4 changes: 2 additions & 2 deletions eucalyptus/manifests/cc.pp
Expand Up @@ -14,7 +14,7 @@
}
}

class eucalyptus::cc_config {
class eucalyptus::cc_config inherits eucalyptus::cc {
File <<|title == "${cloud_name}_cloud_cert"|>>
File <<|title == "${cloud_name}_cloud_pk"|>>
File <<|title == "${cloud_name}_${cluster_name}_cluster_cert"|>>
Expand All @@ -23,7 +23,7 @@
File <<|title == "${cloud_name}_${cluster_name}_node_pk"|>>
}

class eucalyptus::cc_reg {
class eucalyptus::cc_reg inherits eucalyptus::cc {
Class[eucalyptus::cc_reg] -> Class[eucalyptus::cc_config]
@@exec { "reg_cc_${hostname}":
command => "/usr/sbin/euca_conf --no-rsync --no-scp --no-sync --register-cluster --partition $cluster_name --host $ipaddress --component cc_$hostname",
Expand Down
34 changes: 17 additions & 17 deletions eucalyptus/manifests/clc.pp
Expand Up @@ -13,7 +13,7 @@
}

}
class eucalyptus::clc_config {
class eucalyptus::clc_config inherits eucalyptus::clc {
Class[eucalyptus::repo] -> Package['eucalyptus-cloud'] -> Class[eucalyptus::conf] -> Exec['init-db'] -> Service['eucalyptus-cloud'] -> Class[eucalyptus::clc_reg]

exec { 'init-db':
Expand All @@ -24,33 +24,33 @@

# Cloud-wide
@@file { "${cloud_name}_cloud_cert":
path => '/var/lib/eucalyptus/keys/cloud-cert.pem',
path => '/var/lib/eucalyptus/keys/cloud-cert.pem',
content => "$eucakeys_cloud_cert",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}_cloud_cert",
}
@@file { "${cloud_name}_cloud_pk":
path => '/var/lib/eucalyptus/keys/cloud-pk.pem',
path => '/var/lib/eucalyptus/keys/cloud-pk.pem',
content => "$eucakeys_cloud_pk",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}_cloud_pk",
}
@@file { "${cloud_name}_euca.p12":
path => '/var/lib/eucalyptus/keys/euca.p12',
path => '/var/lib/eucalyptus/keys/euca.p12',
content => "$eucakeys_euca_p12",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}_euca.p12",
}

Eucalyptus_config <||>
}
class eucalyptus::clc_reg {
class eucalyptus::clc_reg inherits eucalyptus::clc {
Class[eucalyptus::clc_config] -> Class[eucalyptus::clc_reg]
Exec <<|tag == "$cloud_name"|>>
}
Expand Down
16 changes: 7 additions & 9 deletions eucalyptus/manifests/clc2.pp
@@ -1,7 +1,8 @@
class eucalyptus::clc2 ($cloud_name = "cloud1") {
include eucalyptus
include eucalyptus::conf

Class[eucalyptus] -> Class[eucalyptus::clc2]
Class[eucalyptus::repo] -> Package[eucalyptus-cloud] -> Class[eucalyptus::clc2_config] -> Eucalyptus_config<||> -> Service[eucalyptus-cloud]

class eucalyptus::clc2_install {
package { 'eucalyptus-cloud':
Expand All @@ -13,15 +14,12 @@
require => Package['eucalyptus-cloud'],
}
}
class eucalyptus::clc2_config {
Class[eucalyptus::clc2_install] -> Class[eucalyptus::clc2_config]
File <<|title == "${cloud_name}_cloud_cert"|>>
File <<|title == "${cloud_name}_cloud_pk"|>>
File <<|title == "${cloud_name}_euca.p12"|>>
Package[eucalyptus-cloud] -> Eucalyptus_config<||> -> Service[eucalyptus-cloud]
Eucalyptus_config <||>
class eucalyptus::clc2_config inherits eucalyptus::clc2 {
File <<|tag == "${cloud_name}_cloud_cert"|>>
File <<|tag == "${cloud_name}_cloud_pk"|>>
File <<|tag == "${cloud_name}_euca.p12"|>>
}
class eucalyptus::clc2_reg {
class eucalyptus::clc2_reg inherits eucalyptus::clc2 {
@@exec { "reg_clc_${hostname}":
command => "/usr/sbin/euca_conf --no-rsync --no-scp --no-sync --register-cloud --partition eucalyptus --host $ipaddress --component clc_$hostname",
unless => "/usr/sbin/euca_conf --list-clouds | /bin/grep '\b$ipaddress\b'",
Expand Down
8 changes: 5 additions & 3 deletions eucalyptus/manifests/cloud_properties.pp
Expand Up @@ -28,8 +28,10 @@
$property_value
) {
# Exec using euca-modify-property
exec { "cloud_property_${property_value}":
command => "/usr/sbin/euca-modify-property -p $property_name=$property_value",
unless => "/usr/sbin/euca-describe-properties | /bin/grep -i '$property_name' | /bin/grep -qi '$property_value'",
exec { "cloud_property_${property_name}":
command => "/usr/sbin/euca-modify-property -p $property_name=$property_value",
unless => "/usr/sbin/euca-describe-properties | /bin/grep -i '$property_name' | /bin/grep -qi '$property_value'",
tries => "3",
try_sleep => "2",
}
}
49 changes: 29 additions & 20 deletions eucalyptus/manifests/cluster.pp
Expand Up @@ -5,38 +5,47 @@
# One of these for each cluster
$node_cert = "eucakeys_${cluster_name}_node_cert"
@@file { "${cloud_name}_${cluster_name}_node_cert":
path => '/var/lib/eucalyptus/keys/node-cert.pem',
path => '/var/lib/eucalyptus/keys/node-cert.pem',
content => inline_template("<%= scope.lookupvar(node_cert) %>"),
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
}
$nc_pk = "eucakeys_${cluster_name}_node_pk"
@@file { "${cloud_name}_${cluster_name}_node_pk":
path => '/var/lib/eucalyptus/keys/node-pk.pem',
path => '/var/lib/eucalyptus/keys/node-pk.pem',
content => inline_template("<%= scope.lookupvar(nc_pk) %>"),
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
}
$cc_cert = "eucakeys_${cluster_name}_cluster_cert"
@@file { "${cloud_name}_${cluster_name}_cluster_cert":
path => '/var/lib/eucalyptus/keys/cluster-cert.pem',
path => '/var/lib/eucalyptus/keys/cluster-cert.pem',
content => inline_template("<%= scope.lookupvar(cc_cert) %>"),
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
}
$cc_pk = "eucakeys_${cluster_name}_cluster_pk"
@@file { "${cloud_name}_${cluster_name}_cluster_pk":
path => '/var/lib/eucalyptus/keys/cluster-pk.pem',
path => '/var/lib/eucalyptus/keys/cluster-pk.pem',
content => inline_template("<%= scope.lookupvar(cc_pk) %>"),
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
}
$cc_vtunpass = "eucakeys_${cluster_name}_vtunpass"
@@file { "${cloud_name}_${cluster_name}_vtunpass":
path => '/var/lib/eucalyptus/keys/vtunpass',
content => inline_template("<%= scope.lookupvar(cc_vtunpass) %>"),
owner => 'eucalyptus',
group => 'eucalyptus',
mode => '0700',
tag => "${cloud_name}",
}
}
4 changes: 4 additions & 0 deletions eucalyptus/manifests/conf.pp
Expand Up @@ -28,6 +28,8 @@
$instance_path = "/var/lib/eucalyptus/instances",
$vnet_bridge = "br0",
$vnet_dhcpdaemon = "/usr/sbin/dhcpd41",
$vnet_disable_tunneling = "y",
$cc_arbitrators = "none",
)
{
@eucalyptus_config {
Expand Down Expand Up @@ -59,5 +61,7 @@
'INSTANCE_PATH': value => $instance_path;
'VNET_BRIDGE': value => $vnet_bridge;
'VNET_DHCPDAEMON': value => $vnet_dhcpdaemon;
'DISABLE_TUNNELING': value => $vnet_disable_tunneling;
'CC_ARBITRATORS': value => $cc_arbitrators;
}
}
43 changes: 0 additions & 43 deletions eucalyptus/manifests/hypervisor.pp

This file was deleted.

4 changes: 2 additions & 2 deletions eucalyptus/manifests/nc.pp
Expand Up @@ -14,14 +14,14 @@
}
}

class eucalyptus::nc_config {
class eucalyptus::nc_config inherits eucalyptus::nc {
File <<|title == "${cloud_name}_${cluster_name}_cluster_cert"|>>
File <<|title == "${cloud_name}_${cluster_name}_node_cert"|>>
File <<|title == "${cloud_name}_${cluster_name}_node_pk"|>>
File <<|title == "${cloud_name}_cloud_cert"|>>
}

class eucalyptus::nc_reg {
class eucalyptus::nc_reg inherits eucalyptus::nc {
#Eucalyptus_config <||> { notify => Service["eucalyptus-nc"] }
# Causes too many service refreshes
Eucalyptus_config <||>
Expand Down
4 changes: 2 additions & 2 deletions eucalyptus/manifests/sc.pp
Expand Up @@ -15,11 +15,11 @@
}
}

class eucalyptus::sc_config {
class eucalyptus::sc_config inherits eucalyptus::sc {
File <<|title == "${cloud_name}_euca.p12"|>>
}

class eucalyptus::sc_reg {
class eucalyptus::sc_reg inherits eucalyptus::sc {
Class[eucalyptus::sc_reg] -> Class[eucalyptus::sc_config]
@@exec { "reg_sc_${hostname}":
command => "/usr/sbin/euca_conf --no-rsync --no-scp --no-sync --register-sc --partition ${cluster_name} --host $ipaddress --component sc_$hostname",
Expand Down
4 changes: 2 additions & 2 deletions eucalyptus/manifests/walrus.pp
Expand Up @@ -15,11 +15,11 @@
}
}

class eucalyptus::walrus_config {
class eucalyptus::walrus_config inherits eucalyptus::walrus {
File <<|title == "${cloud_name}_euca.p12"|>>
}

class eucalyptus::walrus_reg {
class eucalyptus::walrus_reg inherits eucalyptus::walrus {
@@exec { "reg_walrus_${hostname}":
command => "/usr/sbin/euca_conf --no-rsync --no-scp --no-sync --register-walrus --partition walrus --host $ipaddress --component walrus_$hostname",
unless => "/usr/sbin/euca_conf --list-walruses | /bin/grep '\b$ipaddress\b'",
Expand Down

0 comments on commit 8bea498

Please sign in to comment.