i tried,  the playbook still creates the user if  user not exists on the remote 
hosts ;



[email protected]
 
From: JayB
Date: 2016-09-30 17:18
To: Ansible Project
CC: hzj.zh
Subject: Re: ansible user module change passwd
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/2016093017501779333519%40foxmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to