mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Improved 'vars_prompt' syntax to support prompt text and (non-)private input
An example of the new syntax: vars_prompt: - name: 'secret_variable_name" prompt: "Enter secret value: " private: "yes" - name: "nonsecret_variable_name" prompt: "Enter non-secret value: " private: "no"
This commit is contained in:
parent
4ecdd17caf
commit
c717934b7e
3 changed files with 42 additions and 10 deletions
|
@ -365,9 +365,12 @@ class PlaybookCallbacks(object):
|
|||
msg = "NOTIFIED: [%s]" % name
|
||||
print banner(msg)
|
||||
|
||||
def on_vars_prompt(self, varname, private=True):
|
||||
def on_vars_prompt(self, varname, private=True, prompt=None):
|
||||
|
||||
msg = 'input for %s: ' % varname
|
||||
if prompt:
|
||||
msg = prompt
|
||||
else:
|
||||
msg = 'input for %s: ' % varname
|
||||
if private:
|
||||
return getpass.getpass(msg)
|
||||
return raw_input(msg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue