[Puppet Users] possible bug with notify?

Larry Ludwig
Mon, 26 May 2008 19:00:12 -0000

Hi I''ve created a puppet recipe that seems to not restart sshd when
it''s defined.  What we are trying to do is restart sshd when we add
and "AllowUsers USERNAME" to sshd_config file.  It doesn''t
restart
sshd.

I''ve included only the code question...  line type is one available in
the wiki.

define sysadmin_create ($comment,$password,$shell="/bin/bash") {
        group { "${title}":
                ensure     => present,
        }
        user { "${title}":
                name       => "${title}",
                gid        => "${title}",
                ensure     => present,
                comment    => "${comment}",
                home       => "/home/${title}",
                managehome => true,
                password   => "${password}",
                shell      => "${shell}",
                require    => Group["${title}"],
        }
        line { "sshd_config_AllowUsers-${title}":
                file    => "/etc/ssh/sshd_config",
                line    => "AllowUsers ${title}",
                ensure  => present,
                require => [Class["openssh-server"], User["$
{title}"] ],
                notify  => Service["sshd"],
        }
}

class accounts {
        @sysadmin_create { "test":
                comment  => "Test User",
                password => ''HIDDEN'',
        }
}

In the node I have:

realize(Sysadmin_create["test"])

Service["sshd"] exists in another module and is:

        # make sure sshd is setup to run
        service { "sshd":
                name       => "sshd",
                ensure     => running,
                enable     => true,
                require    => Package["openssh-server"],
                subscribe  => Package["openssh-server"],
        }


While it creates the entry in sshd_config it does not restart the
sshd??  Only this line appears:

May 26 14:07:05 devcentos46 puppetd[12976]: (//Node[servername]/
accounts/Sysadmin_create[test]/Line[sshd_config_AllowUsers-test]/Exec[/
bin/echo ''AllowUsers test'' >>
''/etc/ssh/sshd_config'']/returns)
executed successfully

No errors or any other issue that I can determine.  It appears to not
execute.