ansible batch modify user password

   Used to do a project, the direct key registration, and later servers have done so on the security code has expired, the password must be changed in order to use the bulk appeared to change the password thing

---
- hosts: all
  sudo: yes
  remote_user: xxxx
  gather_facts: false
  tasks:
  - name: change user passwd
    user: name={{ item.user }} password={{ item.password | password_hash('sha512') }}  update_password=always
    with_items:
          - { user: 'xxxx', password: 'xxxddd....' }
          - { user: 'ddd', password: 'xxxddd....' }  多个用户继续加

Here is a demonstration:

     useradd.gif

Guess you like

Origin blog.51cto.com/shaonian/2405198