[Puppet Users] puppetd no-daemonize
So I have been trying to run puppet once in my kickstart %post scripts but every time it detaches and daemonizes even though I have explicitly stated otherwise. Am I missing something? # rpm -q puppet puppet-0.24.8-1 # /usr/sbin/puppetd --onetime --no-daemonize --verbose --debug debug: Creating default schedules debug: Failed to load library 'shadow' for feature 'libshadow' debug: Failed to load library 'ldap' for feature 'ldap' debug: /Settings[/etc/puppet/puppetd.conf]/Settings[puppetd]/File[/var/puppet/state/state.yaml]: Autorequiring File[/var/puppet/state] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[ssl]/File[/etc/puppet/ssl/private]: Autorequiring File[/etc/puppet/ssl] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[ssl]/File[/etc/puppet/ssl/public_keys]: Autorequiring File[/etc/puppet/ssl] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[puppetd]/File[/var/puppet/state/classes.txt]: Autorequiring File[/var/puppet/state] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[ssl]/File[/etc/puppet/ssl/certs/#.pem]: Autorequiring File[/etc/puppet/ssl/certs] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[ssl]/File[/etc/puppet/ssl/certs]: Autorequiring File[/etc/puppet/ssl] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[ssl]/File[/etc/puppet/ssl/private_keys]: Autorequiring File[/etc/puppet/ssl] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[main]/File[/etc/puppet/ssl]: Autorequiring File[/etc/puppet] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[main]/File[/var/puppet/run]: Autorequiring File[/var/puppet] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[ssl]/File[/etc/puppet/ssl/csr_#.pem]: Autorequiring File[/etc/puppet/ssl] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[main]/File[/var/puppet/state]: Autorequiring File[/var/puppet] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[main]/File[/var/puppet/log]: Autorequiring File[/var/puppet] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[main]/File[/var/puppet/lib]: Autorequiring File[/var/puppet] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[ssl]/File[/etc/puppet/ssl/certs/ca.pem]: Autorequiring File[/etc/puppet/ssl/certs] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[ssl]/File[/etc/puppet/ssl/private_keys/###.pem]: Autorequiring File[/etc/puppet/ssl/private_keys] debug: /Settings[/etc/puppet/puppetd.conf]/Settings[ssl]/File[/etc/puppet/ssl/public_keys/###.pem]: Autorequiring File[/etc/puppet/ssl/public_keys] debug: Finishing transaction -606390474 with 0 changes -- --- Derek T. Yarnell --~--~-~--~~~---~--~~ 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: exec inside a function bombs and kills the puppetmaster
Jeff wrote: > newfunction(:mirror) do |args| > user = args[0] > host = args[1] > src = args[2] > dest = args[3] > cmd = "/usr/bin/rsync -vaz --delete --delete-during --rsh=\"ssh - > i /var/puppet/.ssh/" + > user +" -l " + user +"\" " + src + " " + host + ":" + dest > exec(cmd) You might want to sanitize those parameters before blindly passing them to a shell. -scott -- sc...@ohlol.net http://github.com/ohlol --~--~-~--~~~---~--~~ 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: custom definitions require and +>
robert.gstoehl wrote: > I'm trying to get the dependencies right: > > define wget($source, $options = "", $unless = "") { > include pkg::virtual_packages > realize (Package["wget"]) > exec {"wget $options -O $title $source": > path=> "/usr/bin:/opt/csw/bin", > unless => "$unless", > timeout => 18000, > require => Package["wget"] > } > > if $require { > Exec ["wget $options -O $title $source"]{ > require +> $require > } > } > } > > Bombs with: > > err: Could not retrieve configuration: Parameter 'require' is already > set on Exec[wget -O ... ] by wget at /etc/opt/csw/puppet/ > manifests/definitions/wget.pp:8; cannot redefine at /etc/opt/csw/ > puppet/manifests/definitions/wget.pp:14 > > The docs say: > > Note that all defined types support automatically all metaparameters. > Therefore you can pass any later used parameters like $require to a > define, without any definition of it: > > define svn_repo($path) { > exec {"create_repo_${name}": > command => "/usr/bin/svnadmin create $path/$title", > unless => "/bin/test -d $path", > } > if $require { > Exec["create_repo_${name}"]{ > require +> $require, > } > } > } > > What am I doing wrong? Is there another way to add the require > metaparameter to the nested exec resource? "+>" is only valid when inheriting resources. Instead do this: > define wget($source, $options = "", $unless = "") { > include pkg::virtual_packages > realize (Package["wget"]) > exec {"wget $options -O $title $source": > path=> "/usr/bin:/opt/csw/bin", > unless => "$unless", > timeout => 18000, > } > > if $require { > Exec ["wget $options -O $title $source"]{ > require => [ Package["wget"], $require ] > } > } else { > Exec ["wget $options -O $title $source"]{ > require => [ Package["wget"] ] > } > } > } Regards, DavidS --~--~-~--~~~---~--~~ 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: exec inside a function bombs and kills the puppetmaster
Jeff wrote: > I'm trying to use the puppetmaster to mirror directories. Here's my > function: [...] > cmd = "/usr/bin/rsync -vaz --delete --delete-during --rsh=\"ssh - > i /var/puppet/.ssh/" + > user +" -l " + user +"\" " + src + " " + host + ":" + dest > exec(cmd) > end > end > > This seems pretty straight-forward but the first time I hit this > function, the puppetmaster dies and leaves no traces in the logs for > troubleshooting the problem. I tested the rsync command and it works > fine. Any ideas? That's pretty much expected behaviour if you understand what exec() does. From http://www.ruby-doc.org/core/classes/Kernel.html#M005968 : Replaces the current process by running the given external command. I suspect that what you were really looking for was the system() function. Although doing mirroring in the Puppet *master* doesn't seem like a particularly good idea at all. Why do you want to do that? Isn't it better to do that in the client (possibly the client running on the same machine as the master, but still in the client)? > BTW: If there's an easier way to synchronize directories, I'm open to > using it. The problem I've had in puppet is removing files from dest > if they're removed in the source directory. If the source directory resides on the Puppet master, or on the same machine as the destination and where you are running puppetd, you can do it using the normal file type. If it resides on a different machine, the following definition might help you: # Mirror a directory tree using rsync. define rsync_mirror($source, $target, $sshkey="", $unless="", $onlyif="", $creates="", $month="1-12", $monthday="1-31", $weekday="0-7", $hour="", $minute="", $ensure="present" ) { if $sshkey { $sshcmd = "ssh -i$sshkey" } else { $sshcmd = "ssh" } $rsynccmd = "rsync -aRqv --no-implied-dirs --delete --delete-excluded" $command = "RSYNC_RSH=\"$sshcmd\" $rsynccmd '$source' '$target'" case $ensure { "present": { exec { "$rsynccmd '$source' '$target'": path => "/bin:/usr/bin", unless => $unless ? { "" => undef, default => $unless }, onlyif => $onlyif ? { "" => undef, default => $onlyif }, creates => $creates ? { "" => undef, default => $creates }; } if $hour { cron { "mirror--$title": command => "PATH=/bin:/usr/bin; $command", user => "root", month => $month, monthday => $monthday, weekday => $weekday, hour => $hour, minute => $minute; } } } "absent": { tidy { $target: recurse => true, rmdirs => true, size => 0, backup => false ; } cron { "mirror--$title": command => "PATH=/bin:/usr/bin; $command", ensure => absent; } } default: { fail("Bad rsync_mirror parameter ensure: $ensure") } } } This does an rsync directly, and optionally creates a cron job that continues doing the rsync regularly. That way you don't need to tie up your normal Puppet runs with the rsync, only the first time. Use it something like this: rsync_mirror { centos-5-x86_64: source => "rsync://my.centos.mirror/CentOS/5/os/x86_64/./", target => "/var/cache/mirrors/centos-5.x86_64/", creates => "/var/cache/mirrors/centos-5.x86_64/images/README", hour => 2, minute => 10; } The month, monthday, weekday, hour and minute parameters control the cron job. The creates, unless and onlyif parameters control if Puppet should run rsync immediately, exactly like the exec type. /Bellman --~--~-~--~~~---~--~~ 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] custom definitions require and +>
I'm trying to get the dependencies right: define wget($source, $options = "", $unless = "") { include pkg::virtual_packages realize (Package["wget"]) exec {"wget $options -O $title $source": path=> "/usr/bin:/opt/csw/bin", unless => "$unless", timeout => 18000, require => Package["wget"] } if $require { Exec ["wget $options -O $title $source"]{ require +> $require } } } Bombs with: err: Could not retrieve configuration: Parameter 'require' is already set on Exec[wget -O ... ] by wget at /etc/opt/csw/puppet/ manifests/definitions/wget.pp:8; cannot redefine at /etc/opt/csw/ puppet/manifests/definitions/wget.pp:14 The docs say: Note that all defined types support automatically all metaparameters. Therefore you can pass any later used parameters like $require to a define, without any definition of it: define svn_repo($path) { exec {"create_repo_${name}": command => "/usr/bin/svnadmin create $path/$title", unless => "/bin/test -d $path", } if $require { Exec["create_repo_${name}"]{ require +> $require, } } } What am I doing wrong? Is there another way to add the require metaparameter to the nested exec resource? Regards Robert --~--~-~--~~~---~--~~ 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] exec inside a function bombs and kills the puppetmaster
I'm trying to use the puppetmaster to mirror directories. Here's my function: module Puppet::Parser::Functions ##++ ## function: mirror ## arg[0]user - the login name and corresponding key ## arg[1]host - remote host ## arg[2]: src - local directory ## arg[3]: dest - remote directory ## returns: void ##-- newfunction(:mirror) do |args| user = args[0] host = args[1] src = args[2] dest = args[3] cmd = "/usr/bin/rsync -vaz --delete --delete-during --rsh=\"ssh - i /var/puppet/.ssh/" + user +" -l " + user +"\" " + src + " " + host + ":" + dest exec(cmd) end end This seems pretty straight-forward but the first time I hit this function, the puppetmaster dies and leaves no traces in the logs for troubleshooting the problem. I tested the rsync command and it works fine. Any ideas? BTW: If there's an easier way to synchronize directories, I'm open to using it. The problem I've had in puppet is removing files from dest if they're removed in the source directory. --~--~-~--~~~---~--~~ 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] Fwd: using noops from puppetrun
-- Forwarded message -- From: Dan Bode Date: Fri, Jul 10, 2009 at 3:49 PM Subject: using noops from puppetrun To: puppet-users@googlegroups.com Hi All, I was surprised to notice that a call to noop from puppetrun did not work as expected. on the agent side (for this case the server side..), I ran: puppetd --verbose --no-daemonize (where listen is set in the puppet.conf) on the puppet server side(in this case the client side), I ran: puppetrun --noop --host SERVER notice: SERVER(IP) triggered run info: Caching catalog at /var/lib/puppet-agent//localconfig.yaml notice: Starting catalog run notice: //Node[SERVER]/test/Exec[echo "This is the Test Class"]/returns: executed successfully notice: //Node[SERVER]/base/puppet/File[/etc/puppet/puppet.conf]: Filebucketed to main with sum fe274facc165e952f32848c8798306a9 notice: //Node[SERVER]/base/puppet/File[/etc/puppet/puppet.conf]/content: content changed '{md5}fe274facc165e952f32848c8798306a9' to '{md5}dcab80e2b06f2e7bded875a7efd5cea6' info: //Node[SERVER]/base/puppet/File[/etc/puppet/puppet.conf]: Scheduling refresh of Service[puppet] notice: //Node[SERVER]/base/puppet/Service[puppet]: Triggering 'refresh' from 1 dependencies notice: Caught TERM; shutting down notice: Shutting down Killed (as a sidenote, puppetd dies in this case) So, the question is, where exactly is the noop option valid? puppetd command line puppetd conf from any resource object? can it be set anywhere on the puppetmasterd settings? Here is the use case that I am working with. I would like to be able to run all puppet agents in noop mode when there is new puppet code deployed. I would like to this action to be controlled from a central location. Any suggestions are appreciated. regards, Dan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---