How to create user having member in multiple groups in chef user resource -


while creating user can specify group in gid belongs , if user belongs multiple groups how can specify in chef

user 'random'   supports :manage_home => true   comment 'random user'   uid 1234   gid 'users' end 

if user resource not providing option how can achieve in best way.

that's not user has multiple groups in fact, it'a group having multiple users (that's managed in /etc/groups not in /etc/passwd).

the way achieve is:

user 'random'   supports :manage_home => true   comment 'random user'   uid 1234   gid 'users' end  %w{group1 group2 group2}.each |g|   group g     action :modify     members "random"     append true   end end 

see group resource documentation more details , available attributes.

change action :create if group not exists.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -