[Puppet Users] ssh_authorized_key runs every time

mark risher
Thu, 24 Feb 2011 01:43:53 -0000

Hi:

I have a defined type "useraccount" that constructs a user and
user''s
group, then installs his ssh key. This looks something like the
snippet below.

The problem I''m seeing is, every time I run the puppet client, it
appends that same ssh key to ~/.ssh/authorized_keys, so at the end of
three runs I have three copies of the same key in the file.

Is there a workaround? Maybe something with subscribe or refreshonly?
Am I using the resource incorrectly?

Thank you,
/m


# /etc/puppet/modules/user/init.pp

define useraccount ($uid, $username) {
   user { $username:
       ensure => present,
       ...
   }

   group { ... }

   ssh_authorized_key { $username:
       ensure => present,
       key => "abcdefghijklmnop_very_long_string",
   }
}