user:生成用户、删除用户
group:生成组、删除组
1、生成用户:ansible all -m user -a "name=test password=1DhUWqz2JZqc home=/home uid=999 comment=‘this is a ansible test user‘ shell=/bin/sh"
其中密码为123,生成方式为: openssl passwd -salt -1 "123"

Ansible用户模块user和组模块group(学习笔记七)
image.png

2、删除用户,remove是否移除家目录: ansible all -m user -a "name=test state=absent remove=yes"

Ansible用户模块user和组模块group(学习笔记七)
image.png

3、生成组:ansible all -m group -a 'name=g1 gid=666 state=present system=yes'

Ansible用户模块user和组模块group(学习笔记七)
image.png

4、删除组: ansible all -m group -a 'name=g1 state=absent'

Ansible用户模块user和组模块group(学习笔记七)
image.png

相关文章:

  • 2022-02-08
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-02-27
  • 2021-05-15
  • 2022-12-23
猜你喜欢
  • 2021-04-25
  • 2021-07-17
  • 2021-09-23
  • 2021-09-09
  • 2021-11-22
  • 2022-12-23
  • 2022-03-03
相关资源
相似解决方案