puppet: Store the machine's type in /etc and add script to reapply the appropriate puppet config

Fixes #815

(imported from commit 0c90b74b9b11e4abcc875fbd7a2f0c48356678b2)
This commit is contained in:
Zev Benjamin 2013-02-11 12:12:51 -05:00
parent 801d2c40e2
commit 98add6efa2
4 changed files with 20 additions and 4 deletions

View File

@ -74,7 +74,7 @@ scp -i "$amazon_key_file" "$humbug_cert_file" root@"$server":/root/humbug/certs/
ssh "$server" -t -i "$amazon_key_file" -lroot <<EOF
cp -a /root/humbug/servers/puppet/modules/humbug/files/puppet.conf /etc/puppet/
puppet apply -e 'include humbug::$type'
puppet apply -e 'class {"humbug": machinetype => "$type"}'
# These server restarting bits should be moveable into puppet-land, ideally
apt-get -y upgrade
if [ -e "/etc/init.d/nginx" ]; then

View File

@ -1,6 +1,4 @@
class humbug::base {
class {'humbug': }
$packages = [ "screen", "strace", "vim", "emacs23-nox", "git", "python-tz",
"sqlite3", "ntp", "python-simplejson", "host",
"openssh-server", "python-pip", "puppet-el",

View File

@ -1,4 +1,12 @@
class humbug {
class humbug ($machinetype) {
class { "humbug::$machinetype": }
file { '/etc/humbug-machinetype':
ensure => file,
mode => 644,
content => "$machinetype\n",
}
Exec { path => "/usr/sbin:/usr/bin:/sbin:/bin" }
class {'apt': }

10
servers/update-server Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
machinetype=$(cat /etc/humbug-machinetype | sed -e 's/\n$//')
if [ -z "$machinetype" ]; then
echo "No /etc/humbug-machinetype file found."
echo "Please create it and then re-run this script."
exit 1
fi
puppet apply -e "class {'humbug': machinetype => '$machinetype'}"