Hi,
I'm new to puppet and read docs as much as possible, so forgive some
confusion in my code.
ubuntu-common.yaml:
---
packages:
- bc
- bsd-mailx
- fail2ban
- logrotate
- open-vm-tools
- openssh-server
- rsyslog
- rsync
- sudo
- snmpd
apacheModules:
- auth_kerb
- authnz_ldap
- status
classes:
- ubuntu-common-files
nodes/xyz.yaml:
packages:
- postfix
- wget
apacheModules:
- mpm_prefork
- php
- ssl
apache24::modules.pp:
define modules ($module = $title) {
class { "apache::mod::$module": }
}
install-packages::packages.pp:
define install-packages ($package = $title) {
if $package != undef {
package { $package:
ensure => installed
}
# I have some classes named as packages that copy files e.g.
if defined ("$package") {
class { "$package": }
}
}
}
nodes.pp:
case $operatingsystem {
/^(Debian|Ubuntu)$/: {
$ubuntuDefaultPackages = hiera_array ('packages', '',
'ubuntu-common')
$ubuntuExtraPackages = hiera_array ('packages', '', "nodes/$fqdn")
$ubuntuPackages = [ $ubuntuDefaultPackages, $ubuntuExtraPackages ]
$ubuntuDefaultApacheModules = hiera_array ('apacheModules', '',
'ubuntu-common')
$ubuntuExtraApacheModules = hiera_array ('apacheModules', '',
"nodes/$fqdn")
$ubuntuApacheModules = [ $ubuntuDefaultApacheModules,
$ubuntuExtraApacheModules ]
hiera_include ('classes', '', 'ubuntu-common')
}
default: {
}
}
hiera_include ('classes', '', "nodes/$fqdn")
[...]
install-packages { [ $ubuntuDefaultPackages, $packages ]: } <= works
apache24::modules { $ubuntuApacheModules: } <= fails
The error is:
Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: Duplicate declaration: Apache24::Modules[mpm_prefork] is
already declared in file
/etc/puppet/environments/production/manifests/nodes.pp:54; cannot
redeclare at /etc/puppet/environments/production/manifests/nodes.pp:54
on node xyz
Apache24::Modules[mpm_prefork] varies. I'm using the apache class from
puppetlabs. Apache24::Modules is called only from nodes.pp, there are
no duplicates.
My question is: Is the approach itself correct? I want to pass
$packages and $apachemodules to a class that does the install.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/xn0k6v1rjogku21000%40news.gmane.org.
For more options, visit https://groups.google.com/d/optout.