Got it to work like this:

$myuser = $identity['user']
$mygroup = $identity['group']

file { "/Users/${myuser}/Applications/mpbar/mpdbar.sh":
        ensure => 'file',
        owner => $myuser,
        group => $mygroup,
        mode => '0755',
        source => "puppet:///modules/mybarmodule/mpdbar.sh",
        backup => 'false',
}


On Tuesday, June 7, 2016 at 1:16:06 PM UTC-4, Luis Zuniga wrote:
>
> Hi,
>
> Wondering how to substitute the OS X username into the manifest document.
>
> Here are the details:
>
> *On the OS X client:*
>
> Username is user1
>
>
> *on the puppet server:*
>
> sites.pp file:
>
>
> file { "/Users/$identity['user']/Applications/mpbar/myscript.sh":
>         ensure => 'file',
>         owner => 'user1',
>         group => 'staff',
>         mode => '0755',
>         source => "puppet:///modules/mymodule/myscript.sh",
>         backup => 'false',
> }
>
>
> If I hard code 'user1' everything works but when I try to substitute the 
> username from the agent I get all the key pairs from identity and not just 
> the user name (user1):
>
> /Users/{gid => 20, group => staff, uid => 504, user => 
> user1}['user']/Applications/mpbar/myscript.sh
>
>
> I've tried $identity.user as well with no luck.
>
> Any advice on how I can get the local OS X username passed into the 
> sites.pp file so this works properly?
>
> Appreciate any help.
>
> Luis
>  
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/005954ee-8623-4777-8d1c-ab27c083a000%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to