From 8fd484c88859ce188133d4cdac80b7d005e649fd Mon Sep 17 00:00:00 2001 From: Robert Wilson Date: Sun, 9 Feb 2014 21:45:56 +0000 Subject: [PATCH 1/3] Add mumble to Pandora --- manifests/nodes/pandora.geeksoc.org.pp | 4 + modules/mumble/.puppet-lint.rc | 1 + modules/mumble/README | 38 +++++++++ modules/mumble/manifests/config.pp | 11 +++ modules/mumble/manifests/firewall.pp | 16 ++++ modules/mumble/manifests/group.pp | 9 +++ modules/mumble/manifests/init.pp | 25 ++++++ modules/mumble/manifests/install.pp | 14 ++++ modules/mumble/manifests/iptables.pp | 16 ++++ modules/mumble/manifests/params.pp | 11 +++ modules/mumble/manifests/service.pp | 11 +++ modules/mumble/manifests/user.pp | 10 +++ modules/mumble/templates/mumble-server.erb | 91 ++++++++++++++++++++++ 13 files changed, 257 insertions(+) create mode 100644 modules/mumble/.puppet-lint.rc create mode 100644 modules/mumble/README create mode 100644 modules/mumble/manifests/config.pp create mode 100644 modules/mumble/manifests/firewall.pp create mode 100644 modules/mumble/manifests/group.pp create mode 100644 modules/mumble/manifests/init.pp create mode 100644 modules/mumble/manifests/install.pp create mode 100644 modules/mumble/manifests/iptables.pp create mode 100644 modules/mumble/manifests/params.pp create mode 100644 modules/mumble/manifests/service.pp create mode 100644 modules/mumble/manifests/user.pp create mode 100644 modules/mumble/templates/mumble-server.erb diff --git a/manifests/nodes/pandora.geeksoc.org.pp b/manifests/nodes/pandora.geeksoc.org.pp index 7b16878..99f9f86 100644 --- a/manifests/nodes/pandora.geeksoc.org.pp +++ b/manifests/nodes/pandora.geeksoc.org.pp @@ -26,7 +26,11 @@ class {'sudo': sudoers => '%sysadmin-games', } + # Roles include global + + #Mumble + include mumble } diff --git a/modules/mumble/.puppet-lint.rc b/modules/mumble/.puppet-lint.rc new file mode 100644 index 0000000..0a6b04e --- /dev/null +++ b/modules/mumble/.puppet-lint.rc @@ -0,0 +1 @@ +--no-class_inherits_from_params_class-check diff --git a/modules/mumble/README b/modules/mumble/README new file mode 100644 index 0000000..15bb0a3 --- /dev/null +++ b/modules/mumble/README @@ -0,0 +1,38 @@ +Deploying a fully functional mumble server using puppet. + +Supported debian & centos OS + +Depends on puppet-module iptables, available on puppetlabs forge or the inuits module on https://github.com/Inuits/puppet-module-library + +Mumble version 1.2.3 +http://mumble.sourceforge.net/Install_CentOS5 + +used files from; +http://sourceforge.net/projects/mumble/files/Mumble/1.2.3/murmur-static_x86-1.2.3.tar.bz2/download +ftp://rpmfind.net/linux/Mandriva/devel/cooker/x86_64/media/contrib/release/mumble-server-1.2.3-1-mdv2011.0.x86_64.rpm + +Example of Vagrantfile which deploys 2 boxes, one centos and one debian like + +Vagrant::Config.run do |config| + config.vm.define :centos do |centos_config| + centos_config.vm.box = "centos-6.2" + centos_config.vm.host_name = "mumble-centos" + centos_config.vm.forward_port 64738, 64738 + centos_config.vm.provision :puppet do |puppet| + puppet.manifests_path = "manifests" + puppet.manifest_file = "site.pp" + puppet.module_path = "modules" + end + end + config.vm.define :debian do |debian_config| + debian_config.vm.box = "debian-6" + debian_config.vm.host_name = "mumble-debian" + #debian_config.vm.network :bridged, {:bridge => "em1"} + debian_config.vm.forward_port 64738, 64738 + debian_config.vm.provision :puppet do |puppet| + puppet.manifests_path = "manifests" + puppet.manifest_file = "site.pp" + puppet.module_path = "modules" + end + end +end diff --git a/modules/mumble/manifests/config.pp b/modules/mumble/manifests/config.pp new file mode 100644 index 0000000..0baa94b --- /dev/null +++ b/modules/mumble/manifests/config.pp @@ -0,0 +1,11 @@ +# Class: mumble::config +# +# Class which configures the mumble service +class mumble::config { + file{'/etc/mumble-server.ini': + owner => 'root', + group => 'root', + replace => true, + content => template('mumble/mumble-server.erb'), + } +} diff --git a/modules/mumble/manifests/firewall.pp b/modules/mumble/manifests/firewall.pp new file mode 100644 index 0000000..5db4f4a --- /dev/null +++ b/modules/mumble/manifests/firewall.pp @@ -0,0 +1,16 @@ +# Class: mumble::firewall +# +# Class which configures the iptables firewall +class mumble::firewall { + Firewall{ + action => 'accept', + } + firewall{'020 mumble-server-tcp': + dport => $mumble::port, + proto => 'tcp', + } + firewall{'021 mumble-server-udp': + dport => $mumble::port, + proto => 'udp', + } +} diff --git a/modules/mumble/manifests/group.pp b/modules/mumble/manifests/group.pp new file mode 100644 index 0000000..c54d430 --- /dev/null +++ b/modules/mumble/manifests/group.pp @@ -0,0 +1,9 @@ +# Class: mumble::group +# +# Class which deploys the mumble group +class mumble::group { + group{'mumble-server': + ensure => 'present', + gid => '4000', + } +} diff --git a/modules/mumble/manifests/init.pp b/modules/mumble/manifests/init.pp new file mode 100644 index 0000000..f8a9acc --- /dev/null +++ b/modules/mumble/manifests/init.pp @@ -0,0 +1,25 @@ +# Class: mumble +# +# Initialization class for the mumble module +class mumble ( + $package_name = $mumble::params::package_name, + $password = $mumble::params::password, + $port = $mumble::params::port, + $bandwidth = $mumble::params::bandwith, + $ice = undef, + $dbus = undef, + $motd = $mumble::params::motd, +) inherits mumble::params { + + if $motd { + motd::register { 'mumble': } + } + + include ::mumble::install + include ::mumble::config + include ::mumble::service + + Class['::mumble::install'] -> + Class['::mumble::config'] -> + Class['::mumble::service'] +} diff --git a/modules/mumble/manifests/install.pp b/modules/mumble/manifests/install.pp new file mode 100644 index 0000000..699f926 --- /dev/null +++ b/modules/mumble/manifests/install.pp @@ -0,0 +1,14 @@ +# Class: mumble::install +# +# Class which installs the nececcary packages from the inuits repository +class mumble::install { + $_require = $::operatingsystem ? { + /(centos|redhat|fedora)/ => Yumrepo['inuits'], + default => undef, + } + package{$::mumble::package_name: + ensure => 'installed', + require => $_require, + }, + } +} diff --git a/modules/mumble/manifests/iptables.pp b/modules/mumble/manifests/iptables.pp new file mode 100644 index 0000000..57c41bb --- /dev/null +++ b/modules/mumble/manifests/iptables.pp @@ -0,0 +1,16 @@ +# Class: mumble::iptables +# +# This class will configure the firewall +class mumble::iptables { + if ! defined(Class['::iptables']) { + include ::iptables + } + iptables::rule{'mumble-server-tcp': + dport => $mumble::port, + proto => 'tcp', + } + iptables::rule{'mumble-server-udp': + dport => $mumble::port, + proto => 'udp', + } +} diff --git a/modules/mumble/manifests/params.pp b/modules/mumble/manifests/params.pp new file mode 100644 index 0000000..781bfc5 --- /dev/null +++ b/modules/mumble/manifests/params.pp @@ -0,0 +1,11 @@ +# Class mumble::params +# +# This class contains every parameter which will be used in this puppet module +# for setting up a mumble voip server +class mumble::params { + $package_name = 'mumble-server' + $password = '' + $port = '64738' + $bandwidth = '72000' + $motd = false +} diff --git a/modules/mumble/manifests/service.pp b/modules/mumble/manifests/service.pp new file mode 100644 index 0000000..ccdf201 --- /dev/null +++ b/modules/mumble/manifests/service.pp @@ -0,0 +1,11 @@ +# Class: mumble::service +# +# Class which ensures the mumble services is running +class mumble::service { + service{'mumble-server': + ensure => 'running', + hasstatus => true, + enable => true, + require => File['/etc/mumble-server.ini'], + } +} diff --git a/modules/mumble/manifests/user.pp b/modules/mumble/manifests/user.pp new file mode 100644 index 0000000..e8417e4 --- /dev/null +++ b/modules/mumble/manifests/user.pp @@ -0,0 +1,10 @@ +# Class: mumble::user +# +# Class which deploys the mumble-server user +class mumble::user { + user{'mumble-server': + ensure => 'present', + gid => '4000', + shell => '/sbin/nologin'; + } +} diff --git a/modules/mumble/templates/mumble-server.erb b/modules/mumble/templates/mumble-server.erb new file mode 100644 index 0000000..264ae8d --- /dev/null +++ b/modules/mumble/templates/mumble-server.erb @@ -0,0 +1,91 @@ +# To enable username registration through +# http://webserver/cgi-bin/mumble-server/register.cgi +# then this value must be set to a valid email +# and you must be running a SMTP server on this +# machine. +#emailfrom = + +# How many login attempts do we tolerate from one IP +# inside a given timeframe before we ban the connection? +# Note that this is global (shared between all virtual servers), and that +# it counts both successfull and unsuccessfull connection attempts. +# Set either Attempts or Timeframe to 0 to disable. +#autobanAttempts = 10 +#autobanTimeframe = 120 +#autobanTime = 300 + +# The below will be used as defaults for new configured servers. +# If you're just running one server (the default), it's easier to +# configure it here than through DBus/SQL. +# +# Welcome message sent to users +welcometext="
Welcome to this server running Murmur.
Enjoy your stay!
" + +# Port to bind TCP and UDP sockets to +port=<%= scope.lookupvar('mumble::port') %> + +# Specific IP or hostname to bind to. +# If this is left blank (default), murmur will bind to all available addresses. +#host= + +# Password to join server +serverpassword=<%= scope.lookupvar('mumble::password') %> + +# Maximum bandwidth (in bytes per second) clients are allowed +# send speech at. +bandwidth=<%= scope.lookupvar('mumble::bandwidth') %> + +# Maximum number of concurrent clients allowed. +users=100 + +# Murmur retains the per-server log entries in an internal database which +# allows it to be accessed over D-Bus. +# How many days should such entries be kept? +#logdays=31 + +# To enable public registration, the serverpassword must be blank, and this +# must all be filled out. +# The password here is used to create a registry for the server name; subsequent +# updates will need the same password. Don't loose your password. +# The URL is your own website, and only set the registerHostname for static IP +# addresses. +# +#registerName=Mumble Server +#registerPassword=secret +#registerUrl=http://mumble.sourceforge.net/ +#registerHostname= + +# If you have a proper SSL certificate, you can provide the filenames here. +#sslCert= +#sslKey= + +# Path to database. If blank, will search for +# murmur.sqlite in default locations. +database=/var/lib/mumble-server/mumble-server.sqlite + +# PIDfile to use +# Leave blank to place pidfile in current directory +pidfile=/var/run/mumble-server/mumble-server.pid + +# Murmur defaults to not using D-Bus. If you wish to use dbus, please +# specify so here. +<% if scope.lookupvar('mumble::dbus') == true -%> +dbus=system +<% else -%> +#dbus=system +<% end -%> + +# If you want to use ZeroC ICE to communicate with Murmur, you need +# to specify the endpoint to use. Since there is no authentication +# with ICE, you should only use it if you trust all the users who have +# shell access to your machine. +# Please see the ICE documentation on how to specify endpoints. +<% if scope.lookupvar('mumble::ice') == true -%> +ice="tcp -h 127.0.0.1 -p 6502" +<% else -%> +#ice="tcp -h 127.0.0.1 -p 6502" +<% end -%> + +# Murmur default to logging to murmur.log. If you leave this blank, +# murmur will log to the console (linux) or through message boxes (win32). +logfile=/var/log/mumble-server/mumble-server.log From 3ed59df0ebdc013b151f2234690c271488a0f7c4 Mon Sep 17 00:00:00 2001 From: Robert Wilson Date: Sun, 9 Feb 2014 21:52:35 +0000 Subject: [PATCH 2/3] Add Pandora rspec --- spec/hosts/pandora_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 spec/hosts/pandora_spec.rb diff --git a/spec/hosts/pandora_spec.rb b/spec/hosts/pandora_spec.rb new file mode 100644 index 0000000..3463f28 --- /dev/null +++ b/spec/hosts/pandora_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe 'pandora.geeksoc.org' do + let(:node) { 'pandora.geeksoc.org' } + let(:facts) { {:operatingsystem => 'Debian'} } + + it { should compile } + it { should contain_service('mumble-server') } +end \ No newline at end of file From 3bd8029016e9f4969c9ab5e443bb085fd37351a7 Mon Sep 17 00:00:00 2001 From: Robert Wilson Date: Sun, 9 Feb 2014 22:06:39 +0000 Subject: [PATCH 3/3] fix mumble module to compile --- modules/mumble/manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mumble/manifests/install.pp b/modules/mumble/manifests/install.pp index 699f926..6c893ae 100644 --- a/modules/mumble/manifests/install.pp +++ b/modules/mumble/manifests/install.pp @@ -9,6 +9,6 @@ package{$::mumble::package_name: ensure => 'installed', require => $_require, - }, + } }