[chef] RE: Re: How to add all the groups to a newly created user?


Chronological Thread 
  • From: Nico Kadel-Garcia < >
  • To: " " < >, " " < >
  • Subject: [chef] RE: Re: How to add all the groups to a newly created user?
  • Date: Fri, 27 Feb 2015 17:00:00 -0600
  • Accept-language: en-US
  • Acceptlanguage: en-US

The ‘users’ cookbook basically requires a separate cookbook and recipes to manage your own group or list of groups. It would be potentially quite helpful to have that information selectable on a role or environment basis, rather than requiring in-house recipes.

 

 

Nico Kadel-Garcia

Lead DevOps Engineer

">

 

 

From: George Miranda [mailto:
Sent: Tuesday, February 24, 2015 11:53 PM
To:
Subject: [chef] Re: How to add all the groups to a newly created user?

 

The users_manage resource from the community "users" cookbook takes the name of a group you want to configure and only ensures that group (and any of its users) are on the system.  If you want to ensure "vagrant", "wheel", etc are on your system you must use a users_manage resource for all of the groups you want configured on the system.  Then you will see that your "project" user is associated with the groups you expect.

 

A detailed look at how that works can be found on the Chef blog

 

 

On Tue, Feb 24, 2015 at 8:41 PM, Anthony Kong < " target="_blank"> > wrote:

Hi, 

 

it is my user json file in the data bag

 

{                                                                                                                                                         

    "id": "project",

    "shell": "/bin/bash",

     "groups": ["vagrant", "wheel", "admin", "sensu", "chef", "adm", "cdrom", "sudo", "dip", "plugdev", "lpadamin"]

   }

 

 

In my default.rb cookbook, I have these lines

 

 

include_recipe "users" 

 

users_manage "admin" do

  action [:create]

end

 

After the user is created, it looks like this:

 

$ id

uid=1000(project) gid=1000(project) groups=1000(project),2302(admin)

 

How can I get the user to be member of all the groups mentioned in the json file?

 

 

Cheers, 

 

Tony

 




Archive powered by MHonArc 2.6.16.

§