I am trying to do two things:

1.  Call a variable while trying to set_fact within a jinja pipe filter
2.  Prevent fails when the user isn't found

    - name: "Find the user_id for {{ user }}"
      set_fact:
        uid: "{{ 
(userinfo.json.users|selectattr('username','match','MYVAR')|list|first).user_id 
}}"

If this is possible, what is the proper syntax for the variable MYVAR?  
Everything I am trying fails.

In addition, I can't use "failed_when: false" with the above and get it to 
work (ie passing in a non-existent user into MYVAR)--it seems to get 
ignored and ansible exits with a failure.  What would be the proper way to 
prevent this from failing Ansible when the user isn't found?

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/add4c262-3690-4417-8db0-decc34cb666f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to