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

2022-05-24 17:08:48 浏览数 (1)

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"

image.png

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

image.png

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

image.png

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

image.png

0 人点赞