mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 19:20:22 -07:00
add vars_prompt to playbooks
- this allows some vars to be prompted for at the start of the playbook setup - defaults to no output since this would mostly be used for passwords
This commit is contained in:
parent
04aecdcf34
commit
bcef25f7eb
2 changed files with 14 additions and 0 deletions
|
@ -95,6 +95,13 @@ class PlayBook(object):
|
|||
vars = play.get('vars', {})
|
||||
if type(vars) != dict:
|
||||
raise errors.AnsibleError("'vars' section must contain only key/value pairs")
|
||||
vars_prompt = play.get('vars_prompt', {})
|
||||
if type(vars_prompt) != dict:
|
||||
raise errors.AnsibleError("'vars_prompt' section must contain only key/value pairs")
|
||||
for vname in vars_prompt:
|
||||
print vars_prompt[vname]
|
||||
# FIXME - need some way to know that this prompt should be getpass or raw_input
|
||||
vars[vname] = self.callbacks.on_vars_prompt(vname)
|
||||
return vars
|
||||
|
||||
# *****************************************************
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue