mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Never ask for SSH password when using local connection.
With the command line option "-c local", ansible and ansible-playbook should never ask for a SSH password even if this is set in the config. Fixes #3720
This commit is contained in:
parent
0089ecfa7e
commit
5a47953e7d
2 changed files with 6 additions and 0 deletions
|
@ -97,6 +97,9 @@ class Cli(object):
|
|||
sshpass = None
|
||||
sudopass = None
|
||||
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
|
||||
( sshpass, sudopass ) = utils.ask_passwords(ask_pass=options.ask_pass, ask_sudo_pass=options.ask_sudo_pass)
|
||||
if options.sudo_user or options.ask_sudo_pass:
|
||||
|
|
|
@ -91,6 +91,9 @@ def main(args):
|
|||
sudopass = None
|
||||
if not options.listhosts and not options.syntax and not options.listtasks:
|
||||
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
|
||||
( sshpass, sudopass ) = utils.ask_passwords(ask_pass=options.ask_pass, ask_sudo_pass=options.ask_sudo_pass)
|
||||
options.sudo_user = options.sudo_user or C.DEFAULT_SUDO_USER
|
||||
|
|
Loading…
Reference in a new issue