I came to the same thought based on the doc title and lack of msg var being
specified in doc. At least as of version 1.9.2 (and it looks like probably
going back since its inception based on git history) msg: var is actually
supported but the doc is not complete. The code for assert module actually
checks for a msg var and uses it if present.
the following playbook works as a test case
---
- hosts: all
vars:
jboss:
# environment: bar #This value will fail
environment: stage #This value will work
tasks:
- name: use assert
assert:
that: jboss.environment in ['dev','qa','stage','prod']
msg: "the environment value of `{{jboss.environment}}` was
specified but only dev,qa,stage and prod are allowed values. Please update
config."
- name: ensure use an allowed environment is used
fail:
msg: "the environment value of `{{jboss.environment}}` was
specified but only dev,qa,stage and prod are allowed values. Please update
config."
when: jboss.environment not in ['dev','qa','stage','prod']
On Tuesday, July 21, 2015 at 10:15:00 AM UTC-5, [email protected] wrote:
>
> The title to the assert
> <http://docs.ansible.com/ansible/assert_module.html> command is "Fail
> with custom message". However, no where do I see a parameter for a custom
> message. Is it possible to specify a custom message? The fail
> <http://docs.ansible.com/ansible/fail_module.html> command has the same
> title and supports a custom message via the *msg* parameter.
>
--
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/831fcff5-6b1d-4eb0-9b2e-b21e6d66e667%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.