ansible系列6-用户管理

第一种:新增用户

ansible host -m user -a "name=zhang shell=/bin/bash groups=admin,root append=yes home=/home/zhang state=present"

name:新增用户名字

shell:用户的shell

groups:添加到那些属组

append:群量变更

第二种:修改用户组

ansible host -m user -a "name=zhang groups=dba append=no"

append=no需用这个选项

第三种:修改用户属性

ansible host -m user -a "name=zhang expire=142112"

expire:过期时间

第四种:删除用户

ansible host -m user -a "name=zhang state=abent remove=yes"

第五种:变更用户密码

ansible host -m user -a "name=zhang shell=/bin/bash password=123456 update_password=always"

password:设置用户密码为制定的加密后的密码

原文地址:https://www.cnblogs.com/kuku0223/p/8728367.html