我无法将用户添加到多个组,我不断收到 msg: 这个模块需要 key=value 参数。
这是我正在尝试的一段代码:
- name: make a new user
user: name=user
state=present
groups="group1", "group2", "group3"
comment="comment"
Run Code Online (Sandbox Code Playgroud)
文档说: Groups= 将用户放入此逗号分隔的组列表中。当设置为空字符串 ('groups=') 时,用户将从除主要组之外的所有组中删除。
我尝试过使用“group”、“group”和不带冒号的方法,但仍然出现相同的错误。
正确的语法是:
- name: make a new user
user: name=user
state=present
groups="group1, group2, group3"
comment="comment"
Run Code Online (Sandbox Code Playgroud)
您发布的代码有两个问题:
groups
,请使用逗号分隔的值,中间没有空格:groups: group1,group2
=
for:
这是一个工作代码示例:
- name: make a new user
user:
name: johnsmith
state: present
groups: group1,group2
comment: "comment"
append: no # If yes, will only add groups, not set them to just the list in groups.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
16606 次 |
最近记录: |