Please try the below. It works.

---
- hosts: localhost
  remote_user: root
  become: yes
  gather_facts: yes
  vars:
    user_name: youruser

  vars_prompt:
    - name: "new_password"
      prompt: "Enter New Password"
      private: yes
      encrypt: "md5_crypt"
      confirm: yes
      salt_size: 7

  tasks:
    - name: Change password of existing user
      user: name={{user_name}} update_password=always 
password={{new_password}}


On Friday, 30 September 2016 14:36:42 UTC+5:30, [email protected] wrote:
>
> hello,all
>
>          i want to use ansible user module to change password on the 
> remote hosts, 
>
>          but , if the user is not in the remote hosts, ansible will create 
> the user,  how can i change password only,  if user is not exist,  return 
> error is ok;  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ec64e8d8-9cb4-4f38-8203-f5531703df4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to