what is the best way to handle package conflicts between classes?
for example, below, i have the following two classes defined and both
include a "package { "perl-LDAP" }", so when used separately
they work
as expected but when i need to assign both classes to a node i get a
conflict.
error: "Duplicate definition: Package[perl-LDAP] is already defined"
thanks for any help
Ben
===============================================
class cups-server {
package { [ cups, "cups-lpd", hpijs, foomatic, ghostscript,
"perl-LDAP" ]:
ensure => installed
}
# ---- from disabled repos (custom-testing-puppet, dag-puppet),
waiting for ability to pass args to package handler.
# package { [ pdftk ]:
# ensure => installed,
# args => "--enablerepo=dag-puppet"
# }
service { cups:
ensure => running,
enable => true
}
rfile { "/etc/cups/cupsd.conf":
type => "cups-server",
group => lp,
mode => 640,
notify => Service["cups"];
"/usr/share/cups/model":
type => "cups-server",
notify => Service["cups"];
"/usr/lib/cups/backend":
type => "cups-server",
mode => 755,
notify => Service["cups"];
}
file { "/opt/cups.tmp":
ensure => directory;
# ---- disable the SNMP backend
"/usr/lib/cups/backend/snmp":
mode => 000
}
}
class ldap-server {
package { [ "xorg-x11-deprecated-libs",
"java-1.5.0-sun",
"fedora-ds",
"fonts-xorg-base",
"perl-LDAP",
"openldap-clients",
"perl-MIME-Lite",
"perl-IO-Socket-SSL"
]:
ensure => installed,
require => [ Mkyumrepo["fedora-ds"],
Mkyumrepo["custom"], Mkyumrepo["base"] ]
}
mkyumrepo { "fedora-ds":
descr => "Fedora Directory Server repo",
repopath =>
"/$operatingsystem/fedora-ds/\$releasever/\$basearch/",
gpgcheck => 0,
enabled => 1
}
append_if_no_such_line
{ "sysctl-keepalive":
file => "/etc/sysctl.conf",
line => "net.ipv4.tcp_keepalive_time = 300";
"sysctl-port-range":
file => "/etc/sysctl.conf",
line => "net.ipv4.ip_local_port_range = 1024
65000";
"sysctl-file-max":
file => "/etc/sysctl.conf",
line => "fs.file-max = 130000";
}
rfile
{ "/etc/rc.d/init.d/FedoraDirectoryServer":
type => "ldap-server",
mode => 750;
"/etc/rc.d/init.d/fedora-ds-admin":
type => "ldap-server",
mode => 750;
"/etc/security/limits.conf":
type => "ldap-server"
}
service { "FedoraDirectoryServer":
enable => true,
require =>
Rfile["/etc/rc.d/init.d/FedoraDirectoryServer"];
"fedora-ds-admin":
enable => true,
require =>
Rfile["/etc/rc.d/init.d/fedora-ds-admin"];
}
file {"/opt/ldap-server/fedora-ds/install.inf":
ensure => file,
content =>
template("ldap-server/opt/ldap-server/fedora-ds/install.inf.erb"),
mode => 640
}
exec { "setup/setup -s -f
/opt/ldap-server/fedora-ds/install.inf":
cwd => "/opt/fedora-ds/",
creates => "/opt/fedora-ds/slapd-ldap",
path => [ "/usr/local/sbin",
"/usr/local/bin",
"/sbin", "/bin", "/usr/sbin",
"/usr/bin" ],
require => [ Package["fedora-ds"] ]
}
}
# works
node ''example-cups'' { include cups-server }
node ''example-ldap'' { include ldap-server }
# doesn''t work
node ''example-both'' {
include cups-server
include ldap-server
}