----
if you have packages that are pre-requisites for more than one other package, create a separate class and include the class where desired. Done.
----
Ok, I'm just making sure that I understand what you're saying. Are you saying that the proper way to handle packages in puppet is to manage the packages required by my classes with the built in package resource type and whenever puppet pitches errors because of a package collision, to add a class that wraps that package resource definition and then change the manifests to include the class instead of defining the package directly? I guess I must not understand what you mean, because that doesn't sound particularly desirable to me.
----
Hiera will be part and parcel of puppet 3 so you would be better off designing to live with it rather than try to force life without it long term.
Ok, this is good to know. I guess I'll read up more on it. Thanks.
I'm sort of suspicious that you are trying to use Singleton as a means to avoid a full implementation of puppet. It seems that trying to shortcut understanding of puppet leads to frustration.
I'm not sure what I said that led you to believe this is what I'm doing. I'm asking for advice as to what the "correct" way to handle this in puppet is. I laid out all the ways I've come up with to (try to) deal with my problem. What I don't know is why this isn't easier. It makes me feel like I'm doing it all wrong. And I'm not sure what you mean by "full implementation". You mean, without hiera? Or is there something else fundamentally wrong with what I'm doing?
Honestly, we've barely started with our implementation of puppet. In our test environment, we have working classes for a few services and have a loose framework in place that handles some of the thornier issues of our environment. We've read a lot of docs, added parser functions, added custom facter facts, added custom augeas lenses, etc. I've found simple, fairly elegant ways to deal with almost everything I've tried to do in puppet. I'm just feeling that maybe I'm missing the big picture or maybe, at least, A big picture.
I'm not trying to work around anything. I'm just trying to figure out the best way to use puppet to manage my hosts in a way that is easy to understand, audit and maintain. I'm sorry that wasn't clear from my original post. I guess I feel that I'm starting to understand some of the knobs in puppet, but I maybe don't understand the plan. That's why I came here. I hoped someone here had a better understanding of the big picture (or a simple solution to my current problem).
thanks for your help,
Michael
What happens when you have two or more statements about the same
resource in conflict?
package { 'mysql': ensure => installed, }
package { 'mysql': ensure => 5.0.92, }
package { 'mysql': ensure => latest, }
Therefore you need to specify it once. You can do this a few different
ways.
In regard to: [Puppet Users] package handling in puppet?, lamour said (at...:
> so, I've got most of the pieces worked out, but I've hit a major roadblock
> with the way packages are handled in puppet. (according to my limited
> understanding of puppet, that is) The problem starts with the fact that
> including the following in two different classes:
>
> package { 'perl': ensure => installed }
There are several ways to deal with this.
I know perl is probably a general example of the problem, but at least
in that case, it's fairly rare that you need to specify the interpreter
directly. If you're making good use of packages, what you probably
instead want is something like
package { 'perl-Net-SMTP-SSL':
ensure => installed,
require => Yumrepo['your-local-repo-name-or-maybe-epel'],
}
> This is pretty unfortunate, but we can try to work around it by doing this:
>
> package { 'test-perl': ensure => installed, alias => 'perl' }
*Definitely* do not do this. There might be other places where this
kind of chicanery is appropriate, but it's not a good idea here.
> Another, less gross, way to do it is to do something like this:
>
> if !defined(Package['perl']) {
> package { 'perl':
> ensure => installed,
> }
> }
I would instead do something more like
file { 'your-unpackaged-perl-script-here.pl':
ensure => file,
owner => 'whomever',
group => 'ditto',
mode => '0whatever-whatever-whatever',
require => Package['perl'],
source => 'puppet:///module_name/script-source-here.pl',
}
> We also stumbled across the Singleton puppet module, which does almost kind
> of exactly what we want, except it has a dependency on hiera. We haven't
> really decided whether to use hiera or not. Efforts to rip the hiera
> dependencies out of Singleton and also getting it to run even with hiera
> installed have both failed. I'll probably keep looking into modifying the
> ruby code to behave in some useful manner for us, but for now, I'm running
> out of good options.
Don't rip out hiera, it will be part of puppet 3.x. I'm not familiar with
the Singleton module, but I wouldn't think you would need to resort to
external modules for something that's pretty fundamental to the problem
domain.
On 8/22/2012 9:55 AM, lamour wrote:
> So, my basic issue with both the class method and the virtual resources
> method is that they basically require me to maintain a SECOND list of
> every package I want to maintain this way (either class or virtual
> resource definitions). This seems like a lot of syntactic and
> logistical overhead, especially when you consider that if we ignore the
> possibility of collisions, we can just do this:
>
> package { ['perl', 'mysql', 'gcc', 'screen', 'foo', 'bar', 'baz']:
> ensure => installed
> }
>
> This is clean, concise, and trivial to understand. This is kind of what
> I was hoping for. I understand that we'll probably have to use the
> class method for any packages where ACTUAL conflicts exist (e.g., the
> version example you gave above), but for virtually all of our packages,
> we're not going to have that problem
I'd argue that you're trying to bring your procedural shell scripting
world into Puppet. :-)
My Mysql module and templates are 200 lines which install and configure
mysql-server, supports three distros, sets various variables based on
local facts, and uses Hiera to manage other settings based on the role
of the server. Installing the package is actually the simplest thing it
does.
So your example in my world ends up looking like the following code. On
the surface it's more complicated, but in application to a node it's
actually simpler in my opinion because I have easy entry points to the
complexity I've delegated to the modules. This allows me to drop
discrete packages of capabilities on to servers without having to
revisit the internal logic every time. include mysql does this for me,
package { 'mysql': ensure => present,} does not.
node 'some.node.my.domain.com inherits basenode {
include mysql
include general_devel
realize Package['mysql-client']
}
node basenode {
include sudo
include vpackage
# realize all packages with this tag
Package<| tag = 'utils' |>
}
class vpackage {
# packages with tag => util get realized on all systems
@package { 'curl': tag => 'utils',}
@package { 'htop': tag => 'utils',}
@package { 'lynx': tag => 'utils',}
@package { 'screen': tag => 'utils',}
@package { 'strace': tag => 'utils',}
@package { 'tcpdump': tag => 'utils',}
@package { 'wget': tag => 'utils',}
@package { 'whois': tag => 'utils', name =>
$vpackages::params::whois, }
@package { 'mysql-client': name => $vpackages::params::mysqlclient, }
}