Hello, I want a simple operation in a puppet node like restarting the ssh service if it was stopped. My site.pp is simple as this: import "services/*" node default { include ssh } The services directory as a ssh.pp : class ssh { service { ssh: ensure => running, subscribe => File["/etc/ssh/sshd_config"] } } I''ve stopped the ssh service in the node client. After a while the service wasn''t started in the client by the puppetmaster server. All the certifications and communications were already set with the node client and server. I''m using Debian Etch with Puppet and Puppetmaster 0.20.1-1 installed from .deb. My ruby version is 1.8.5. Any idea why client''s ssh isn''t restarting? Thanks.
I can vaguely remember there being trouble with restarting services in older versions of puppet. So I''d think the first thing to do is get a more recent version of puppet. I think 0.22.4 is generally regarded as being the minimum version these days. 0.23 and higher offer quite a number of small advancements and bug-fixes that it might be worth your while to go the extra step and get 0.23.2 Thijs On 24/08/07, Pedro Simões <pedro.a.simoes@gmail.com> wrote:> Hello, > > I want a simple operation in a puppet node like restarting the ssh > service if it was stopped. My site.pp is simple as this: > > import "services/*" > > node default { > include ssh > } > > The services directory as a ssh.pp : > > class ssh { > service { ssh: > ensure => running, > subscribe => File["/etc/ssh/sshd_config"] > } > } > > I''ve stopped the ssh service in the node client. After a while the > service wasn''t started in the client by the puppetmaster server. > > All the certifications and communications were already set with the > node client and server. > > I''m using Debian Etch with Puppet and Puppetmaster 0.20.1-1 installed > from .deb. My ruby version is 1.8.5. > > Any idea why client''s ssh isn''t restarting? > > Thanks. > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >
Juri Rischel Jensen
2007-Aug-24 13:34 UTC
Re: Problem restarting client service ssh in client
On Aug 24, 2007, at 15:00, Pedro Simões wrote:> Any idea why client''s ssh isn''t restarting?I think you need "pattern => "sshd" added to your service statement so puppet knows what to look for in the processlist... -- Med venlig hilsen Juri Rischel Jensen Fab:IT ApS Vesterbrogade 50 DK-1620 København Tlf: 70 202 407 / Fax: 33 313 640 www.fab-it.dk / juri@fab-it.dk
On Aug 24, 2007, at 8:34 AM, Juri Rischel Jensen wrote:> I think you need "pattern => "sshd" added to your service statement > so puppet knows what to look for in the processlist...Actually, the preferred method is to use ''hasrestart'' and ''hasstatus'' to tell puppet that your init script has both, if it does. If it doesn''t, please file a bug against your init script and then use the pattern (which defaults to the service name). -- Risk! Risk anything! Care no more for the opinions of others, for those voices. Do the hardest thing on earth for you. Act for yourself. Face the truth. -- Katherine Mansfield --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
I''ve run puppet -v in client and it gives me this error: err: Could not apply complete configuration: Could not retrieve dependency ''File[/etc/ssh/sshd_config]'' at /etc/puppet/manifests/services/ssh.pp:11 I''m already using puppet and puppetmaster 0.23.2 version. Any ideas? On 8/24/07, puppet-users-request@madstop.com <puppet-users-request@madstop.com> wrote:> Send Puppet-users mailing list submissions to > puppet-users@madstop.com > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.madstop.com/mailman/listinfo/puppet-users > or, via email, send a message with subject or body ''help'' to > puppet-users-request@madstop.com > > You can reach the person managing the list at > puppet-users-owner@madstop.com > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Puppet-users digest..." > > Today''s Topics: > > 1. Re: Aliases not working in a subclass ? (Francois Deppierraz) > 2. Re: Aliases not working in a subclass ? (Thijs Oppermann) > 3. Re: Aliases not working in a subclass ? (Luke Kanies) > 4. Re: Problem restarting client service ssh in client (Luke Kanies) > 5. Amazon S3 recipes (Brad Dixon) > 6. Variable scope: Class inheritance vs Include statement. > (Andrew Glen-Young) > 7. Re: Can I do this in a template..? (Luke Kanies) > 8. Re: Can I do this in a template..? (Simon M?gge) > 9. Re: Problem with adding custom facts (Luke Kanies) > 10. Re: Can I do this in a template..? (Luke Kanies) > 11. Re: Variable scope: Class inheritance vs Include statement. > (Luke Kanies) > 12. Re: Can I do this in a template..? (Simon M?gge) > > > ---------- Forwarded message ---------- > From: Francois Deppierraz <francois@ctrlaltdel.ch> > To: Puppet User Discussion <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 16:02:23 +0200 > Subject: Re: [Puppet-users] Aliases not working in a subclass ? > Thijs Oppermann wrote: > > > I get a different error (about not being able to redefine within the > > same scope), but at least it finds the file resource. So try to work > > around it like that first. And see if Luke (or someone else) has any > > good ideas about what''s going on. > > Right, this workaround works. A bug report was filed as #790. > > > class module::base { > file {"test-module": > path => "/tmp/test-module", > alias => test-module, > content => "module::base", > } > } > class module::specific inherits module::base { > File["test-module"] { > content => "module::specific", > } > } > include module::specific > > > > ---------- Forwarded message ---------- > From: "Thijs Oppermann" <thijso+puppet@gmail.com> > To: "Puppet User Discussion" <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 16:20:10 +0200 > Subject: Re: [Puppet-users] Aliases not working in a subclass ? > Reading this: > > http://reductivelabs.com/trac/puppet/wiki/TypeReference#available-metaparameters > > I think this might be a known thing, and not necessarily a (real) bug. > It looks like the way you''re trying to use alias here is not how it > was meant to be used. > > Thijs > > On 24/08/07, Francois Deppierraz <francois@ctrlaltdel.ch> wrote: > > Thijs Oppermann wrote: > > > > > I get a different error (about not being able to redefine within the > > > same scope), but at least it finds the file resource. So try to work > > > around it like that first. And see if Luke (or someone else) has any > > > good ideas about what''s going on. > > > > Right, this workaround works. A bug report was filed as #790. > > > > > > class module::base { > > file {"test-module": > > path => "/tmp/test-module", > > alias => test-module, > > content => "module::base", > > } > > } > > class module::specific inherits module::base { > > File["test-module"] { > > content => "module::specific", > > } > > } > > include module::specific > > _______________________________________________ > > Puppet-users mailing list > > Puppet-users@madstop.com > > https://mail.madstop.com/mailman/listinfo/puppet-users > > > > > > ---------- Forwarded message ---------- > From: Luke Kanies <luke@madstop.com> > To: Puppet User Discussion <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 09:56:37 -0500 > Subject: Re: [Puppet-users] Aliases not working in a subclass ? > On Aug 24, 2007, at 8:03 AM, Francois Deppierraz wrote: > > > My guess is that the "File[xxx] { }" construct is not correctly taking > > the aliases into account. > > Exactly. It''s got nothing to do with being in a class or whatever. > > The ''alias'' metaparam is only used on the client, which means that > the parser doesn''t know anything about it. I can''t decide if this is > a bug or not, considering that you''ve already got the ability to > easily have two names for your resource (the name and title). > > In retrospect, though, it might make more sense to get rid of this > whole name/title split and just stick to aliases as the means of > providing multiple names. Hmm. I never thought of that. Hrm. > > /me swoons > > -- > Nature and nature''s laws lay hid in night, > God said, "Let Newton be," and all was light. > > It did not last; the devil howling "Ho! > Let Einstein be!" restored the status quo. > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > > > ---------- Forwarded message ---------- > From: Luke Kanies <luke@madstop.com> > To: Puppet User Discussion <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 09:59:36 -0500 > Subject: Re: [Puppet-users] Problem restarting client service ssh in client > On Aug 24, 2007, at 8:34 AM, Juri Rischel Jensen wrote: > > > I think you need "pattern => "sshd" added to your service statement > > so puppet knows what to look for in the processlist... > > Actually, the preferred method is to use ''hasrestart'' and ''hasstatus'' > to tell puppet that your init script has both, if it does. If it > doesn''t, please file a bug against your init script and then use the > pattern (which defaults to the service name). > > -- > Risk! Risk anything! Care no more for the opinions of others, for > those > voices. Do the hardest thing on earth for you. Act for yourself. Face > the truth. -- Katherine Mansfield > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > > > ---------- Forwarded message ---------- > From: "Brad Dixon" <rbdixon@gmail.com> > To: "Puppet User Discussion" <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 11:07:15 -0400 > Subject: [Puppet-users] Amazon S3 recipes > Hello: > > This is the result of some recent work on managing Amazon EC2 clusters > using puppet. > > http://reductivelabs.com/trac/puppet/wiki/AmazonWebServiceRecipes > > I''m a rookie so any coaching is appreciated. > > Thanks, > > Brad > > > > ---------- Forwarded message ---------- > From: "Andrew Glen-Young" <aglenyoung@gmail.com> > To: puppet-users@madstop.com > Date: Fri, 24 Aug 2007 16:16:18 +0100 > Subject: [Puppet-users] Variable scope: Class inheritance vs Include statement. > Hello. > > I''m a long time cfengine user, some might say sufferer, and I have > finally managed to get around to experimenting with Puppet. So far I''m > very impressed. > > I am trying to get puppet to configure the openntpd config file, from > an ERB template, based on the node definition in the site config. > > What I''m trying to understand is why when I define a variable in a > child class, the variable does not seem to be evaluated correctly in a > ERB template that is defined in the parent class. If instead of > inheriting the parent class, I use an "include" statement, then the > variable is evaluated correctly. My puppet configs and templates are > listed below. > > As I understand it, Puppet variables are evaluated where the code is executed. > I assume that this is a lack of understanding on my part and any > clarification would help greatly. > > Possibly there is a even better way of doing this and my cfengine > knowledge is coming back to bite me? > > My puppet config: > > Puppet version: 0.23.2 > > /etc/puppet/manifests/classes/ntp.pp: > > # My ''parent'' class. > class ntp { > file { > "/etc/openntpd/ntpd.conf": > owner => "root", > group => "root", > mode => 644, > content => template("/etc/puppet/templates/apps/openntpd/ntpd.conf.erb") > } > } > > # This works. > class ntp_server { > $ntp_class = "ntp_server" > include ntp > } > > # Why does this NOT work? > # class ntp_server inherits ntp { > # $ntp_class = "ntp_server" > # } > > class ntp_client { > # Could also possibly read: $ntp_class = $name > $ntp_class = "ntp_client" > include ntp > } > > /etc/puppet/templates/apps/openntpd/ntpd.conf.erb: > > <% if ntp_class == "ntp_server" -%> > listen on * > servers pool.ntp.org > <% elsif ntp_class == "ntp_client" -%> > server ntp.mydom.ain > <% end -%> > > /etc/puppet/manifests/site.pp: > > import "classes/*.pp" > > node default { > include ntp_server > } > > -- > Regards. > Andrew Glen-Young > > > > ---------- Forwarded message ---------- > From: Luke Kanies <luke@madstop.com> > To: Puppet User Discussion <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 10:17:03 -0500 > Subject: Re: [Puppet-users] Can I do this in a template..? > On Aug 24, 2007, at 6:57 AM, Juri Rischel Jensen wrote: > > > <% if name.include? "foofile" -%> > > This is foofile > > <% else -%> > > This is barfile > > <% end -%> > > > > I''m not a big ruby hacker - yet ;-) I know that I can test the > > contents of a variable with "variablename.include?". But can I access > > the "name" of the calling file...? > > That won''t work, because I don''t currently set the file name in a > variable available in the template. > > Just set a variable specially in each class before you call the > template. > > -- > Yesterday upon the stair > I met a man who wasn''t there. > He wasn''t there again today -- > I think he''s from the CIA. > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > > > ---------- Forwarded message ---------- > From: Simon Mügge <simu@webde.de> > To: Puppet User Discussion <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 17:20:09 +0200 > Subject: Re: [Puppet-users] Can I do this in a template..? > Luke Kanies schrieb: > > On Aug 24, 2007, at 6:57 AM, Juri Rischel Jensen wrote: > > > > > >> <% if name.include? "foofile" -%> > >> This is foofile > >> <% else -%> > >> This is barfile > >> <% end -%> > >> > >> I''m not a big ruby hacker - yet ;-) I know that I can test the > >> contents of a variable with "variablename.include?". But can I access > >> the "name" of the calling file...? > >> > > > > That won''t work, because I don''t currently set the file name in a > > variable available in the template. > > > Are type-parameters and their values at all accessible as a variable at > this moment? > > Just set a variable specially in each class before you call the > > template. > > > > -- > > Yesterday upon the stair > > I met a man who wasn''t there. > > He wasn''t there again today -- > > I think he''s from the CIA. > > --------------------------------------------------------------------- > > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > > > _______________________________________________ > > Puppet-users mailing list > > Puppet-users@madstop.com > > https://mail.madstop.com/mailman/listinfo/puppet-users > > > > > > > ---------- Forwarded message ---------- > From: Luke Kanies <luke@madstop.com> > To: Puppet User Discussion <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 10:34:36 -0500 > Subject: Re: [Puppet-users] Problem with adding custom facts > On Aug 23, 2007, at 5:59 PM, Lars Staun Knudsen wrote: > > > The notify didn''t gave any output. So I tried echo the variable into > > a file and it worked. I always assumed that puppetd relied on facter > > to inform sysinfo on and , and facter still can''t output the custom > > facts. Why does that? Not that it matter, I''m just curious... > > If the notify didn''t give any output at all, then you''ve got some > other problem, because at the least it should print something. > > I don''t really know what you mean by sysinfo in this case. > > -- > Today I dialed a wrong number...The other person said, "Hello?" and > I said, "Hello, could I speak to Joey?"... > They said, "Uh...I don''t think so...he''s only 2 months old." > I said, "I''ll wait." -- Steven Wright > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > > > ---------- Forwarded message ---------- > From: Luke Kanies <luke@madstop.com> > To: Puppet User Discussion <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 10:47:10 -0500 > Subject: Re: [Puppet-users] Can I do this in a template..? > On Aug 24, 2007, at 10:20 AM, Simon Mügge wrote: > > > Are type-parameters and their values at all accessible as a > > variable at > > this moment? > > Yes. > > -- > Life is like playing a violin in public and learning the instrument as > one goes on. -- Samuel Butler > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > > > ---------- Forwarded message ---------- > From: Luke Kanies <luke@madstop.com> > To: Puppet User Discussion <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 11:10:55 -0500 > Subject: Re: [Puppet-users] Variable scope: Class inheritance vs Include statement. > On Aug 24, 2007, at 10:16 AM, Andrew Glen-Young wrote: > > > I am trying to get puppet to configure the openntpd config file, from > > an ERB template, based on the node definition in the site config. > > Variables in subclasses cannot override variables in parent classes, > at least partially because I haven''t been able to find a way to make > that work. > > The answer is to model the thing using the variable as a resource, > and then you can override parameters in that resource in the subclass. > > -- > You don''t learn anything the second time you''re kicked by a mule. > -- Anonymous Texan > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > > > ---------- Forwarded message ---------- > From: Simon Mügge <simu@webde.de> > To: Puppet User Discussion <puppet-users@madstop.com> > Date: Fri, 24 Aug 2007 18:30:46 +0200 > Subject: Re: [Puppet-users] Can I do this in a template..? > Luke Kanies schrieb: > > On Aug 24, 2007, at 10:20 AM, Simon Mügge wrote: > > > > > >> Are type-parameters and their values at all accessible as a > >> variable at > >> this moment? > >> > > > > Yes. > > > Fair enough. > After loking through all 37 Pages that where returned when I searched > for "variable" in "Wiki" I seem to have to alter the question somewhat: > > How (as in "by what syntax") are type-parameters and their values > accessible as variables in templates and classes? > > -- > > Life is like playing a violin in public and learning the instrument as > > one goes on. -- Samuel Butler > > --------------------------------------------------------------------- > > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > > > _______________________________________________ > > Puppet-users mailing list > > Puppet-users@madstop.com > > https://mail.madstop.com/mailman/listinfo/puppet-users > > > > > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users > >
Pedro Simões wrote:> I''ve run puppet -v in client and it gives me this error: > > err: Could not apply complete configuration: Could not retrieve > dependency ''File[/etc/ssh/sshd_config]'' at > /etc/puppet/manifests/services/ssh.pp:11 > > I''m already using puppet and puppetmaster 0.23.2 version. Any ideas?Is /etc/ssh/sshd_config described anywhere in the manifests? I don''t think puppet can subscribe to a random unmanaged file on the filesystem, but I could be wrong.
On 24/08/07, Pedro Simões <pedro.a.simoes@gmail.com> wrote:> I''ve run puppet -v in client and it gives me this error: > > err: Could not apply complete configuration: Could not retrieve > dependency ''File[/etc/ssh/sshd_config]'' at > /etc/puppet/manifests/services/ssh.pp:11 > > I''m already using puppet and puppetmaster 0.23.2 version. Any ideas? > > >Please provide a bit more context for the files referenced when asking questions like this. In this case, show the lines/resources surrounding line 11 in /etc/puppet/manifests/services/ssh.p/etc/puppet/manifests/services/ssh.pp and any other resources you might think have an impact on the problem. In this case, puppet is looking for a file { "/etc/ssh/sshd_config": definitions somewhere. Do you have that? -- Thijs
I''ve used the ignorecache on client puppetd and things go well. But now, I restarted the puppetmaster with an added service on site.pp and the client is always saying that the config is up to date. I''ve removed the ignorecache on the client. I think the client is using local cache, the puppetmaster server isn''t receiving requests. Added service: # services/cron.pp service { cron: ensure => running } site.pp: ## site.pp import ''services/*'' node default { include ssh include ntp include syslog include cron } Ouput from "puppetmaster -v": (server) info: Starting server for Puppet version 0.23.2 info: Parsed manifest in 0.16 seconds info: Listening on port 8140 notice: Starting Puppet server version 0.23.2 Output from "puppetd -v": (client) notice: Starting Puppet client version 0.23.2 info: Config is up to date notice: Starting configuration run notice: Finished configuration run in 0.39 seconds Shouldn''t the changes be checked instead of using the local(client) cache?> ---------- Forwarded message ---------- > From: "Thijs Oppermann" <thijso+puppet@gmail.com> > To: "Puppet User Discussion" <puppet-users@madstop.com> > Date: Mon, 27 Aug 2007 11:52:01 +0200 > Subject: Re: [Puppet-users] Problem restarting client service ssh in client (Pedro Simoes) > On 27/08/07, Pedro Simões <pedro.a.simoes@gmail.com> wrote: > > Ok, the file definition was missing. Now i''ve put that: > > > > ## services/ssh.pp > > > > class ssh { > > file { sshd_config: > > name => "/etc/ssh/sshd_config" > > } > > > > service { ssh: > > name => $operatingsystem ? { > > Debian => ssh, > > default => sshd > > }, > > ensure => running, > > subscribe => File[sshd_config] > > } > > } > > > > I''ve added another service (syslog.pp): > > > > ## services/syslog.pp > > > > class syslog { > > file { syslog_conf: > > name => "/etc/syslog-ng/syslog-ng.conf" > > } > > > > service { syslog: > > name => syslog-ng, > > ensure => running, > > subscribe => File[syslog_conf] > > } > > } > > > > Now I''ve deleted the file, remove it from site.pp includes, restarted > > the puppetmaster and even removed it from the classes.txt on the > > client. Running the puppetd -v (on client), shows that it still reads > > the syslog.pp configuration. Is this normal? It''s cache? > > What information does the puppetmaster give you when you run it with > --verbose? At startup of puppetmaster itself, and when the client > connects to it? > > Thijs > > >