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


Chronological Thread 
  • From: George Miranda < >
  • To: " " < >
  • Subject: [chef] Re: How to add all the groups to a newly created user?
  • Date: Tue, 24 Feb 2015 20:52:42 -0800

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.

§