Re: [Puppet Users] Problems with starting service

299 views
Skip to first unread message

Gary Larizza

unread,
Mar 15, 2012, 4:51:44 PM3/15/12
to puppet...@googlegroups.com
Are you trying to start 'ssh' or 'sshd' as a service ( you have $ssh_service_name = 'ssh' in your params class)?


On Fri, Mar 16, 2012 at 12:23 AM, Luis Festas Matos <luf...@gmail.com> wrote:
Hi all, I've been following the Puppet Pro book and trying to do a configuration of a ssh module like it's told in the book. I'm on Ubuntu 10.10.

The files I have are the following:

on /etc/puppet/modules/ssh/manifests I have the config.pp  init.pp  install.pp  params.pp  service.pp files

they're quite small so I'm including them in the end of the post.

The problem that is happening is that if I stop the ssh service manually (i.e. with service ssh stop), I would like to see puppet starting the service again.
What I do is: stop the service, run the puppet client and wait. Nothing happens. I see puppet doing other things but it doesn't do anything with the ssh service.
Here's the relevant part of the client log. It runs with no errors.
debug: /Stage[main]/Ssh::Service/Service[ssh]/require: requires Class[Ssh::Config]
debug: /Stage[main]/Ssh::Config/File[/etc/ssh/sshd_config]/require: requires Class[Ssh::Install]
debug: /Stage[main]/Ssh::Config/File[/etc/ssh/sshd_config]/notify: subscribes to Class[Ssh::Service]

So I see that it recognizes my module, but it won't start the ssh service when I turn it down. Any help would be appreciated.





file init.pp

class ssh {
include ssh::params, ssh::install, ssh::config, ssh::service
}

file params.pp
class ssh::params {
  case $operatingsystem {
     ...
    /(Ubuntu|Debian)/: {
      $ssh_package_name = 'openssh-server'
      $ssh_service_config = '/etc/ssh/sshd_config'
      $ssh_service_name = 'ssh'
    }
  }
}

file install.pp
class ssh::install {
  package { $ssh::params::ssh_package_name:
     ensure => present,
  }
}

file config.pp

class ssh::config {
  file { $ssh::params::ssh_service_config:
    ensure => present,
    owner => 'root',
    group => 'root',
    mode  => 0644,
    source => "puppet:///modules/ssh/sshd_config",
    require => Class["ssh::install"],
    notify => Class["ssh::service"],
  }
}

file service.pp

class ssh::service {
  service { $ssh::params::ssh_service_name:
    ensure => running,
    hasstatus => true,
    hasrestart => true,
    enable => true,
    require => Class["ssh::config"]
  }
}

--
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/-/Ruv4rv8TAgQJ.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.



--

Gary Larizza
Professional Services Engineer
Puppet Labs

Luis Festas Matos

unread,
Mar 16, 2012, 5:09:25 AM3/16/12
to puppet...@googlegroups.com
Hi Gary,

I'm trying to start sshd. But the command to start sshd is "service ssh start" at least on the prompt line.
If I change it to 'sshd' on the params class it gives me the following error:

err: /Stage[main]/Ssh::Service/Service[sshd]: Could not evaluate: Could not find init script for 'sshd'

No matter if sshd is working or not, with 'ssh' on the params class nothing happens. The running sshd service has the following ps -ef :

root     27607     1  0 20:53 ?        00:00:00 /usr/sbin/sshd -D

Thanks for your help :)

Gary Larizza

unread,
Mar 16, 2012, 5:35:14 AM3/16/12
to puppet...@googlegroups.com
Yep, 

Forgot that Ubuntu uses 'ssh' whereas CentOS uses 'sshd'. 

Have you seen this bug --> https://projects.puppetlabs.com/issues/12773  May be appropriate here.

-Gary

--
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/-/tRrPcv1mZIIJ.

To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Dennis Gearon

unread,
Jun 5, 2014, 9:47:29 PM6/5/14
to puppet...@googlegroups.com
I tried EVERY possible version to restart ssh(d) on Ubuntu, Service, Upstart, init.d.

I could not get any of them to acknowledge that there was an ssh daemon. But SSH works, and changes to /etc/ssh/ssh_config have effect.

Weird.

jcbollinger

unread,
Jun 9, 2014, 9:24:18 AM6/9/14
to puppet...@googlegroups.com


On Friday, March 16, 2012 4:09:25 AM UTC-5, Luis Festas Matos wrote:
Hi Gary,

I'm trying to start sshd. But the command to start sshd is "service ssh start" at least on the prompt line.
If I change it to 'sshd' on the params class it gives me the following error:

err: /Stage[main]/Ssh::Service/Service[sshd]: Could not evaluate: Could not find init script for 'sshd'



This conversation has somehow not been properly threaded together.  I see a quote of the original question, but not the original question itself, so please forgive me if I'm missing something.  Perhaps it did not actually start on the group?

Anyway, the error message indicates that the module thinks the appropriate service name is 'sshd', whereas it should be 'ssh' on Ubuntu.  That this is not about the name of the daemon executable; rather, it is about the name used with the system's service management tools.  And note, too, that you should not need to specify which service management toolset to use (the "provider") -- Puppet is very good at figuring that out for itself.

If the quoted code matches the manifests involved in producing that error message, then it must be that $ssh::params::ssh_service_name is not being assigned the correct value.  That, in turn, suggests that either the value of the $operatingsystem fact the node submits to Puppet does not match the regex /(Ubuntu|Debian)/, or perhaps that it (also) matches another case listed earlier in that 'case' statement.

You can run facter directly on the node, from the command line, to determine what 'operatingsystem' value it is reporting.  You can put a Notify resource in class ssh:params to verify that $operatingsystem resolves to the expected value when evaluated in that context (and you could make that more certain by spelling it $::operatingsystem).  You can run the agent with --debug messaging enabled to see the actual commands puppet issues to try to test and start the service.


John

Reply all
Reply to author
Forward
0 new messages