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


Chronological Thread 
  • From: Anthony Kong < >
  • To:
  • Subject: [chef] How to add all the groups to a newly created user?
  • Date: Wed, 25 Feb 2015 15:41:31 +1100

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.

§