简体   繁体   中英

Obtaining list of groups in Chef?

Brand new to Chef. I was curious if there's a way to obtain a list of groups in Chef? Essentially I want to create a restricted windows user who isn't a member of any group. Something like:

TheseAreAllTheWindowsGroupsOnTheSystem.each do |groupName|
   group groupName do
        action :modify
        excluded_members: username
    end
end

You can use Ohai for this.

node['etc']['group'].each do |group_name, info|
  # ...
end

I do not have a Windows system handy, but that is the key on Linuxes. You can run ohai on a Windows machine and see all the information available:

$ ohai

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM