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"
![img_acfdfa1760ed06b49a90b093c3d69655.png](https://i-blog.csdnimg.cn/blog_migrate/c79f63580a4de07f06b767cacaa3a1c2.png)
image.png
2、删除用户,remove是否移除家目录: ansible all -m user -a "name=test state=absent remove=yes"
![img_face48df26de49e80f3f81fa063b5483.png](https://i-blog.csdnimg.cn/blog_migrate/b451c70141f937907a04c12a487c6c4e.png)
image.png
3、生成组:ansible all -m group -a 'name=g1 gid=666 state=present system=yes'
![img_2424ab1166ffbe6b967342201f6c8336.png](https://i-blog.csdnimg.cn/blog_migrate/3dce4cfe21fb23ed35405cd588f2e652.png)
image.png
4、删除组: ansible all -m group -a 'name=g1 state=absent'
![img_72862ce389ea6b52d1b4bdb2dd37e469.png](https://i-blog.csdnimg.cn/blog_migrate/e96d4e124c37ce5e8f975e01ce76f20d.png)
image.png