1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

enabled vault password file and fixed prompting for connection password on local

This commit is contained in:
Brian Coca 2015-03-21 01:23:28 -04:00
parent edb1bd25dd
commit 08896e2cfd

View file

@ -30,6 +30,7 @@ from ansible.parsing import DataLoader
from ansible.parsing.splitter import parse_kv
from ansible.playbook.play import Play
from ansible.utils.cli import base_parser, validate_conflicts, normalize_become_options, ask_passwords
from ansible.utils.vault import read_vault_file
from ansible.vars import VariableManager
########################################################
@ -76,9 +77,9 @@ class Cli(object):
pattern = args[0]
#-------------------------------------------------------------------------------
# FIXME: the password asking stuff needs to be ported over still
#-------------------------------------------------------------------------------
if options.connection == "local":
options.ask_pass = False
sshpass = None
becomepass = None
vault_pass = None
@ -86,23 +87,12 @@ class Cli(object):
normalize_become_options(options)
(sshpass, becomepass, vault_pass) = ask_passwords(options)
#options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS
## Never ask for an SSH password when we run with local connection
#if options.connection == "local":
# options.ask_pass = False
#options.ask_sudo_pass = options.ask_sudo_pass or C.DEFAULT_ASK_SUDO_PASS
#options.ask_su_pass = options.ask_su_pass or C.DEFAULT_ASK_SU_PASS
#options.ask_vault_pass = options.ask_vault_pass or C.DEFAULT_ASK_VAULT_PASS
#
#(sshpass, sudopass, su_pass, vault_pass) = utils.ask_passwords(ask_pass=options.ask_pass, ask_sudo_pass=options.ask_sudo_pass, ask_su_pass=options.ask_su_pass, ask_vault_pass=options.ask_vault_pass)
#
if options.vault_password_file:
# read vault_pass from a file
#if not options.ask_vault_pass and options.vault_password_file:
# vault_pass = utils.read_vault_file(options.vault_password_file)
#-------------------------------------------------------------------------------
vault_pass = read_vault_file(options.vault_password_file)
# FIXME: needs vault password, after the above is fixed
# FIXME: needs vault password
loader = DataLoader()
variable_manager = VariableManager()