package { "gcc": ensure => installed }
Causing a duplicate resource definition. To get around this, move the
gcc package install into a module of it's own, called say "gcc", then in
your database and application modules simply "include gcc" to pull in
your new gcc module as a requirement. You will also need to look at
requirements (http://docs.puppetlabs.com/learning/ordering.html).
If you prefer to declare your classes like this:
class { "gcc": }
Then you have to think about how to organise your node definitions a
little bit differently as you'll run into the same Duplicate Definition
error.
--
Luke Bigum
Information Systems
+44 (0) 20 3192 2520
Luke....@lmax.com | http://www.lmax.com
LMAX, Yellow Building, 1A Nicholas Road, London W11 4AN
The information in this e-mail and any attachment is confidential and is intended only for the named recipient(s). The e-mail may not be disclosed or used by any person other than the addressee, nor may it be copied in any way. If you are not a named recipient please notify the sender immediately and delete any copies of this message. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any view or opinions presented are solely those of the author and do not necessarily represent those of the company.
class foo {
if ! defined( Package[gcc] ) {
package { gcc: ensure=>installed; }
}
}
class bar {
if ! defined( Package[gcc] ) {
package { gcc: ensure=>installed; }
}
}
Or, define a new class for the package(s) and include that
class pkg::gcc {
package { gcc: ensure=>installed; }
}
class foo {
include pkg::gcc
}
class bar {
include pkg::gcc
}
Second method is more elegant IMHO; but if its a one-off then first might be simpler.
Steve
Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
s.sh...@auckland.ac.nz
Ph: +64 9 373 7599 ext 86487
On 01/17/2012 04:11 PM, jcbollinger wrote:
> The first is simpler only if you get lucky, and you don't intend to
> modify your manifests ever again.
basically correct, but you can even play it safe: You must make sure
each and every invocation of the resource in question is protected by
such an if defined(), ever.
Yes, it's terrible design.
Is there a good reason that this function is even retained in recent
versions of puppet? I have yet to encounter an instance where it can be
used cleanly.
Cheers,
Felix
Is there a good reason that this function is even retained in recent
versions of puppet? I have yet to encounter an instance where it can be
used cleanly.
class oracle::packages {require oracle::paramsfile { "install_oracle_dependency.sh":mode => 750, owner => root, group => root,content => $operatingsystem ? {centos => template("oracle/install_oracle_dependency.sh-redhat"),redhat => template("oracle/install_oracle_dependency.sh-redhat"),debian => template("oracle/install_oracle_dependency.sh-debian"),ubuntu => template("oracle/install_oracle_dependency.sh-debian"),suse => template("oracle/install_oracle_dependency.sh-suse"),},path => "${oracle::params::workdir}/install_oracle_dependency.sh",}exec { "install_oracle_dependency.sh":subscribe => File["install_oracle_dependency.sh"],refreshonly => true,timeout => 3600,command => "${oracle::params::workdir}/install_oracle_dependency.sh",}}where the template install_oracle_dependency.sh-redhat is something like
#!/bin/sh# File Managed by Puppet# Installs the packages required for installing Oracle applications<% if $architecture=="i386" %>yum install -y binutils compat-db compat-libstdc++ compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel pdksh sysstat unixODBC unixODBC-develyum groupinstall -y "X Window System"<% else %>yum install -y binutils compat-db compat-libstdc++ compat-libstdc++.i386 compat-libstdc++-33 compat-libstdc++-33.i386 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc.i386 glibc-common glibc-devel glibc-devel.i386 glibc-headers kernel-headers ksh libaio libaio.i386 libaio-devel libaio-devel.i386 libgcc libgcc.i386 libgomp libstdc++ libstdc++.i386 libstdc++-devel make numactl-devel pdksh sysstat unixODBC unixODBC.i386 unixODBC-devel.i386yum groupinstall -y "X Window System"<% end %>Opinions on this approach?al
--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/dOCIZ8-Gfgw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/533584AC.7000503%40alumni.tu-berlin.de.
For more options, visit https://groups.google.com/d/optout.
For this kind of stuff i created a package module that only ships packages potentially shared (python lib, curl, etc...).
I virtually déclare un thé module ans realie un the main modules
--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/df5d4469-4bd5-4f48-b7d4-a221aadc0edd%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAJgpziV%2BNwR2Jht%2BtkY8zibsctombqQ7HVqhv13-K9QudK822g%40mail.gmail.com.
Whoo, the triumphant return of a thread from over two years ago ^^
Still, this has come up on the development list again, too, recently.
There has not yet been significat progress and we are still stuck with
the workarounds from the olden days. You can try with the
ensure_resource() function (in stdlib?).
My gut says that there won't be a superior alternative very soon, seeing
as there is not even an armature yet (that I know of, but I don't
monitor those).
Still, this is a known issue that is on people's minds, and I'm
confident that it will be tackled once the current development cycle has
settled.
I am surprised there is no viable solution to this seemingly basic problem... I maintain a comprehensive set of Puppet modules for our internal software and while it hasn't been an issue yet, having two modules attempt to install the same package (ie. openssh-clients on RHEL) is certainly not out of the question. For my own maintained modules, this isn't a problem, but if I incorporate a third-party module that does the same, there's no guarantee that one of us won't have to change.
I have started using ensure_resource() but notice that with a Package resource that "ensure => installed" and "ensure => present" are treated as two distinct instantiations of the Package resource, even if they're treated as equivalent in Puppet.
At risk of bumping a now truly ancient thread (which I found because I have a 3rd party module and one of my own which both want to control a specific package), I don't see why puppet should complain when two identical (or at least non-contradictory) invocations of the same resource are found.
--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/7a6df4fc-3d34-442b-83d2-7f3c38015973%40googlegroups.com.
At risk of bumping a now truly ancient thread (which I found because I have a 3rd party module and one of my own which both want to control a specific package), I don't see why puppet should complain when two identical (or at least non-contradictory) invocations of the same resource are found.