Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improvemnts: There is now the option to specify a base directory for …

…all installation of glaspot.

Defualt is "/opt".

Notes:
I had to do some not so pretty things to get the base dir thing to work. Puppet complains when your paths are not
absolute. This makes sense. The trouble comes when you pass the base dir to the modules. Instead of a true "base" you
have to pass something without '/'. I.e. I'm passing `basedir => 'opt'` instead of `basedir => '/opt'`. IMO, the second
one makes more sense.

I need to add a few more comments, but I want to get this commit into RC before I go around
breaking stuff.
  • Loading branch information...
commit e90330591f6e46fa64814446bf052998f5b8d21f 1 parent 5d0e6fc
Jacques Uber authored
28 glaspot/manifests/evnet.pp
View
@@ -1,31 +1,35 @@
#
# Let's get this working before we make it pretty.
#
+# Parameters
+# basedir = where to keep the evnet library files.
-class glaspot::evnet {
+class glaspot::evnet ( $basedir = "opt" ){
- package { 'python-openssl':
+ package { "python-openssl":
ensure => present,
- before => Exec['evnet install'],
+ before => Exec["evnet install"],
}
- file { '/home/glaspot/evnet/':
+ file { "/${basedir}/evnet/":
ensure => directory,
mode => 0640,
owner => glaspot,
- require => User['glaspot'],
+ require => User["glaspot"],
}
git::clone { "evnet":
source => "https://github.com/rep/evnet.git",
- localtree => "/home/glaspot/",
- require => User['glaspot'],
+ localtree => "/${basedir}",
+ require => User["glaspot"],
}
+
+ Exec { path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" }
- exec { 'evnet install':
- cwd => "/home/glaspot/evnet/",
- unless => "/usr/bin/python -c 'import evnet'",
- command => "/usr/bin/python setup.py build && python setup.py install",
- require => Git::Clone['evnet'],
+ exec { "evnet install":
+ cwd => "/${basedir}/evnet/",
+ unless => "python -c 'import evnet'",
+ command => "python setup.py build && python setup.py install",
+ require => Git::Clone["evnet"],
}
}
39 glaspot/manifests/glaspot.pp
View
@@ -0,0 +1,39 @@
+# Params
+# basedir = place where glaspot will be installed.
+
+class glaspot::install ( $basedir = "opt" ){
+
+ package { "subversion":
+ ensure => installed,
+ }
+
+ package { "python-dev":
+ ensure => installed,
+ }
+ package { "python-chardet":
+ ensure => installed,
+ }
+
+ user { "glaspot":
+ ensure => present,
+ home => "/bin/false",
+ managehome => false,
+ }
+
+ file { "/${basedir}/glaspot/":
+ ensure => directory,
+ mode => 0640,
+ owner => glaspot,
+ require => User["glaspot"],
+ }
+
+ subversion::checkout { "glaspot":
+ repopath => "/glaspot",
+ workingdir => "/${basedir}/glaspot/",
+ host => "glastopf.org",
+ method => "svn",
+ svnuser => "glaspot",
+ port => "9090",
+ require => File["/${basedir}/glaspot/"],
+ }
+}
49 glaspot/manifests/init.pp
View
@@ -1,40 +1,11 @@
-class glaspot{
- php_apd::install { "apd": }
- class {"glaspot::evnet": }
-
- package { 'subversion':
- ensure => installed,
- }
-
- package { 'python-dev':
- ensure => installed,
- }
- package { 'python-chardet':
- ensure => installed,
- }
-
- user { 'glaspot':
- ensure => present,
- home => '/home/glaspot/',
- managehome => true,
- }
-
- file { '/home/glaspot/glaspot/':
- ensure => directory,
- mode => 0640,
- owner => glaspot,
- require => User['glaspot'],
- }
-
-
- subversion::checkout { "glaspot":
- repopath => "/glaspot",
- workingdir => "/home/glaspot/glaspot/",
- host => "glastopf.org",
- method => "svn",
- svnuser => "glaspot",
- port => "9090",
- require => File['/home/glaspot/glaspot/'],
- }
-
+# Params
+# basedir = place where glaspot will be installed.
+#
+# By defualt everything will be installed into "opt". I've been doubly verbose about it.
+# If you want to though, you can pass a different dir like "/tmp" or something.
+
+class glaspot {
+ class { "php_apd::install": }
+ class { "glaspot::evnet": }
+ class { "glaspot::install": }
}
39 glaspot/manifests/install.pp
View
@@ -0,0 +1,39 @@
+# Params
+# basedir = place where glaspot will be installed.
+
+class glaspot::install ( $basedir = "/opt" ){
+
+ package { "subversion":
+ ensure => installed,
+ }
+
+ package { "python-dev":
+ ensure => installed,
+ }
+ package { "python-chardet":
+ ensure => installed,
+ }
+
+ user { "glaspot":
+ ensure => present,
+ home => "/bin/false",
+ managehome => false,
+ }
+
+ file { "${basedir}/glaspot/":
+ ensure => directory,
+ mode => 0640,
+ owner => glaspot,
+ require => User["glaspot"],
+ }
+
+ subversion::checkout { "glaspot":
+ repopath => "/glaspot",
+ workingdir => "${basedir}/glaspot/",
+ host => "glastopf.org",
+ method => "svn",
+ svnuser => "glaspot",
+ port => "9090",
+ require => File["${basedir}/glaspot/"],
+ }
+}
33 php_apd/manifests/apd_install.pp
View
@@ -0,0 +1,33 @@
+# I'm pretty much modeling what this guy did: http://lzone.de/node/4
+
+class php_apd::install ( $php_ini = "/etc/php5/cli/php.ini", $trace_dir "/tmp/apd_traces" ) {
+
+ Exec { path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" }
+
+ package {'php5':
+ ensure => present,
+ before => [Package['apd'],Exec['zend_extensions'],Exec['apd enable'],Exec['tracedir']],
+ }
+
+ package {'apd':
+ ensure => present,
+ provider => dpkg,
+#source => "puppet://puppet/php_apd/files/apd_1.0.1_i386.deb",
+ source => "/etc/puppet/modules/php_apd/files/apd_1.0.1_i386.deb",
+ }
+#zend_extension=/usr/lib/php5/20090626+lfs/apd.so
+#apd.statement=1
+#apd.tracedir=/tmp/apd-traces
+ exec { 'zend_extensions':
+ unless => "grep zend_extension=/usr/lib/php5/20090626+lfs/apd.so ${php_ini}",
+ command => "echo 'zend_extension=/usr/lib/php5/20090626+lfs/apd.so' >> ${php_ini}",
+ }
+ exec { 'apd enable':
+ unless => "grep apd.statement=1 ${php_ini}",
+ command => "echo 'apd.statement=1' >> ${php_ini}",
+ }
+ exec { 'tracedir':
+ unless => "grep apd.tracedir=${trace_dir} ${php_ini}",
+ command => "echo 'apd.tracedir=${trace_dir}' >> ${php_ini}",
+ }
+}
37 php_apd/manifests/init.pp
View
@@ -1,37 +0,0 @@
-# I'm pretty much modeling what this guy did: http://lzone.de/node/4
-
-class php_apd {
- define install (
- $php_ini = "/etc/php5/cli/php.ini",
- $trace_dir = "/tmp/apd_traces" )
- {
- Exec { path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" }
-
- package {'php5':
- ensure => present,
- before => [Package['apd'],Exec['zend_extensions'],Exec['apd enable'],Exec['tracedir']],
- }
-
- package {'apd':
- ensure => present,
- provider => dpkg,
- #source => "puppet://puppet/php_apd/files/apd_1.0.1_i386.deb",
- source => "/etc/puppet/modules/php_apd/files/apd_1.0.1_i386.deb",
- }
- #zend_extension=/usr/lib/php5/20090626+lfs/apd.so
- #apd.statement=1
- #apd.tracedir=/tmp/apd-traces
- exec { 'zend_extensions':
- unless => "grep zend_extension=/usr/lib/php5/20090626+lfs/apd.so ${php_ini}",
- command => "echo 'zend_extension=/usr/lib/php5/20090626+lfs/apd.so' >> ${php_ini}",
- }
- exec { 'apd enable':
- unless => "grep apd.statement=1 ${php_ini}",
- command => "echo 'apd.statement=1' >> ${php_ini}",
- }
- exec { 'tracedir':
- unless => "grep apd.tracedir=${trace_dir} ${php_ini}",
- command => "echo 'apd.tracedir=${trace_dir}' >> ${php_ini}",
- }
- }
-}
33 php_apd/manifests/install.pp
View
@@ -0,0 +1,33 @@
+# I'm pretty much modeling what this guy did: http://lzone.de/node/4
+
+class php_apd::install ( $php_ini = "/etc/php5/cli/php.ini", $trace_dir = "/tmp/apd_traces" ) {
+
+ Exec { path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" }
+
+ package {'php5':
+ ensure => present,
+ before => [Package['apd'],Exec['zend_extensions'],Exec['apd enable'],Exec['tracedir']],
+ }
+
+ package {'apd':
+ ensure => present,
+ provider => dpkg,
+#source => "puppet://puppet/php_apd/files/apd_1.0.1_i386.deb",
+ source => "/etc/puppet/modules/php_apd/files/apd_1.0.1_i386.deb",
+ }
+#zend_extension=/usr/lib/php5/20090626+lfs/apd.so
+#apd.statement=1
+#apd.tracedir=/tmp/apd-traces
+ exec { 'zend_extensions':
+ unless => "grep zend_extension=/usr/lib/php5/20090626+lfs/apd.so ${php_ini}",
+ command => "echo 'zend_extension=/usr/lib/php5/20090626+lfs/apd.so' >> ${php_ini}",
+ }
+ exec { 'apd enable':
+ unless => "grep apd.statement=1 ${php_ini}",
+ command => "echo 'apd.statement=1' >> ${php_ini}",
+ }
+ exec { 'tracedir':
+ unless => "grep apd.tracedir=${trace_dir} ${php_ini}",
+ command => "echo 'apd.tracedir=${trace_dir}' >> ${php_ini}",
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.