Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd user to multiple groups with Puppet
    text
    copied!<p>I'm attempting to assign users to multiple groups with a manifest, but am running into walls.</p> <p><strong>Attempt 1:</strong> </p> <pre><code>class usergroup { group { "user_one": ensure =&gt; present, gid =&gt; 500, } group { "user_two": ensure =&gt; present, gid =&gt; 501, } group { "dev_site_one": ensure =&gt; present, gid =&gt; 502, } group { "dev_site_two": ensure =&gt; present, gid =&gt; 503, } group { "dev_site_three": ensure =&gt; present, gid =&gt; 504, } user { "user_one": ensure =&gt; present, uid =&gt; 500, gid =&gt; 500, gid =&gt; 502, gid =&gt; 503, gid =&gt; 504, } user { "user_two": ensure =&gt; present, uid =&gt; 501, gid =&gt; 501, } } </code></pre> <p>Running this: </p> <pre><code>puppet apply --noop ./init.pp </code></pre> <p>Yields: </p> <blockquote> <p>Error: Duplicate parameter 'gid' for on User[user_one] at /etc/puppet/modules/webserver/manifests/init.pp:159 on node my_web_server</p> </blockquote> <p><strong>Attempt 2:</strong> </p> <p>I tried to break out each gid declaration like so: </p> <pre><code>class usergroup { group { "user_one": ensure =&gt; present, gid =&gt; 500, } group { "user_two": ensure =&gt; present, gid =&gt; 501, } group { "dev_site_one": ensure =&gt; present, gid =&gt; 502, } group { "dev_site_two": ensure =&gt; present, gid =&gt; 503, } group { "dev_site_three": ensure =&gt; present, gid =&gt; 504, } user { "user_one": ensure =&gt; present, uid =&gt; 500, gid =&gt; 500, } user { "user_one": gid =&gt; 502, } user { "user_two": ensure =&gt; present, uid =&gt; 501, gid =&gt; 501, } } </code></pre> <p>Running this: </p> <pre><code>puppet apply --noop ./init.pp </code></pre> <p>Yields: </p> <blockquote> <p>Error: Duplicate declaration: User[user_one] is already declared in file /etc/puppet/modules/webserver/manifests/init.pp:156; cannot redeclare at /etc/puppet/modules/webserver/manifests/init.pp:160 on node my_web_server</p> </blockquote> <p>...where 160 is where I try to assign gid 502 to user_one.</p> <p><strong>Question</strong></p> <p>Is there a way to assign multiple groups with Puppet, or do I have to hand-assign these groups?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload