Hi,

I am reasonably sure using a - in a variable name doesn't work or does
strange things.
I would suggest trying naming the ssh_authorized_key resource for the git
key to "${title}_git" like so

            ssh_authorized_key { ${title}_git:
                ensure  => 'present',
                user    =>  git,
                type    => $keytype,
                key     => $sshkey,
            }

I can't see a var for title-git anywhere else in your define but if you do
you will need to rename it without the -
Hope that helps.

Pete.


On 2 February 2013 10:22, Jamie <gojamieg...@gmail.com> wrote:

> I would like some help trying to accomplish something.  I have a user
> define as shown in the first example.  Each user with an SSH key needs 2 of
> them though, one as a normal login key, and the other is the same key but
> is for the "git" user (all ssh git access done via this "git" user).  Is
> there a way to do this in the same define?  I'm thinking something along
> the lines of example 2, but the concatenation doesn't seem to work.
>
> Example 1
> <code>
> class user::shell_acct {
>     define acct
> ($name,$uid,$password='!!',$groups='',$shell='/bin/bash',$sshkey='',$keytype='dsa')
> {
>         user { $title:
>             comment    => $name,
>             ensure     => 'present',
>             uid        => $uid,
>             gid        => $uid,
>             managehome => 'true',
>             home       => "/home/$title",
>             shell      => $shell,
>             membership => 'inclusive',
>             groups     => $groups,
>             password   => $password,
>         }
>         group { $title:
>             ensure => 'present',
>             gid    => $uid,
>         }
>         if ( $sshkey != "" ) {
>             # login key
>             ssh_authorized_key { $title:
>                 ensure  => 'present',
>                 user    =>  $title,
>                 type    => $keytype,
>                 key     => $sshkey,
>             }
>         }
>     }
> }
> </code>
>
> *Example 2*
> <code>
>         if ( $sshkey != "" ) {
>             # login key
>             ssh_authorized_key { $title:
>                 ensure  => 'present',
>                 user    =>  $title,
>                 type    => $keytype,
>                 key     => $sshkey,
>             }
>             # git key
>             ssh_authorized_key { $title-git:
>                 ensure  => 'present',
>                 user    =>  git,
>                 type    => $keytype,
>                 key     => $sshkey,
>             }
>         }
> </code>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to