标签:-- min 设置 ansible ble password yml false hash
介绍两种法批量修改用户密码方法一:
1、这个方法适用于更改多个固定的用户;playbook写法如下:
# cat play.yml
---
- hosts: test
gather_facts: false
tasks:
- name: change user passwd
user: name={{ item.name }} password={{ item.chpass | password_hash(‘sha512‘) }} update_password=always
with_items:
- { name: ‘root‘, chpass: ‘admin#123‘ }
- { name: ‘test‘, chpass: ‘yjun@123‘ }
1.1、执行playbook:
# ansible-playbook play.yml
方法二:
2、这个方法更改单用户比较方便;playbook写法如下:
cat play.yml
---
- hosts: test
gather_facts: false
tasks:
- name: Change password
user: name={{ name1 }} password={{ chpass | password_hash(‘sha512‘) }} update_password=always
2 .1、执行,test为用户名,admin#123就是要设置密码
#ansible-playbook play1.yml -e "name1=test chpass=admin#123"
标签:-- min 设置 ansible ble password yml false hash
原文地址:http://blog.51cto.com/75368/2140404