问题原文
原帖链接 · vdboor · CC BY-SA 4.0
How can I add a user to additional groups with Ansible? For example, I would like to add a user to the sudo group without replacing the user's existing set of groups.
已采纳解答
原帖链接 · art3mis · CC BY-SA 4.0
According to the User module you can use this:
- name: Adding user {{ user }}
user: name={{ user }}
group={{ user }}
shell=/bin/bash
password=${password}
groups=sudo
append=yes
You can just add the groups=groupname and append=yes to add them to an existing user when you're creating them
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
