This does not work for me. Garrett's example does ...

On Monday, May 5, 2014 11:51:29 PM UTC-4, Michael DeHaan wrote:
>
> You can say this specifically:
>
>        when: revision_no is not defined
>
>
>
> On Mon, May 5, 2014 at 1:19 PM, Garrett Plasky 
> <[email protected]<javascript:>
> > wrote:
>
>> There may be a better way to do this but I solved the problem by having a 
>> separate task initially that verifies the variable is set and fails the 
>> play if not (via the fail module).
>>
>> - name: Checking for required variables
>>   fail: msg="Playbook execution failed - 'revision_no' is required!"
>>   when: not revision_no
>>
>> If you don't want the play to outright fail, you could replace the fail 
>> module with something like debug.
>>
>> On Monday, May 5, 2014 7:58:27 AM UTC-7, Samnang Sen wrote:
>>>
>>> That last line is supposed to read "revision_no is defined"
>>>
>>> On Monday, May 5, 2014 10:53:54 AM UTC-4, Samnang Sen wrote:
>>>>
>>>> Let's say I ask for a revision_no from the user. If the user doesn't 
>>>> input a value, I would like to display a custom message. Right now ansible 
>>>> shows a bunch of "skipping" message, but I know my users would want to 
>>>> know 
>>>> why it skipped.
>>>>
>>>> - hosts: webservers
>>>>   user: deployment
>>>> #  serial: 1
>>>>
>>>>
>>>>   vars_prompt:
>>>>    - name: "revision_no"
>>>>      prompt: "Input revision number"
>>>>      private: no
>>>>
>>>>   vars_files:
>>>>   - "group_vars/deploy_list"
>>>>
>>>>   roles:
>>>>   - { role: web, when: revision_no is not defined }
>>>>
>>>>  -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/73615f28-23c0-4d0b-89f1-80a323ccce42%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/73615f28-23c0-4d0b-89f1-80a323ccce42%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/66c9cb47-ba26-44ad-8daa-0fcc7e52e09d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to