Skip to content

Instantly share code, notes, and snippets.

@brianloveswords
Created September 13, 2011 16:37
Show Gist options
  • Save brianloveswords/1214267 to your computer and use it in GitHub Desktop.
Save brianloveswords/1214267 to your computer and use it in GitHub Desktop.
Provisioning for openbadges
Exec {
path => [
'/usr/local/bin',
'/usr/local/sbin',
'/usr/bin/',
'/usr/sbin',
'/bin',
'/sbin'],
logoutput => true,
}
package {
"git-core": ensure => installed;
"python": ensure => installed;
"python-dev": ensure => installed;
"python-setuptools": ensure => installed;
"build-essential": ensure => installed;
"htop": ensure => installed;
"curl":
ensure => installed,
before => [ Exec["download_mongo"], Exec["download_node"] ];
"nginx":
ensure => installed,
before => Service['nginx'];
"libssl-dev":
ensure => installed,
before => Exec["install_node"];
}
service { 'nginx' :
ensure => running,
enable => true,
hasrestart => true,
}
define nodejs($version="0.4.11") {
exec { "download_node":
cwd => "/usr/local/src",
command => "curl http://nodejs.org/dist/node-v$version.tar.gz | tar -xz",
creates => "/usr/local/src/node-v$version",
before => Exec["install_node"],
}
exec { "install_node":
cwd => "/usr/local/src/node-v$version",
command => "./configure && make && make install",
creates => "/usr/local/bin/node",
}
}
define mongo($version="2.0.0", $arch="i686") {
file { "/data":
ensure => directory,
owner => 1000,
group => 1000,
before => File["/data/db"],
}
file { "/data/db":
ensure => directory,
owner => 1000,
group => 1000,
before => Exec["start_mongo"],
}
exec { "download_mongo":
cwd => "/usr/local/src",
command => "curl http://fastdl.mongodb.org/linux/mongodb-linux-$arch-$version.tgz | tar -xz",
creates => "/usr/local/src/mongodb-linux-$arch-$version",
before => Exec['install_mongo'],
}
exec { "install_mongo":
command => "ln -s /usr/local/src/mongodb-linux-$arch-$version/bin/* /usr/local/bin",
creates => "/usr/local/bin/mongod",
before => Exec['start_mongo'],
}
exec { "start_mongo":
command => "mongod --bind_ip=127.0.0.1 &",
unless => 'ps `cat /data/db/mongod.lock` | grep mongod',
}
}
mongo { "install_and_run":
version => "2.0.0",
arch => "x86_64";
}
nodejs { "install":
version => "0.4.11",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment