使用chef创建Windows用户并将用户添加到本地Administrators组

时间:2014-08-08 21:09:46

标签: ruby windows chef

用户资源的主厨文档:http://docs.getchef.com/resource_user.html

这样做有效:

user "TestUser" do
  password "p@ssw0rd"
end

但是当我添加一个gid时它失败了:

user "TestUser" do
  password "p@ssw0rd"
  gid "Administrators"
end

我也试过传递。\ Administrator,但得到相同的结果:

[2014-08-08T14:00:11-07:00] FATAL: ArgumentError: user[TestUser] (test::users line 11) had an error: ArgumentError: The user does not belong to this group.

gid的目的是不指定组成员身份吗?

1 个答案:

答案 0 :(得分:16)

最终弄明白了。诀窍是像这样修改组:

user "TestUser" do
  password "p@ssw0rd"
end

group "Administrators" do
  action :modify
  members "TestUser"
  append true
end