简体   繁体   English

获取Chef中的组列表?

[英]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? 我很好奇,是否有办法在Chef中获取小组名单? Essentially I want to create a restricted windows user who isn't a member of any group. 本质上,我想创建一个不属于任何组成员的受限Windows用户。 Something like: 就像是:

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

You can use Ohai for this. 您可以为此使用Ohai

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

I do not have a Windows system handy, but that is the key on Linuxes. 我没有Windows系统,但这是Linuxes上的关键。 You can run ohai on a Windows machine and see all the information available: 您可以在Windows计算机上运行ohai并查看所有可用信息:

$ ohai

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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