Skip to content

Instantly share code, notes, and snippets.

@niallo
Created March 8, 2012 21:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save niallo/2003430 to your computer and use it in GitHub Desktop.
Save niallo/2003430 to your computer and use it in GitHub Desktop.
Puppet class recipe to install Node.JS & ZeroMQ on Ubuntu 10.04 LTS / Lucid
class nodejs {
Package { ensure => "installed" }
$pkglist = [ "python-software-properties" ]
package { $pkglist: }
$apt-base = "/etc/sources.list.d/chris-lea"
Exec { require => package["python-software-properties"] }
exec { "node-repo" :
command => "/usr/bin/add-apt-repository ppa:chris-lea/node.js",
creates => "${apt-base}/node.js-lucid.list",
}
exec { "zeromq-repo" :
command => "/usr/bin/add-apt-repository ppa:chris-lea/zeromq",
creates => "${apt-base}/zeromq-lucid.list",
}
exec { "libpgm-repo" :
command => "/usr/bin/add-apt-repository ppa:chris-lea/libpgm",
creates => "${apt-base}/libpgm-lucid.list"
}
$required-execs = [ "node-repo", "zeromq-repo", "libpgm-repo" ]
exec { "apt-ready" :
command => "/usr/bin/apt-get update",
require => Exec[$required-execs]
}
package { [ "nodejs", "nodejs-dev", "libzmq-dev" ] :
require => Exec["apt-ready"]
}
}
@garthk
Copy link

garthk commented Mar 30, 2012

Thanks!

Notes to help others running 10.04:

  • Try $apt-base = "/etc/apt/sources.list.d/chris-lea", which matched my fresh 10.04 clone.
  • In node-repo, try creates => "${apt-base}-node.js-lucid.list" to add it only if it's not there.
  • Use my fork if you're not big on editing.
  • Use the puppet-chrislea module Nial inspired if you want something module shaped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment