Ok so I downloaded the Zabbix Puppet Module, Now What? :)

So for the most part I have been able to translate the puppet forge
documentation on various modules to something I can use in my foreman
setup, and in general I have been able to write my own modules when
necessary.

Now of course with Foreman I can assign a particular class to a node in
that interface, as opposed to creating a node entry as you would with a
more basic puppet install.

For example I used the puppet forge apache module pretty easily by
assigning the apache module to a node. I then put the following in my own
class and assigned that class to the node as well.

apache::vhost { 'monitor.t2.ucsd.edu':
port => '443',
docroot => '/var/www/html',
ssl => true,
ssl_cert => '/etc/grid-security/httpcert.pem',
ssl_key => '/etc/grid-security/httpkey.pem',
ssl_crl_path => '/etc/grid-security/certificates',
}

and Voila, I got an apache ssl virtual host with the certs I wanted and a
CRL path.

However sometimes the documentation has me scratching my head a bit. For
example I want to give the zabbix module a try, but then I get to examples
like the following I am a bit stuck.

node 'zabbix.example.com'
class { 'apache':
mpm_module => 'prefork',
}
include apache::mod::php

class { 'postgresql::server': }
#class { 'mysql::server': }

class { 'zabbix':
zabbix_url => 'zabbix.example.com',
#database_type => 'mysql',
}
}

The problem is if you include a class on a host in foreman you get errors
about duplicate class definitions etc…

I do not suppose someone could help me translate the above to something I
can put into a foreman type puppet config? Basically how would I go about
best using this module with foreman? Or point me at some documentation or
examples of how to translate it?

Maybe if I start with something that is simpler?

class { 'zabbix::agent':
server => '192.168.20.11',
}

Sorry if this is a pretty basic question.

Thanks,

Terrence

So I guess I did not understand something about Hiera, namely that I can
define parameters there instead of ENC via Foreman. I will give that a try.
Basically I would rather use hiera text files than the web interface for a
variety of reasons to set parameters.

··· On Thursday, April 2, 2015 at 7:07:11 PM UTC-7, Terrence Martin wrote: > > So for the most part I have been able to translate the puppet forge > documentation on various modules to something I can use in my foreman > setup, and in general I have been able to write my own modules when > necessary. > > Now of course with Foreman I can assign a particular class to a node in > that interface, as opposed to creating a node entry as you would with a > more basic puppet install. > > For example I used the puppet forge apache module pretty easily by > assigning the apache module to a node. I then put the following in my own > class and assigned that class to the node as well. > > apache::vhost { 'monitor.t2.ucsd.edu': > port => '443', > docroot => '/var/www/html', > ssl => true, > ssl_cert => '/etc/grid-security/httpcert.pem', > ssl_key => '/etc/grid-security/httpkey.pem', > ssl_crl_path => '/etc/grid-security/certificates', > } > > and Voila, I got an apache ssl virtual host with the certs I wanted and a > CRL path. > > However sometimes the documentation has me scratching my head a bit. For > example I want to give the zabbix module a try, but then I get to examples > like the following I am a bit stuck. > > node 'zabbix.example.com' > class { 'apache': > mpm_module => 'prefork', > } > include apache::mod::php > > class { 'postgresql::server': } > #class { 'mysql::server': } > > class { 'zabbix': > zabbix_url => 'zabbix.example.com', > #database_type => 'mysql', > } > } > > The problem is if you include a class on a host in foreman you get errors > about duplicate class definitions etc... > > I do not suppose someone could help me translate the above to something I > can put into a foreman type puppet config? Basically how would I go about > best using this module with foreman? Or point me at some documentation or > examples of how to translate it? > > Maybe if I start with something that is simpler? > > class { 'zabbix::agent': > server => '192.168.20.11', > } > > Sorry if this is a pretty basic question. > > Thanks, > > Terrence > >

Ok I think I figured it out :slight_smile: Mostly by finding a couple of threads on
using data in regards to the apache module, but I should be able to
generalize this.

$monitorvhosts = hiera('apache::vhosts', {})
create_resources('apache::vhost', $monitorvhosts)

··· --- apache::vhosts: monitor.t2.ucsd.edu: port: 443 docroot: "/var/www/html/monitor" ssl: true ssl_cert: "/etc/grid-security/httpcert.pem" ssl_key: "/etc/grid-security/httpkey.pem" ssl_crl_path: "/etc/grid-security/certificates"