See the input and output below for some oddity with vars_prompt.
First, note that yes is being coerced to True but no results in a missing default.
Quoting it works around this at the expense of no longer being boolean.
Second, would it make sense to have a boolean option to have vars_prompt do the smart coercion of yes/no/true/false to boolean?
I find that the result being a string requires pushing | bool down through the code.
Thanks, Jim
`
I realize now I should have sent this to the devel list.
Will send an issue and proposed patch.
`
diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py
index 1abfe68…cbfd315 100644
— a/lib/ansible/callbacks.py
+++ b/lib/ansible/callbacks.py
@@ -643,7 +643,7 @@ class PlaybookCallbacks(object):
def on_vars_prompt(self, varname, private=True, prompt=None, encrypt=None, confirm=False, salt_size=None, salt=None, default=None):
- if prompt and default is not None:
msg = "%s [%s]: " % (prompt, default)
elif prompt:
msg = "%s: " % prompt
`
When typing these up, please include an English description of what you expect and what you get, and a short summary, otherwise it can be very difficult to interpret the playbooks.
Yes, had done that in the issue:
https://github.com/ansible/ansible/issues/7057
Do you prefer it in the group in addition?
Jim
Just the ticket should be fine, thanks!