Hi,
I am trying to add multiple users onto my client, using array.
My code snippet is like this :
node example_node {
$arr=["abc","xyz",]
user{$arr:
ensure => present,
gid => root,
home => "/home/$arr",
shell => "/bin/bash",
managehome => ''true'',
}
}
It creates 2 new users named "abc" and "xyz" , but only one
home
directory is created i.e /home/abcxyz
How shall i create, individual directories.
How to access individual array content in, home=> "/home/$arr/ " ??
Regards,
Parag
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Try home => "/home/${name}"
this should give you the name of the current ressource
Zitat von "parag(PK)" <myselfpk.07@gmail.com>:
> Hi,
>
> I am trying to add multiple users onto my client, using array.
> My code snippet is like this :
>
> node example_node {
> $arr=["abc","xyz",]
>
> user{$arr:
> ensure => present,
> gid => root,
> home => "/home/$arr",
> shell => "/bin/bash",
> managehome => ''true'',
> }
>
> }
>
> It creates 2 new users named "abc" and "xyz" , but
only one home
> directory is created i.e /home/abcxyz
> How shall i create, individual directories.
> How to access individual array content in, home=> "/home/$arr/
" ??
>
> Regards,
> Parag
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
----------------------------------------------------------------
Powered by http://www.taunusstein.net
Wir speichern nicht
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
parag(PK) a écrit :> Hi, > > I am trying to add multiple users onto my client, using array. > My code snippet is like this : > > node example_node { > $arr=["abc","xyz",] > > user{$arr: > ensure => present, > gid => root, > home => "/home/$arr", > shell => "/bin/bash", > managehome => ''true'', > } > > } > > It creates 2 new users named "abc" and "xyz" , but only one home > directory is created i.e /home/abcxyz > How shall i create, individual directories. > How to access individual array content in, home=> "/home/$arr/ " ??If i replace $arr by you array (which is what puppet does) What you''ve written here means: user{["abc", "xyz"]: ensure => present, gid => root, home => "/home/abcxyz", shell => "/bin/bash", managehome => ''true'', } which means: user{"abc": ensure => present, gid => root, home => "/home/abcxyz", shell => "/bin/bash", managehome => ''true''; "xyz": ensure => present, gid => root, home => "/home/abcxyz", shell => "/bin/bash", managehome => ''true'', } So you are declaring 2 users with the same home dir. Maybe you can use $name instead of $arr in the home value, but I''m not sure of this... -- Aurelien Degremont CEA -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mon, Aug 23, 2010 at 9:47 AM, parag(PK) <myselfpk.07@gmail.com> wrote:> Hi, > > I am trying to add multiple users onto my client, using array. > My code snippet is like this : > > node example_node { > $arr=["abc","xyz",] > > user{$arr: > ensure => present, > gid => root, > home => "/home/$arr", > shell => "/bin/bash", > managehome => ''true'', > } >What about using a definition, something like.... (untested)... define shell_user { user { "$name": ensure => present, gid => root, shell => "/bin/bash", managehome => true, home => "/home/$name", } } shell_user{ $arr } ? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Craig Dunn <lists@codenation.net> writes:> On Mon, Aug 23, 2010 at 9:47 AM, parag(PK) <myselfpk.07@gmail.com> wrote: >> >> I am trying to add multiple users onto my client, using array. My code >> snippet is like this :[...]> What about using a definition, something like.... (untested)...Other than the trivial syntax errors, this is the technique that I use to work around array expansion limitations in puppet when I have a similar requirement. I don''t know of any better approach. Daniel> > define shell_user { > user { "$name": > ensure => present, > gid => root, > shell => "/bin/bash", > managehome => true, > home => "/home/$name", > } > } > > shell_user{ $arr } > ?-- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.