diff --git a/puppet/manifests/init.pp b/puppet/manifests/init.pp index bb72892..aa4a120 100644 --- a/puppet/manifests/init.pp +++ b/puppet/manifests/init.pp @@ -354,3 +354,59 @@ class puppet::server inherits puppet::client { } } + + +# Install and configure opencollab-puppet-uploader. +# +# === Global variables +# +# $puppet_opencollab_url: +# Wiki URL. +# +# $puppet_opencollab_user: +# Wiki user. +# +# $puppet_opencollab_pass: +# Wiki password. +# +class puppet::opencollab { + + if !$puppet_opencollab_url { + fail("\$puppet_opencollab_url must be set.") + } + if !$puppet_opencollab_user { + fail("\$puppet_opencollab_user must be set.") + } + if !$puppet_opencollab_pass { + fail("\$puppet_opencollab_pass must be set.") + } + + include wiki::opencollab + + package { "PyYAML": + name => $operatingsystem ? { + debian => "python-yaml", + ubuntu => "python-yaml", + default => "PyYAML", + }, + ensure => installed, + before => Class["wiki::opencollab"], + } + + file { "/etc/puppet/opencollab.conf": + ensure => present, + mode => 0600, + owner => root, + group => root, + content => "[creds]\nurl = ${puppet_opencollab_url}\nusername = ${puppet_opencollab_user}\npassword = ${puppet_opencollab_pass}\n", + } + + cron { "opencollab-puppet-uploader": + ensure => present, + command => "/usr/bin/opencollab-puppet-uploader -c /etc/puppet/opencollab.conf /var/lib/puppet/yaml/facts/*.yaml", + user => root, + minute => 0, + require => [ Class["wiki::opencollab"], File["/etc/puppet/opencollab.conf"] ], + } + +}