service won't start as expected on ssh

48 views
Skip to first unread message

Luis Festas Matos

unread,
Mar 15, 2012, 9:47:22 AM3/15/12
to puppet...@googlegroups.com
Hi guys,

I'm new here, it's my first post. I did look the group but didn't find anything similar to mine so I'm posting my question here.

I'm trying to configure puppet on Ubuntu 10.10 to start a ssh service if the service is down. This is an exercise so I can 
understand how it works.

I start then the puppet client after all setup is done, the puppet client runs fine but the service is not started.

Here's my definition of the module:

5 files, 
init.pp, params.pp, install.pp, config.pp, service.pp on manifest, and a file on the files subdirectory.


THis is the relevant part of the log result:

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]

Other than this, nothing happens. If I manually shut down the ssh service with 'ssh service stop', running the puppet client
won't start it again, which was what I expected.

I really would appreciate some help to know what's wrong.


The contents are as such (also added as a tar.gz file):

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"]
  }
}


ssh-manifest.tar.gz
Reply all
Reply to author
Forward
0 new messages