|
|
|
@ -67,6 +67,7 @@ import ansible.utils.shlex
|
|
|
|
|
import ansible.constants as C
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.six import with_metaclass
|
|
|
|
|
from ansible.module_utils.parsing.convert_bool import boolean
|
|
|
|
|
|
|
|
|
|
# this was added in Ansible >= 2.8.0; fallback to the default interpreter if necessary
|
|
|
|
|
try:
|
|
|
|
@ -245,6 +246,12 @@ class Spec(with_metaclass(abc.ABCMeta, object)):
|
|
|
|
|
Path to the Python interpreter on the target machine.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
@abc.abstractmethod
|
|
|
|
|
def host_key_checking(self):
|
|
|
|
|
"""
|
|
|
|
|
Whether or not to check the keys of the target machine
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
@abc.abstractmethod
|
|
|
|
|
def private_key_file(self):
|
|
|
|
|
"""
|
|
|
|
@ -466,6 +473,14 @@ class PlayContextSpec(Spec):
|
|
|
|
|
action=self._action,
|
|
|
|
|
rediscover_python=rediscover_python)
|
|
|
|
|
|
|
|
|
|
def host_key_checking(self):
|
|
|
|
|
def candidates():
|
|
|
|
|
yield self._connection.get_task_var('ansible_ssh_host_key_checking')
|
|
|
|
|
yield self._connection.get_task_var('ansible_host_key_checking')
|
|
|
|
|
yield C.HOST_KEY_CHECKING
|
|
|
|
|
val = next((v for v in candidates() if v is not None), True)
|
|
|
|
|
return boolean(val)
|
|
|
|
|
|
|
|
|
|
def private_key_file(self):
|
|
|
|
|
return self._play_context.private_key_file
|
|
|
|
|
|
|
|
|
@ -692,6 +707,14 @@ class MitogenViaSpec(Spec):
|
|
|
|
|
action=self._action,
|
|
|
|
|
rediscover_python=rediscover_python)
|
|
|
|
|
|
|
|
|
|
def host_key_checking(self):
|
|
|
|
|
def candidates():
|
|
|
|
|
yield self._host_vars.get('ansible_ssh_host_key_checking')
|
|
|
|
|
yield self._host_vars.get('ansible_host_key_checking')
|
|
|
|
|
yield C.HOST_KEY_CHECKING
|
|
|
|
|
val = next((v for v in candidates() if v is not None), True)
|
|
|
|
|
return boolean(val)
|
|
|
|
|
|
|
|
|
|
def private_key_file(self):
|
|
|
|
|
# TODO: must come from PlayContext too.
|
|
|
|
|
return (
|
|
|
|
|