On Aug 19, 4:04 am, Dennis Hoppe <dennis.ho...@debian-solutions.de>
wrote:> Hello,
>
> i have written some modules for Puppet and would be thankful, if someone
> could take a look for quality enhancements.
>
> http://194.94.79.17/hotkey/puppet.tar.gz
>
> The only nasty part is, that i have defined some global variables at the
> site.pp, which i am using at several templates.
>
> And i am looking for a solution to collect the hostnames and ipaddresses
> of all connected nodes, without using a stored config like an database
> or ldap. I need this values for some templates. For example the config
> of dsh (distributed shell), rsnapshot or the "/etc/hosts"
including all
> hosts.
>
> Regards, Dennis
>
> signature.asc
> < 1KViewDownload
There is not anything inherently wrong with defining global variables
in your site.pp[1]. You just want to be sure to comment those in your
modules so you know where variables are being set. To save on typing,
I would define some default values in your site.pp such as:
# Default file parameters
File {
ignore => ".svn",
owner => "root",
group => "root",
mode => "644",
} # File
# default exec parameters
Exec {
path => ["/bin", "/sbin", "/usr/bin",
"/usr/sbin"],
} # Exec
# by default when we talk about a package we want to install it.
Package {
ensure => installed,
} # Package
Separating your modules by release is definitely not going to scale.
When you create your modules, think about their purposes and separate
them by application, not release. For an example, see my rsync[2] and
apache[3] modules. Those use subclasses that are application specific.
With that in mind, here is how I would restructure your rsyslog
module. For DMZ systems, you might ''include rsyslog::dmz'' in
your
nodes definition or possibly in a dmz class where you set other DMZ
specific items. You will notice that the file entries have been
condensed and the last parameter for each ends in a semicolon[4]. Both
rsyslog and rsyslog::dmz use the same template file. You could specify
DMZ specific variables in the rsyslog::dmz class to be populated in
the template.
# Class: rsyslog
#
# Configures rsyslog
#
class rsyslog {
file {
"/etc/rsyslog.conf":
owner => root,
group => root,
mode => 644,
alias => "rsyslog.conf",
content => template("rsyslog/rsyslog.erb"),
notify => Service["rsyslog"],
require => Package["rsyslog-relp"];
"/var/spool/rsyslog":
ensure => directory,
owner => root,
group => root,
mode => 755;
} # file
package { "rsyslog-relp":
ensure => present,
} # package
service { "rsyslog":
enable => true,
ensure => running,
require => [ File["rsyslog.conf"],
Package["rsyslog-relp"] ],
} # service
} # class rsyslog
# Class: rsyslog::dmz
#
# Configures rsyslog specific to the DMZ environment
#
class rsyslog::dmz inherits rsyslog {
file {
"/etc/logrotate.d/rsyslog":
owner => root,
group => root,
mode => 644,
source =>
"puppet:///modules/rsyslog/rsyslog-logrotate",
require => [ File["rsyslog.conf"],
Package["rsyslog-
relp"] ];
"/var/log/rsyslog":
ensure => directory,
owner => root,
group => root,
mode => 755;
} # file
} # class rsyslog::dmz
At the bottom of your manifests you have vim info. I recommend you get
puppet syntax highlighting for vim[5]. Some of your modules can
already be found at the Puppet Forge[6]. I recommend starting there
and looking through some other peoples'' code for modules that you have
started.
Hope this helps,
-g
[1] - http://github.com/ghoneycutt/puppet-sitemanifest
[2] - http://forge.puppetlabs.com/ghoneycutt/rsync
[3] - http://forge.puppetlabs.com/ghoneycutt/apache
[4] - http://docs.reductivelabs.com/guides/language_tutorial.html#classes
[5] - http://www.vim.org/scripts/script.php?script_id=2094
[6] - http://forge.puppetlabs.com/
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.