Re: [Puppet Users] Installing Jenkins with Puppet fails to import GPG key

2012-04-26 Thread denmat
Well, the good news is you're not crazy :)

I loaded up a 5.7 instance and puppet 2.7.9+ and got the same result as you!

I did a yum update and got the same issue - so it is not a common
issue that is already fixed.

I did a manual rpm --import of the key and the subsequent yum install
worked.  It is clearly an OS issue particular to Jenkins rather than a
'puppet' issue (as Puppet installed via yum and installed the key
automagically without an issue).

What I did notice is that a copy of the key jenkins pubkey doesn't get
installed into /etc/pki. But you can query it via rpm -qa gpg-pubkey*:
rpm -qi gpg-pubkey-d50582e6-4a3feef6

So, you could use this to install from scratch:
class jenkins {

  exec { "key_import":
   command => "/bin/rpm --import
http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key";
   onlyif => 'a test for the existence of  rpm -qi
gpg-pubkey-d50582e6-4a3feef6 doesn't exist'
  }
  yumrepo { "jenkins":
baseurl  => "http://pkg.jenkins-ci.org/redhat";,
descr=> "Jenkins",
enabled  => 1,
gpgcheck => 1,
gpgkey   => "http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key";,
require => Exec["key_import"],
  }
  package {"jenkins": ensure => latest, require => Yumrepo["jenkins"] }
}

include jenkins

Normally what happens is that if it is 'assumed yes', yum will
automatically accept the public key via the url - I don't know why
Jenkins is different - but it appears to install a new repo file and
try to import the pubkey again on install - maybe this confuses yum?
Just speculating - not going to investigate further :)

Cheers,
Den

On Fri, Apr 27, 2012 at 7:51 AM, Michael Harris
 wrote:
> On Thursday, 26 April 2012 18:33:18 UTC+10, denmat wrote:
>>
>> Hi, I just spun up a fresh AWS instance and did this:
>>
>> $ cat puppet.repo.pp
>> class jenkins {
>>
>>       yumrepo { "jenkins":
>>             baseurl  => "http://pkg.jenkins-ci.org/redhat";,
>>             descr    => "Jenkins",
>>             enabled  => 1,
>>             gpgcheck => 1,
>>             gpgkey   =>
>> "http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key";,
>>           }
>>   package {"jenkins": ensure => latest }
>> }
>>
>> include jenkins
>>
>
> I appreciate your help, but with that manifest I get the same error on both
> the node I'm trying to install on and on a fresh CentOS 5.7 with Puppet
> 2.7.9.
>
> err: /Stage[main]/Jenkins/Package[jenkins]/ensure: change from absent to
> latest failed: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y
> install jenkins' returned 1: warning: rpmts_HdrFromFdno: Header V4 DSA
> signature: NOKEY, key ID d50582e6
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/sVsibb6ExBsJ.
>
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Installing Jenkins with Puppet fails to import GPG key

2012-04-26 Thread Michael Harris


The following manifest results in the jenkins and epel repos being 
installed, rpm -qa gpg-pub* shows the epel key but not the jenkins key, and 
git is installed but not jenkins.

class jenkins { 

  yumrepo {"jenkins":
baseurl  => "http://pkg.jenkins-ci.org/redhat";,
descr=> "Jenkins",
enabled  => 1,
gpgcheck => 1,
gpgkey   => "http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key";,
  }
  package {"jenkins":
ensure  => latest,
require => Yumrepo["jenkins"]
  }
}

class git { 
  yumrepo {"epel":
baseurl  => "http://mirror.aarnet.edu.au/pub/epel/5/i386";,
descr=> "Extra Packages for Enterprise Linux (EPEL)",
enabled  => 1,
gpgcheck => 1,
gpgkey   => 
"http://keys.gnupg.net:11371/pks/lookup?search=0x217521F6&op=get";,
  }
  package {"git":
ensure  => latest,
require => Yumrepo["epel"]
  }
}

include jenkins
include git

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/jdXMr8S6OWkJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Using backreferences from node name regex match

2012-04-26 Thread Nick Fagerlund
Yeah, I'm pretty sure that's not supported.

But you could implement whatever you're trying to do with a regular
regex match, if you need to. Use the built-in $clientcert variable,
which contains the node's certname.

(This assumes you're doing the default behavior of using the certname
as the node name. Hint: you almost certainly are.)

On Apr 26, 4:38 pm, Guy Knights  wrote:
> I appears that backreferences when using regexes in node names doesn't
> work. Can anyone confirm this? If I'm incorrect, how do I go about using a
> backreference to the name regex within the node definition container?
>
> Thanks,
> Guy

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Creating a system module path (starting with Telly)

2012-04-26 Thread Michael Stahnke
On Tue, Apr 24, 2012 at 1:53 AM, Bill Proud  wrote:
> Sounds good.
>
> One problem that I have with the forge is that the extent to which the
> modules have been tested is not clear to me.  Can I take it that the core
> modules that ship with puppet will have been through a similar testing cycle
> as puppet itself?

This is still unclear.  The modules moving in a system module path
will have that type testing. Other modules have varying degrees of
testing and we have plans to improve basically everything having to do
with modules and the forge in that space.

Mike


>
>
> On Monday, April 23, 2012 11:03:39 PM UTC+2, Michael Stanhke wrote:
>>
>> There was some discussion and concern about moving the Nagios
>> types/providers out of the core area of Puppet for Telly.  We made a
>> mistake of talking about a point solution to a problem rather than the
>> vision on where we’d like it to go, and why.  We’ve attempted to
>> outline this a bit more so you can hopefully have a better
>> understanding of our ideas.  As always, feel free to comment and voice
>> concerns.  This isn’t set in stone and at this point is a proposal.
>>
>> == The Problem ==
>>
>> Bundling types and providers into the core of Puppet has a few problems.
>>
>> The most important problem is that it ties releases of the types or
>> providers to releases of core Puppet.  That is a pretty slow moving
>> (for stability) system, and it is also a system where most of the
>> investment goes into supporting new releases rather than improving
>> older releases.
>>
>> We want to keep our core stable, while allowing the community platform
>> experts, distro maintainers and other users to enhance the experience
>> with certain aspects of Puppet without having to wait for the next
>> major release.
>>
>> The secondary problem is that it plays favourites - some platform
>> types are in core, others are not.  Some monitoring systems, or disk
>> management systems are in core, others are not.  That doesn't reflect
>> the real importance of those types, or that some are more special or
>> more stable than others - just happenstance of time.
>>
>> On the other hand, having Puppet work out of the box is awesome.  You
>> should be able to install Puppet and immediately get started, managing
>> your platform and generally doing awesome things.
>>
>> Puppet with no types, and no providers, is not awesome.  It can't do
>> anything - and "install twenty things, then ..." is not a good
>> introductory experience.
>>
>> == Proposed Solution ==
>>
>> We want to take some of the great lessons from other platforms - Perl,
>> Python, and Ruby - and apply them to this problem:
>>
>> We are proposing to pull more types and providers out of Puppet, so
>> they get the benefit of an independent release cycle, and the
>> advantages of full forge integration.
>>
>> We also propose to have a "system" module path: a set of modules that
>> ship with core Puppet, taken from the forge, and available by default
>> at install time.  They will ensure that Puppet is still awesome out of
>> the box - but that you can list modules and their versions, and can
>> update freely.
>>
>> We also plan a "vendor" module path, and a "site" module path.  Other
>> platforms have shown the value of this: when distributions package
>> Puppet, they might want more or different modules to support their
>> systems better.  Allowing them to drop into the vendor module path and
>> operate in the same way as our system modules makes it easy to use
>> normal modules in an awesome way.
>>
>> Finally, the "site" module path allows for easy deployment of modules
>> through other packaging systems like yum and apt, internally to
>> companies and sites that want a different path for versioning modules.
>>  They separate the mutable path used by the local tool and the managed
>> path for self-packaged modules.
>>
>> This seems to offer the best of both worlds: we can take full
>> advantage of the strengths of modules, but without giving up the
>> awesomeness of Puppet that does great things out of the box.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/LyPHnvAgjQ4J.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: Why latest stable Debian Squeeze package is 2.6.2-5+squeeze4 please ?

2012-04-26 Thread Michael Stahnke
Added a pull request to puppet-docs

https://github.com/puppetlabs/puppet-docs/pull/67

Updated the wiki as well.

On Tue, Apr 24, 2012 at 2:35 AM, Christophe L  wrote:
> Hello Mike,
>
> Sorry for the late feedback.
>
> On this page
> http://docs.puppetlabs.com/guides/installation.html
> it is written
> "
> OS Packages
>
> If installing from a distribution maintained package, such as those
> listed on the Downloading Puppet Wiki Page all OS prerequisites should
> be handled by your package manager.
> "
>
> On this page
> http://projects.puppetlabs.com/projects/puppet/wiki/Downloading_Puppet
> it is written
> "
> Debian Packages
>
> Debian packages are available from the Debian Packages site.
> "
>
> So there is no information about the apt.puppetlabs.com debian package
> repository on those two pages, and I think it would be nice to have
> this information on at least one of them.
>
> Thanks in advance.
>
> Best regards,
> Christophe
>
>
> On 8 avr, 00:42, Michael Stahnke  wrote:
>> On Thu, Apr 5, 2012 at 10:34 PM, Christophe L  
>> wrote:
>> > Thank you all for your answers !
>>
>> > As a suggestion for the documentation, that would be nice to have
>> > information about the http://apt.puppetlabs.com/apt repository on the
>> > puppet installation page.
>>
>> That is currently undergoing some work, and will be there.  If you
>> happen to know pages exactly you were referencing, I'll be sure to
>> them updated.
>>
>> Mike
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > Best regards,
>> > Christophe
>>
>> > On 5 avr, 20:58, Gabriel Filion  wrote:
>> >> On 12-04-05 07:19 AM, Christophe L wrote:
>>
>> >> > After some research, I have found that the last stable debian package
>> >> > version is
>> >> > puppet (2.6.2-5+squeeze4) [security]
>> >> >http://packages.debian.org/squeeze/puppet
>>
>> >> > and that 2.7.12-3 is considered as unstable
>> >> >http://packages.qa.debian.org/p/puppet.html
>>
>> >> In Debian's release cycle, the packages are freezed before a release.
>> >> when this happens it means that package versions that are currently in
>> >> the "testing" branch will be used for the next debian release, and will
>> >> be used until the next release.
>>
>> >> the "stable" part in all that is the debian branch name that represents
>> >> the current release, so what software they support.
>>
>> >> security patches will be backported to 2.6 as much as possible for as
>> >> long as the current "stable" branch is the current one.
>>
>> >> for now, you can use the squeeze-backports[1] branch, in which you can
>> >> find puppet 2.7
>>
>> >> [1]:http://backports-master.debian.org/Instructions/
>>
>> >> --
>> >> Gabriel Filion
>>
>> > --
>> > 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+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/puppet-users?hl=en.
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Using backreferences from node name regex match

2012-04-26 Thread Guy Knights
I appears that backreferences when using regexes in node names doesn't 
work. Can anyone confirm this? If I'm incorrect, how do I go about using a 
backreference to the name regex within the node definition container?

Thanks,
Guy 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/XaP039Sz-h0J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Optional values from Hiera (no default value)

2012-04-26 Thread Lars Francke
Hey Tim,

thanks for your answer.

> hiera() can take a second argument which is the default you want to
> supply if no data store provides a value.  Before you ask, no, I don't
> know where that's documented, but we've been using it for a while in
> our puppet manifests and it has been mentioned on the list even today.

I actually knew about that already but if I use that I'll have to
revert to some "magic" value as the default because it can't be nil
for example

I'd have to do hiera('foo', 'MAGIC') and then check for 'MAGIC' in my
if statement. That's not a big deal but I had hoped there would be a
way to have a really "optional" lookup.

Cheers,
Lars

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Installing Jenkins with Puppet fails to import GPG key

2012-04-26 Thread Michael Harris
On Thursday, 26 April 2012 18:33:18 UTC+10, denmat wrote:
>
> Hi, I just spun up a fresh AWS instance and did this: 
>
> $ cat puppet.repo.pp 
> class jenkins { 
>
>   yumrepo { "jenkins": 
> baseurl  => "http://pkg.jenkins-ci.org/redhat";, 
> descr=> "Jenkins", 
> enabled  => 1, 
> gpgcheck => 1, 
> gpgkey   => "
> http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key";, 
>   } 
>   package {"jenkins": ensure => latest } 
> } 
>
> include jenkins 
>
>
I appreciate your help, but with that manifest I get the same error on both 
the node I'm trying to install on and on a fresh CentOS 5.7 with Puppet 
2.7.9.

err: /Stage[main]/Jenkins/Package[jenkins]/ensure: change from absent to 
latest failed: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y 
install jenkins' returned 1: warning: rpmts_HdrFromFdno: Header V4 DSA 
signature: NOKEY, key ID d50582e6 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/sVsibb6ExBsJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Optional values from Hiera (no default value)

2012-04-26 Thread Tim Mooney

In regard to: [Puppet Users] Optional values from Hiera (no default value),...:


Hello Puppet List,

I'm writing a module that should take an optional value and I want to
get it (amongst other places) from Hiera.

$repository = $::java_repository ? {
 undef   => hiera('java_repository')
 default => $::java_repository,
}


hiera() can take a second argument which is the default you want to
supply if no data store provides a value.  Before you ask, no, I don't
know where that's documented, but we've been using it for a while in
our puppet manifests and it has been mentioned on the list even today.

Tim
--
Tim Mooney tim.moo...@ndsu.edu
Enterprise Computing & Infrastructure  701-231-1076 (Voice)
Room 242-J6, IACC Building 701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Templating DHCP3-Server Need To Loop Through Subnets

2012-04-26 Thread Brian Carpio
Thanks Greg. Just what I was looking for!

Brian Carpio

On Apr 26, 10:43 am, Greg Sutcliffe  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On Thu 26 Apr 2012 17:24:17 BST, Brian Carpio wrote:
>
> > $subnet = [ 192.168.10.0, 192.168.20.0, 192.168.30.0 ]
> > $range = [ 192.168.10.115 192.168.10.120 ]
>
> Sounds like you need a Hash here:
>
> $subnets = { '192.168.10.0' => '192.168.10.115 192.168.10.120',
>                          '192.168.20.0' => '192.168.20.105
> 192.168.20.130',
>                       }
>
> Then access it with something like:
>
> <% subnets.each do |subnet,range| -%>
> subnet <%= subnet %>
>   range <%= range %>
> <% end -%>
>
> Hope that helps,
> Greg
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.19 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk+ZexQACgkQ8O7RN8oK65P3DACeNr38heQ8cILSbEgbGW1CMhng
> ESsAniVsAJpfAoWklmCk+6qDCAwji/7d
> =M9cK
> -END PGP SIGNATURE-

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Templating DHCP3-Server Need To Loop Through Subnets

2012-04-26 Thread Greg Sutcliffe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu 26 Apr 2012 17:24:17 BST, Brian Carpio wrote:
> $subnet = [ 192.168.10.0, 192.168.20.0, 192.168.30.0 ]
> $range = [ 192.168.10.115 192.168.10.120 ]

Sounds like you need a Hash here:

$subnets = { '192.168.10.0' => '192.168.10.115 192.168.10.120',
 '192.168.20.0' => '192.168.20.105
192.168.20.130',
  }

Then access it with something like:

<% subnets.each do |subnet,range| -%>
subnet <%= subnet %>
  range <%= range %>
<% end -%>

Hope that helps,
Greg
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+ZexQACgkQ8O7RN8oK65P3DACeNr38heQ8cILSbEgbGW1CMhng
ESsAniVsAJpfAoWklmCk+6qDCAwji/7d
=M9cK
-END PGP SIGNATURE-

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Templating DHCP3-Server Need To Loop Through Subnets

2012-04-26 Thread Brian Carpio
I know the title doesn't define what I am trying to do very well but
this is what I'd like to accomplish.

I have a params.pp which defines the subnets I would like to have
setup in my .dhcpd.conf.erb, but default the dhcpd.conf looks like
this:


subnet 192.168.10.0 netmask 255.255.255.0 {
  range 192.168.10.115 192.168.10.120;
  option broadcast-address 192.168.10.255;
  option routers 192.168.10.1;
  option subnet-mask 255.255.255.0;
  option domain-name-servers 192.168.10.12;
option domain-name "arch.ecollege.com";
  filename "pxelinux.0";
  next-server 192.168.10.133;
}

But I'd like to make this in such a way that in my params.pp I have a
subnet variable like

$subnet = [ 192.168.10.0, 192.168.20.0, 192.168.30.0 ]

You get the idea, but for 192.168.10.0 I want to define the range, so:

$range = [ 192.168.10.115 192.168.10.120 ]

But I also want to define the range for 192.168.20.0 which might be a
different range then the 192.168.10 subnet..


I started with


<% scope.lookupvar('dhcp3-server::params::subnet').each do |var| -%>
subnet <%= var %> netmask 255.255.255.0 {
range ??

I'm not sure how to define the range for the 192.168.10 subnet vs the
192.168.20 subnet without having to build the file manually.

Maybe this isn't possible? Any help is greatly appreciated.


-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Help with parametrized class include

2012-04-26 Thread Andre Nathan
Hello

I have some puppet code that does the equivalent of the following. The
idea is to have a define "foo" with some actions that must be executed
before it runs ("foo::pre"). Since the resources in "foo::pre" can
only be defined once, it's implemented as a class, and included from
the define:

class foo::pre {
  notice("foo::pre")
}
define foo() {
  include 'foo::pre'
  notice("foo")
}
class x {
  notice("x")
  foo { 'x foo':
  }
}
class y {
  notice("y")
  foo { 'y foo':
  }
}
include x
include y

My problem starts when I need to parametrize class "foo::pre":

class foo::pre($blah) {
  notice("foo::pre")
}
define foo() {
  class { 'foo::pre':
blah => 1,
  }
  notice("foo")
}
class x {
  notice("x")
  foo { 'x foo':
  }
}
class y {
  notice("y")
  foo { 'y foo':
  }
}
include x
include y

When I try to apply this code, I get the error "Duplicate definition:
Class[Foo::Pre] is already defined".

I always thought that the "class { 'someclass': }" syntax was
equivalent to "include someclass", but it seems that in the former,
Puppet treats it as a class definition and not just an include (even
though that's not where the class is defined).

Is there any way around this, or another way to achieve this with
parametrized classes?

Thanks in advance,
Andre

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] extdata from MySQL

2012-04-26 Thread Craig Dunn

On 26/04/2012 15:51, Gary Larizza wrote:

I believe Craig Dunn had an article on using a MySQL backend for Hiera
-->
http://www.craigdunn.org/2012/03/introducing-hiera-mysql-mysql-backend-for-hiera/


Until hiera 0.3.1 is actually released you'll need to manually apply the 
patch in http://projects.puppetlabs.com/issues/13641 in order for 
hiera-mysql to work using Puppet.  When an 0.3.1 gem comes out I'll add 
it as a dependency.


Cheers
Craig

--
Craig Dunn | http://www.craigdunn.org
Yahoo/Skype: craigrdunn | Twitter: @crayfishX

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] extdata from MySQL

2012-04-26 Thread Gary Larizza
I believe Craig Dunn had an article on using a MySQL backend for Hiera -->  
http://www.craigdunn.org/2012/03/introducing-hiera-mysql-mysql-backend-for-hiera/
 

-- 
Gary Larizza
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Thursday, April 26, 2012 at 7:36 AM, Jonathan Gazeley wrote:

> There doesn't seem to be much information about this on the web, but is 
> it possible to use MySQL as a backend for handling extdata?
> 
> It would be enormously easier for me to use a database that could be 
> easily updated rather than csv files that live on the puppet master.
> 
> Cheers,
> Jonathan
> 
> -- 
> 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 
> (mailto:puppet-users@googlegroups.com).
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com 
> (mailto:puppet-users+unsubscr...@googlegroups.com).
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
> 
> 


-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] extdata from MySQL

2012-04-26 Thread Jonathan Gazeley
There doesn't seem to be much information about this on the web, but is 
it possible to use MySQL as a backend for handling extdata?


It would be enormously easier for me to use a database that could be 
easily updated rather than csv files that live on the puppet master.


Cheers,
Jonathan

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Host/Agent should not install if there are no changes in file

2012-04-26 Thread jcbollinger


On Apr 25, 10:02 pm, Suresh  wrote:
>   file { "puppet:///modules/myapp/MyApp_GA.tar.gz":
>     owner => 'myapp',
>     group => 'myapp',
>     ensure => latest,
>     path => "/opt/apps/myapp/artifacts/MyApp_GA.tar.gz",
>   }


Furthermore, if you continue to use File and Exec resources instead of
packaging it up, you should really write that File resource in one of
these two forms:

# using a logical name for the resource
file { 'myapp::tarball':
ensure => 'file',
path => '/opt/apps/myapp/artifacts/MyApp_GA.tar.gz',
owner => 'myapp',
group => 'myapp',
ensure => latest,
# exactly one of 'source', 'content', or 'target':
source =>  'puppet:///modules/myapp/MyApp_GA.tar.gz',
}

# using the destination path as the resource name
file { '/opt/apps/myapp/artifacts/MyApp_GA.tar.gz':
ensure => 'file',
owner => 'myapp',
group => 'myapp',
ensure => latest,
# exactly one of 'source', 'content', or 'target':
source =>  'puppet:///modules/myapp/MyApp_GA.tar.gz',
}

You should *not* name the resource by the server-side path / URL.

Also, you absolutely should specify the file content via either
'content' or 'source'.  That it worked at all as you presented it
(supposing that it did) is an undocumented implementation quirk on
which you should not rely.  Furthermore, you should specify an
explicit 'ensure' value at least for clarity, and maybe for
correctness.


John

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Mac users: Textbucket scripts for puppet types

2012-04-26 Thread Wolf Noble
Hi Gang,

If you're a mac user and haven't heard of text bucket, but find yourself typing 
the same things semi-often.. you might want to check it out.
http://bassetsoftware.com/b.cgi/textbucket/index

I started using it about 9 months ago when someone showed me klypper on linux 
and I went searching for something similar… Anyways, where was I?

oh yeah right:
I've cobbled together some ruby scripts to help make creating the 10 core 
puppet types a little easier..

cron
exec
file
group
host
mount
package
service
tidy
user

you can find them here, along with a stub text bucket storedata file:
 https://github.com/wolfspyre/textbucket-puppet

the storedata file lives in ~/Library/Application Support/Text_Bucket/storedata

the application reads the file at load time, and saves it blindly when you quit 
the program, so make sure that if you play with the file you do so when the 
program isn't running, lest your changes be lost.


I'll continue to hack on them as I get time/need and post updates to github. 
They're FAR from perfect (or even good?) right now. There are plenty of 
formatting issues. I'd be willing to bet there's even a few typos or incorrect 
attributes listed. I finished the user script last night and so I figured I'd 
share sooner than later in case it makes someone else's life easier.


W




This message may contain confidential or privileged information. If you are not 
the intended recipient, please advise us immediately and delete this message. 
See http://www.datapipe.com/legal/email_disclaimer/ for further information on 
confidentiality and the risks of non-secure electronic communication. If you 
cannot access these links, please notify us by reply message and we will send 
the contents to you.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] A simple solution to the "deep directory tree" problem

2012-04-26 Thread Christopher Wood
I hope you have more moments of despair because that's nifty and I'll use it.

You could possibly use ruby's dirname and basename 
(http://ruby-doc.org/core-1.8.7/File.html) inside an inline template to do the 
directory/file split for you in a single resource. The parameters for 
permissions and ownership for file vs directory might get messy, though.

On Thu, Apr 26, 2012 at 12:55:59AM -0700, Amos Shapira wrote:
>Hello,
> 
>Like many others, I once again had to deal with creation of deep directory
>trees with puppet. I did the usual:
>file { [ "/a", "/a/b/", "/a/b/c"...]:
>  ensure => directory
>}
>And again got sick of it. I still didn't find a good answer for it on the
>web so here is what I came up with in a moment of despair:
> 
>define core::mkdirp($owner = undef, $group = undef) {
>  exec { "mkdir -p ${name}":
>    creates => $name,
>  }
> 
>  file { $name:
>    ensure => 'directory',
>    require => Exec["mkdir -p ${name}"],
>    owner => $owner,
>    group => $group,
>  }
>}
> 
>Usage:
> 
>core::mkdirp { "/a/b/c/d":
>  owner => $user,
>  group => $group,
>}
> 
>file { "/a/b/c/d/file.txt":
> require => Core::Mkdirp["/a/b/c/d"],
>...
>}
> 
>So far it works beautifully for me but I want to hear what the community
>thinks of it and whether there is a nicer solution I'm missing.
> 
>Thanks.
> 
>--Amos
> 
>--
>You received this message because you are subscribed to the Google Groups
>"Puppet Users" group.
>To view this discussion on the web visit
>[1]https://groups.google.com/d/msg/puppet-users/-/ozFNn2oUGCQJ.
>To post to this group, send email to puppet-users@googlegroups.com.
>To unsubscribe from this group, send email to
>puppet-users+unsubscr...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/puppet-users?hl=en.
> 
> References
> 
>Visible links
>1. https://groups.google.com/d/msg/puppet-users/-/ozFNn2oUGCQJ

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Host/Agent should not install if there are no changes in file

2012-04-26 Thread Michael Baydoun
add something like
notify   => Exec["myapp::decompress"],
to your file resource

also, according to the documentation, for a file resource the ensure
parameter
possible values are *absent*, *present*, *file*, and *directory*
I'm not sure what latest is going to do there, but you don't need it, just
say present

ensure => latest is usually used for the package resource type, though I
would suggest never doing that either, unless you really want your package
management trying to update everytime puppet runs

On Wed, Apr 25, 2012 at 11:02 PM, Suresh  wrote:

> class filecheck {
>   include myapp
>   file { "puppet:///modules/myapp/MyApp_GA.tar.gz":
> owner => 'myapp',
> group => 'myapp',
> ensure => latest,
> path => "/opt/apps/myapp/artifacts/MyApp_GA.tar.gz",
>   }
> }
>
>
> class myapp::decompress {
>   exec { "myapp::decompress":
> owner => 'myapp',
> group => 'myapp',
> mode => 0755,
> command => "/bin/tar -xzf MyApp_GA.tar.gz -C /opt/apps/myapp/release"
> }
>
>
> in my puppet manifests/nodes.pp
> I have defined several stages e.g.
>
> nodes.pp
> 
> stage {
>   "stop_service": ;
>  }
>
>  node mynode.com {
>include filecheck, myapp
>  }
>
> What I need is if filecheck fails, then execution should stop and should
> go no further.
>
> -Suresh
>
> On Wed, Apr 25, 2012 at 7:21 PM, Michael Baydoun 
> wrote:
>
>> The file ensure for the tar file should only download when it changes
>> The untar can have a require on the file resource, and so on
>>
>> Can you post your file resource and untar exec resource?
>>
>>
>> On Wed, Apr 25, 2012 at 5:51 PM, Suresh  wrote:
>>
>>> Can you guys please help me address this host configuration?
>>>
>>> 1) I have 5 different modules that need to be installed to each
>>> host/agent
>>> 1.1) from one of the modules, a large application tar file is downloaded
>>> by agent and performs untar to required folder structure.
>>> 1.2) before the "untar", required application services are stopped and
>>> after "untar' is complete all the services are started
>>>
>>> What I have observed is, agent is downloading the application tar file
>>> every 30 minutes (agent is running in daemon mode)
>>> and performing the complete process (1, 1.1, 1.2) which it shouldn't if
>>> the file is unchanged from its previous download.
>>>
>>>
>>> How can I configure agent, such that it should perform the installation,
>>> only if downloaded file is changed from previous download?
>>>
>>> Suresh
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Puppet Users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/puppet-users/-/_YirDaiAVGwJ.
>>> To post to this group, send email to puppet-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> puppet-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/puppet-users?hl=en.
>>>
>>
>>  --
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>  --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: ordering or chaining for generate() function

2012-04-26 Thread jcbollinger


On Apr 25, 11:49 am, psychobyte  wrote:
> Essentially, yeah.
>
> we have a data file that needs updating on the server.  This is done
> through a custom script. i want to use generate() to run that script server
> side
>  before we re-create the config files via puppet.  I want to guarantee that
> the generate function runs before any file resources.


That doesn't make sense to me.  Is the data file you are trying to
generate specific to the node you want to configure?

If not, then why do you need to (re)generate it every time a node
requests a catalog?

If so, then why can't you incorporate the data generation directly
into the process of generating the target config file?  Alternatively,
why is it preferable to generate the node-specific data file on the
server instead of on the node?

If you insist on continuing with this unwise approach, then you need
to understand that Puppet's resource relationships (and thus also run
stages) influence only the order in which resources are applied to the
node, not the order in which related operations are performed on the
master.  Your best bet is Luke's suggestion, which is basically to
invoke generate() in the same class and above your declaration of
File['conffile'].  But really, think again.


John

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Re: Host/Agent should not install if there are no changes in file

2012-04-26 Thread jcbollinger


On Apr 25, 10:02 pm, Suresh  wrote:
> class filecheck {
>   include myapp
>   file { "puppet:///modules/myapp/MyApp_GA.tar.gz":
>     owner => 'myapp',
>     group => 'myapp',
>     ensure => latest,
>     path => "/opt/apps/myapp/artifacts/MyApp_GA.tar.gz",
>   }
>
> }
>
> class myapp::decompress {
>   exec { "myapp::decompress":
>     owner => 'myapp',
>     group => 'myapp',
>     mode => 0755,
>     command => "/bin/tar -xzf MyApp_GA.tar.gz -C /opt/apps/myapp/release"
>
> }
>
> in my puppet manifests/nodes.pp
> I have defined several stages e.g.
>
> nodes.pp
> 
> stage {
>   "stop_service": ;
>  }
>
>  node mynode.com {
>    include filecheck, myapp
>  }
>
> What I need is if filecheck fails, then execution should stop and should go
> no further.


That should indeed happen if filecheck failed, but File['puppet:///
modules/myapp/MyApp_GA.tar.gz'] (and thus Class['filecheck']) will not
fail on account of the file already being present.  It should not
download the file again either in that case (are you sure it's doing
so?) unless the version on the server is different from the one on the
client, but nothing I see in your manifests would prevent Puppet from
proceeding to Exec[ 'myapp::decompress' ].

You need to adjust your mental model.  Your class names and your
expectations suggest that you regard Puppet as some kind of scripting
engine.  It isn't.  Rather, it is a state management service.  It
takes your specifications for a target *state*, and does whatever is
necessary (broadly speaking) to achieve that state.  "Whatever it
takes" can be nothing, and that's just fine with Puppet -- by no means
is it a failure.

To address your problem, it would be far better build a package for
"myapp" (RPM, DEB, or whatever is appropriate for your target system),
put it in a local package repository, and use Puppet's Package
resource type to ensure it installed.  Even stopping and restarting
the service around an installation or update would be better done in
the package's scripts than directly under Puppet control.  Don't
reinvent the wheel here.


John

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Optional values from Hiera (no default value)

2012-04-26 Thread Lars Francke
Hello Puppet List,

I'm writing a module that should take an optional value and I want to
get it (amongst other places) from Hiera.

$repository = $::java_repository ? {
  undef   => hiera('java_repository')
  default => $::java_repository,
}

But this fails because Hiera raises an error if it can't find a value.

I later want to do something like this:

if $repository {
  Class[$repository] -> Class['java::install']
}

I tried following the examples from the recent blog series about
module design but I'm still very much learning so this might not even
be the best way to go about this. Any hints would be appreciated.

Cheers,
Lars

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Host/Agent should not install if there are no changes in file

2012-04-26 Thread Suresh
class filecheck {
  include myapp
  file { "puppet:///modules/myapp/MyApp_GA.tar.gz":
owner => 'myapp',
group => 'myapp',
ensure => latest,
path => "/opt/apps/myapp/artifacts/MyApp_GA.tar.gz",
  }
}


class myapp::decompress {
  exec { "myapp::decompress":
owner => 'myapp',
group => 'myapp',
mode => 0755,
command => "/bin/tar -xzf MyApp_GA.tar.gz -C /opt/apps/myapp/release"
}


in my puppet manifests/nodes.pp
I have defined several stages e.g.

nodes.pp

stage {
  "stop_service": ;
 }

 node mynode.com {
   include filecheck, myapp
 }

What I need is if filecheck fails, then execution should stop and should go
no further.

-Suresh

On Wed, Apr 25, 2012 at 7:21 PM, Michael Baydoun wrote:

> The file ensure for the tar file should only download when it changes
> The untar can have a require on the file resource, and so on
>
> Can you post your file resource and untar exec resource?
>
>
> On Wed, Apr 25, 2012 at 5:51 PM, Suresh  wrote:
>
>> Can you guys please help me address this host configuration?
>>
>> 1) I have 5 different modules that need to be installed to each host/agent
>> 1.1) from one of the modules, a large application tar file is downloaded
>> by agent and performs untar to required folder structure.
>> 1.2) before the "untar", required application services are stopped and
>> after "untar' is complete all the services are started
>>
>> What I have observed is, agent is downloading the application tar file
>> every 30 minutes (agent is running in daemon mode)
>> and performing the complete process (1, 1.1, 1.2) which it shouldn't if
>> the file is unchanged from its previous download.
>>
>>
>> How can I configure agent, such that it should perform the installation,
>> only if downloaded file is changed from previous download?
>>
>> Suresh
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/puppet-users/-/_YirDaiAVGwJ.
>> To post to this group, send email to puppet-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> puppet-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>  --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Creating configuration for dhcpd

2012-04-26 Thread Jiří Červenka
Hi,
I am trying to set up puppet for creating configuration files for
automatic installation. I have a node which runs both puppet master
and dhcp server. On this node I wanna create configuration file for
dhcpd which will contain static ip address definition for each host.
Like this :

...
host node1 { hardware ethernet 08:00:27:ed:8f:ea; fixed-address
192.168.2.1; }
host node2 { hardware ethernet 08:00:27:df:b4:0c; fixed-address
192.168.2.2; }
host node3 { hardware ethernet 78:e7:d1:24:5c:10; fixed-address
192.168.2.3; }
...

My configuration:

/etc/puppet/manifests/site.pp:
import "nodes/puppet.pp"

/etc/puppet/manifests/nodes/puppet.pp:
import "/etc/puppet/manifests/roles/puppetserver.pp"

node 'puppet' inherits puppetserver {
} #node puppet

/etc/puppet/manifests/roles/puppetserver.pp:
import "/etc/puppet/manifests/roles/basenode.pp"
node 'puppetserver' inherits basenode {
 preseed {
"node1":
mac1  => "44-1e-a1-39-05-a0",
mac2  => "44:1e:a1:39:05:a0",
ip   => "192.168.2.1",
netmask   => "255.255.0.0",
"node2":
mac1  => "78-e7-d1-24-5f-d0",
mac2  => "78:e7:d1:24:5f:d0",
ip=> "192.168.2.2",
netmask   => "255.255.0.0",
"node3":
mac1  => "78-e7-d1-24-5c-10",
mac2  => "78:e7:d1:24:5c:10",
ip   => "192.168.2.3",
netmask   => "255.255.0.0",
} #preseed

include dhcpd
} # node

This is puppet module for preseed and dhcpd.
/etc/puppet/modules/preseed/manifests/init.pp:
class dhcpd {
package { "isc-dhcp-server":
ensure => installed,
} #package
service { "isc-dhcp-server":
ensure  => $ensure,
enable  => true,
require => Package["isc-dhcp-server"],
} #service
file { "/etc/default/isc-dhcp-server":
ensure  => present,
path=> "/etc/default/isc-dhcp-server",
mode=> 644,
content => template("preseed/isc-dhcp-server.erb"),
require => Package["isc-dhcp-server"],
notify  => Service["isc-dhcp-server"],
} #file
} #class

define preseed ($mac1 = dflt, $mac2 = undef, $ip, $netmask) {
include dhcpd
file { "/var/www/preseed_$name.cfg":
ensure  => present,
mode=> 644,
content => template("preseed/preseed_web.cfg.erb"),
} #file
file { "/var/lib/tftpboot/pxelinux.cfg/01-$mac1":
ensure  => present,
mode=> 644,
content => template("preseed/pxe-config.erb"),
require => File["/var/www/preseed_$name.cfg"],
} #file
file { "/etc/dhcp/dhcpd.conf-$name":
ensure  => present,
path=> "/etc/dhcp/dhcpd.conf",
mode=> 644,
content => template("preseed/dhcpd.conf.erb"),
require => Package["isc-dhcp-server"],
notify  => Service["isc-dhcp-server"],
} #file
} #define

dhcpd.conf.erb:
...
<% name.each do |val| -%>
host <%= val %> { hardware ethernet <%= mac2 %>; fixed-address
<%= ip %>; }
<% end -%>

When I try to apply this configuration, I receive this message:

root@puppet:/# puppet agent --test --server=puppet.domain.com
info: Caching catalog for puppet.domain.com
err: Could not run Puppet configuration client: Cannot alias File[/etc/
dhcp/dhcpd.conf-node1] to ["/etc/dhcp/dhcpd.conf"]; resource ["File",
["/etc/dhcp/dhcpd.conf"]] already exists

What is the best way to create a configuration that applies only to
one node, but have to contain different parameters for each node.

Thanks.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Re: exec's onlyif parameter fails for a bash one-liner

2012-04-26 Thread Matthias Saou
On Wed, 25 Apr 2012 10:29:23 -0700 (PDT)
Shantanu  wrote:

> 
> On Apr 25, 11:46 am, Craig Dunn  wrote:
> > On 25/04/2012 17:01, Shantanu wrote:
> >
> >
> >
> > > I would like to 'exec' an installation script 'onlyif' an
> > > installation directory is empty. I tried using following bash
> > > one-liner however it didn't work:
> > > 
> > >    exec{$one_install_script:
> > >      require =>  File[$one_install_script],
> > >      onlyif =>  "[ \"$(/bin/ls -A  $one_location)\" ]&&  exit 1
> > > || exit 0"
> > >    }
> >
> > Puppet wont let you run commands that dont have fully qualified
> > paths, try adding this and it should work...
> >
> > path => "/bin"
> >
> 
> Almost worked, it didn't fail while applying the catalog however it
> failed with following error.
> 
> {{{
> Exec[/tmp/one_install_script]: Could not evaluate: Could not find
> command '['
> }}}

That's because [ is usually in /usr/bin, not /bin :

$ which [
/usr/bin/[

so path => [ '/bin', '/usr/bin' ] would probably have worked.

> As suggested by Florian using 'provider => shell' takes care of PATH
> and shell built-ins as well.

That's probably just as good a solution.

On an unrelated note, something like the following might be more what
you're trying to achieve, since you have a somewhat reversed logic and
aren't checking for the directory's existence at all (untested) :

onlyif => "[ -d $one_location -a -z \"$(ls -A $one_location)\" ]"

Matthias

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Installing Jenkins with Puppet fails to import GPG key

2012-04-26 Thread denmat
Hi, I just spun up a fresh AWS instance and did this:

$ cat puppet.repo.pp
class jenkins {

  yumrepo { "jenkins":
baseurl  => "http://pkg.jenkins-ci.org/redhat";,
descr=> "Jenkins",
enabled  => 1,
gpgcheck => 1,
gpgkey   => "http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key";,
  }
  package {"jenkins": ensure => latest }
}

include jenkins

$ sudo puppet apply puppet.repo.pp
notice: /Stage[main]/Jenkins/Yumrepo[jenkins]/descr: descr changed ''
to 'Jenkins'
notice: /Stage[main]/Jenkins/Yumrepo[jenkins]/baseurl: baseurl changed
'' to 'http://pkg.jenkins-ci.org/redhat'
notice: /Stage[main]/Jenkins/Yumrepo[jenkins]/enabled: enabled changed '' to '1'
notice: /Stage[main]/Jenkins/Yumrepo[jenkins]/gpgcheck: gpgcheck
changed '' to '1'
notice: /Stage[main]/Jenkins/Yumrepo[jenkins]/gpgkey: gpgkey changed
'' to 'http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key'
notice: /Stage[main]/Jenkins/Package[jenkins]/ensure: created
notice: Finished catalog run in 10.20 seconds

$ rpm -qa |grep jenkins
jenkins-1.461-1.1.noarch

That's what I meant. You shouldn't need to import the key as it should
check against the public key in the url (if you where installing via
rpm that might be different and will probably require the local import
- haven't tested myself).

Den

On Thu, Apr 26, 2012 at 5:51 PM, Michael Harris
 wrote:
> On Thursday, 26 April 2012 11:17:05 UTC+10, denmat wrote:
>>
>>
>> The way that i import my keys is to set the gpg key for the yum repo like
>> so:
>>
>>           yumrepo { "jenkins":
>>             baseurl  => "http://pkg.jenkins-ci.org/redhat";,
>>             descr    => "Jenkins",
>>             enabled  => 1,
>>             gpgcheck => 1,
>>             gpgkey   =>
>> "http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key";,
>>           }
>>
>> Should take care of the import for you.
>
>
> Cool, I didn't know I could specify a URL for the key, thanks.
>
> However, I get the same error and the key still fails to import.
>
> cheers, Michael
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/cI79Jc80xg0J.
>
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] A simple solution to the "deep directory tree" problem

2012-04-26 Thread Amos Shapira
Hello,

Like many others, I once again had to deal with creation of deep directory 
trees with puppet. I did the usual:

file { [ "/a", "/a/b/", "/a/b/c"...]:
  ensure => directory
}

And again got sick of it. I still didn't find a good answer for it on the 
web so here is what I came up with in a moment of despair:

define core::mkdirp($owner = undef, $group = undef) {
  exec { "mkdir -p ${name}":
creates => $name,
  }

  file { $name:
ensure => 'directory',
require => Exec["mkdir -p ${name}"],
owner => $owner,
group => $group,
  }
}

Usage:

core::mkdirp { "/a/b/c/d":
  owner => $user,
  group => $group,
}

file { "/a/b/c/d/file.txt":
 require => Core::Mkdirp["/a/b/c/d"],
...
}

So far it works beautifully for me but I want to hear what the community 
thinks of it and whether there is a nicer solution I'm missing.

Thanks.

--Amos

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/ozFNn2oUGCQJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Installing Jenkins with Puppet fails to import GPG key

2012-04-26 Thread Michael Harris
On Thursday, 26 April 2012 11:17:05 UTC+10, denmat wrote:
>
>
> The way that i import my keys is to set the gpg key for the yum repo like 
> so:
>
>   yumrepo { "jenkins":
> baseurl  => "http://pkg.jenkins-ci.org/redhat";,
> descr=> "Jenkins",
> enabled  => 1,
> gpgcheck => 1,
> gpgkey   => "http://pkg.jenkins-ci.org/redhat/
> jenkins-ci.org.key",
>   }
>
> Should take care of the import for you.
>

Cool, I didn't know I could specify a URL for the key, thanks.

However, I get the same error and the key still fails to import.

cheers, Michael 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/cI79Jc80xg0J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.