Skip to content

Instantly share code, notes, and snippets.

@garthk
Created March 26, 2012 03:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garthk/2202745 to your computer and use it in GitHub Desktop.
Save garthk/2202745 to your computer and use it in GitHub Desktop.
bigbluebutton recipe for Puppet (requires manual fixup: see comments)
class bbb($bbb_hostname = $fqdn, $salt = "d34db33fba5eba11f01dab1e5ca1ab1e") {
exec { "dist upgrade":
refreshonly => true,
command => "/usr/bin/apt-get dist-upgrade",
}
exec { "update and dist upgrade":
refreshonly => true,
command => "/usr/bin/apt-get update",
notify => Exec["dist upgrade"],
}
apt::source { "bigbluebutton":
location => "http://ubuntu.bigbluebutton.org/lucid_dev_08/",
release => "bigbluebutton-lucid",
repos => "main",
key => "328BD16D",
key_source => "http://ubuntu.bigbluebutton.org/bigbluebutton.asc",
# pin => "-10",
include_src => false,
notify => Exec["update and dist upgrade"],
}
apt::source { "freeswitch":
location => "http://ppa.launchpad.net/freeswitch-drivers/freeswitch-nightly-drivers/ubuntu",
release => "lucid",
repos => "main",
key => "451AE93C",
key_server => "keyserver.ubuntu.com",
# pin => "-10",
include_src => false,
notify => Exec["update and dist upgrade"],
}
include fixedruby18
include noapache2
package { "bigbluebutton":
ensure => installed,
require => [
Apt::Source["bigbluebutton"],
Apt::Source["freeswitch"],
Package["rubygems1.8"],
Exec["update_rubygems1.8"],
],
}
$propfile = "/var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties"
$serverURL = "http://${bbb_hostname}"
exec { "setsalt":
command => "/usr/local/bin/bbb-conf --setsalt ${salt}",
path => "/bin:/usr/bin",
onlyif => "test `grep securitySalt ${propfile}|cut -f 2 -d =` != ${salt}",
require => Package["bigbluebutton"],
notify => Exec['bbb-conf restart'],
}
exec { "setip":
command => "/usr/local/bin/bbb-conf --setip ${bbb_hostname}",
path => "/bin:/usr/bin",
onlyif => "test `grep ^bigbluebutton.web.serverURL ${propfile} | cut -f 2 -d =` != ${serverURL}",
require => Package["bigbluebutton"],
notify => Exec['bbb-conf restart'],
}
exec { "bbb-conf restart":
refreshonly => true,
command => "/usr/local/bin/bbb-conf --restart",
}
}
class bbb_demo(salt = "d34db33fba5eba11f01dab1e5ca1ab1e") {
Class['bbb'] -> Class['bbb_demo']
file { "bbb_api_conf.jsp":
path => "/var/lib/tomcat6/webapps/demo/bbb_api_conf.jsp",
content => template("/etc/puppet/templates/bbb_api_conf.jsp.erb"),
# notify => Exec['bbb-conf restart'],
}
package { "bbb-demo":
ensure => installed,
require => Package["bigbluebutton"],
}
}
<%%!
// This is the security salt that must match the value set in the BigBlueButton server
String salt = "<%= salt %>";
// This is the URL for the BigBlueButton server
<% if has_variable?("bbb_hostname") then %>
String BigBlueButtonURL = "http://<%= bbb_hostname %>/bigbluebutton/";
<% else %>
String BigBlueButtonURL = "http://<%= fqdn %>/bigbluebutton/";
<% end %>
%>
# /etc/puppet/manifests/classes/fixedruby18.pp
#
# bigbluebutton can't install without a recent rubygems, with which Ubuntu 10.04 doesn't ship.
# This might be brittle due to requiring gem to be 1.x where x >=8; fix the test for points.
class fixedruby18 {
exec { "install_update_rubygems1.8":
command => "/usr/bin/gem1.8 install rubygems-update",
creates => "/var/lib/gems/1.8/bin/update_rubygems",
require => Package["rubygems1.8"],
}
exec { "update_rubygems1.8":
require => Exec["install_update_rubygems1.8"],
command => "/var/lib/gems/1.8/bin/update_rubygems",
onlyif => "test `gem1.8 -v | cut -f 1 -d .` -eq 1 -a `gem1.8 -v | cut -f 2 -d .` -lt 8",
path => "/usr/bin",
}
package { ["ruby1.8-dev", "rubygems1.8"]:
ensure => installed,
}
}
# /etc/puppet/manifests/classes/noapache2.pp
#
# Removes apache2 from an Ubuntu server.
# Removal is sometimes not enough, hence the service definition.
class noapache2 {
package { 'apache2':
ensure => purged,
}
service { 'apache2':
ensure => stopped,
enable => false,
}
exec { 'autoremove':
command => '/usr/bin/apt-get autoremove --purge -y',
refreshonly => true,
subscribe => Package['apache2'],
}
}
# /etc/puppet/manifests/nodes/bbbexample.pp
#
# Example node definition
# Please do NOT re-use salts!
node "bbb.example.com" {
$salt = "2eeaf32f1c117a7efd85719261f09cfe"
class { 'bbb': salt => $salt }
class { 'bbb_demo': salt => $salt }
}
@garthk
Copy link
Author

garthk commented Mar 26, 2012

It's not quite yet working. On the first try, you'll get an error:

Errors were encountered while processing:
/var/cache/apt/archives/bbb-record-core_0.80ubuntu104_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

notice: /Stage[main]/Bbb/File[bbb_api_conf.jsp]: Dependency package[bigbluebutton] has 1 failures
warning: /Stage[main]/Bbb/File[bbb_api_conf.jsp]: Skipping because of failed dependencies
notice: /Stage[main]//Node[meet2.external.techteam.netapp.com]/Package[bbb-demo]: Dependency package[bigbluebutton] has 1 failures
warning: /Stage[main]//Node[meet2.external.techteam.netapp.com]/Package[bbb-demo]: Skipping because of failed dependencies
notice: /Stage[main]/Bbb/Exec[update and dist upgrade]: Triggering 'refresh' from 6 dependencies
info: /Stage[main]/Bbb/Exec[update and dist upgrade]: Scheduling refresh of Exec[dist upgrade]
notice: /Stage[main]/Bbb/Exec[dist upgrade]: Triggering 'refresh' from 1 dependencies
err: /Stage[main]/Bbb/Exec[dist upgrade]: Failed to call refresh on Exec[dist upgrade]: /usr/bin/apt-get dist-upgrade returned 100 instead of one of [0] at /etc/puppet/manifests/classes/bbb.pp:22

On re-running apt-get dist-upgrade, you'll see a more useful error message:

Reading package lists...
Building dependency tree...
Reading state information...
You might want to run `apt-get -f install' to correct these.
The following packages have unmet dependencies:
bbb-playback-slides: Depends: bbb-record-core but it is not installed
E: Unmet dependencies. Try using -f.

Running apt-get update -f will finish apt-get dist-upgrade's job, after which you can run Puppet again to complete the installation.

It's not the one-run-install I want, but it's a start.

@garthk
Copy link
Author

garthk commented Mar 27, 2012

Fixed broken BigBlueButtonURL in bbb_api_conf.jsp. It might still be broken if $bbb_hostname != $fqdn, but I'm back to a working configuration.

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