i am trying to get this to work, but its skipping over user creation in 
this current form when getent returns a null answer


 --- 
 - hosts: test
   remote_user: ansible
   become: yes 
   gather_facts: yes 
   vars: 
     user_name: yourusername

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

tasks: 
   - name: Get information about the user 
     getent: 
       key={{user_name}} 
       database=passwd 
       fail_key=true 

 - name: Create user account
   user: name={{ user_name }}
         password={{ encrypted_user_password }}
         state=present
         append=yes
         groups=sudo
         shell="/bin/bash"
         update_password=always
   when: getent_passwd[user_name] != none

-- 
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/1289b90f-2d7e-4cfb-b5e1-a5ef432842b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to