=====Password Change===== **change-password.yml** --- - name: Change passwords hosts: all become: true tasks: - name: Change user password user: name: "{{ username }}" update_password: always password: "{{ newpassword|password_hash('sha512') }}" You can add following to make the passwords expire also - name: Expire the password command: passwd -e {{ username }} To run this playbook you need to specify the extra variables username newpassword ansible-playbook change-password.yml --extra-vars "newpassword="New_password" username=brindleyp"