|
|
@ -325,6 +325,7 @@ class PlayContextSpec(Spec):
|
|
|
|
PlayContext. It is used for normal connections and delegate_to connections,
|
|
|
|
PlayContext. It is used for normal connections and delegate_to connections,
|
|
|
|
and should always be accurate.
|
|
|
|
and should always be accurate.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, connection, play_context, transport, inventory_name):
|
|
|
|
def __init__(self, connection, play_context, transport, inventory_name):
|
|
|
|
self._connection = connection
|
|
|
|
self._connection = connection
|
|
|
|
self._play_context = play_context
|
|
|
|
self._play_context = play_context
|
|
|
@ -366,6 +367,7 @@ class PlayContextSpec(Spec):
|
|
|
|
# #511, #536: executor/module_common.py::_get_shebang() hard-wires
|
|
|
|
# #511, #536: executor/module_common.py::_get_shebang() hard-wires
|
|
|
|
# "/usr/bin/python" as the default interpreter path if no other
|
|
|
|
# "/usr/bin/python" as the default interpreter path if no other
|
|
|
|
# interpreter is specified.
|
|
|
|
# interpreter is specified.
|
|
|
|
|
|
|
|
# raise ValueError(parse_python_path(s))
|
|
|
|
return parse_python_path(s or '/usr/bin/python')
|
|
|
|
return parse_python_path(s or '/usr/bin/python')
|
|
|
|
|
|
|
|
|
|
|
|
def private_key_file(self):
|
|
|
|
def private_key_file(self):
|
|
|
@ -379,9 +381,9 @@ class PlayContextSpec(Spec):
|
|
|
|
|
|
|
|
|
|
|
|
def ansible_ssh_timeout(self):
|
|
|
|
def ansible_ssh_timeout(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._connection.get_task_var('ansible_timeout') or
|
|
|
|
self._connection.get_task_var('ansible_timeout')
|
|
|
|
self._connection.get_task_var('ansible_ssh_timeout') or
|
|
|
|
or self._connection.get_task_var('ansible_ssh_timeout')
|
|
|
|
self.timeout()
|
|
|
|
or self.timeout()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def ssh_args(self):
|
|
|
|
def ssh_args(self):
|
|
|
@ -468,8 +470,8 @@ class PlayContextSpec(Spec):
|
|
|
|
|
|
|
|
|
|
|
|
def ansible_doas_exe(self):
|
|
|
|
def ansible_doas_exe(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._connection.get_task_var('ansible_doas_exe') or
|
|
|
|
self._connection.get_task_var('ansible_doas_exe')
|
|
|
|
os.environ.get('ANSIBLE_DOAS_EXE')
|
|
|
|
or os.environ.get('ANSIBLE_DOAS_EXE')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -490,6 +492,7 @@ class MitogenViaSpec(Spec):
|
|
|
|
having a configruation problem with connection delegation, the answer to
|
|
|
|
having a configruation problem with connection delegation, the answer to
|
|
|
|
your problem lies in the method implementations below!
|
|
|
|
your problem lies in the method implementations below!
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, inventory_name, host_vars, become_method, become_user,
|
|
|
|
def __init__(self, inventory_name, host_vars, become_method, become_user,
|
|
|
|
play_context):
|
|
|
|
play_context):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -520,8 +523,8 @@ class MitogenViaSpec(Spec):
|
|
|
|
|
|
|
|
|
|
|
|
def transport(self):
|
|
|
|
def transport(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._host_vars.get('ansible_connection') or
|
|
|
|
self._host_vars.get('ansible_connection')
|
|
|
|
C.DEFAULT_TRANSPORT
|
|
|
|
or C.DEFAULT_TRANSPORT
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def inventory_name(self):
|
|
|
|
def inventory_name(self):
|
|
|
@ -530,16 +533,16 @@ class MitogenViaSpec(Spec):
|
|
|
|
def remote_addr(self):
|
|
|
|
def remote_addr(self):
|
|
|
|
# play_context.py::MAGIC_VARIABLE_MAPPING
|
|
|
|
# play_context.py::MAGIC_VARIABLE_MAPPING
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._host_vars.get('ansible_ssh_host') or
|
|
|
|
self._host_vars.get('ansible_ssh_host')
|
|
|
|
self._host_vars.get('ansible_host') or
|
|
|
|
or self._host_vars.get('ansible_host')
|
|
|
|
self._inventory_name
|
|
|
|
or self._inventory_name
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def remote_user(self):
|
|
|
|
def remote_user(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._host_vars.get('ansible_ssh_user') or
|
|
|
|
self._host_vars.get('ansible_ssh_user')
|
|
|
|
self._host_vars.get('ansible_user') or
|
|
|
|
or self._host_vars.get('ansible_user')
|
|
|
|
C.DEFAULT_REMOTE_USER
|
|
|
|
or C.DEFAULT_REMOTE_USER
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def become(self):
|
|
|
|
def become(self):
|
|
|
@ -547,9 +550,9 @@ class MitogenViaSpec(Spec):
|
|
|
|
|
|
|
|
|
|
|
|
def become_method(self):
|
|
|
|
def become_method(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._become_method or
|
|
|
|
self._become_method
|
|
|
|
self._host_vars.get('ansible_become_method') or
|
|
|
|
or self._host_vars.get('ansible_become_method')
|
|
|
|
C.DEFAULT_BECOME_METHOD
|
|
|
|
or C.DEFAULT_BECOME_METHOD
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def become_user(self):
|
|
|
|
def become_user(self):
|
|
|
@ -557,21 +560,21 @@ class MitogenViaSpec(Spec):
|
|
|
|
|
|
|
|
|
|
|
|
def become_pass(self):
|
|
|
|
def become_pass(self):
|
|
|
|
return optional_secret(
|
|
|
|
return optional_secret(
|
|
|
|
self._host_vars.get('ansible_become_password') or
|
|
|
|
self._host_vars.get('ansible_become_password')
|
|
|
|
self._host_vars.get('ansible_become_pass')
|
|
|
|
or self._host_vars.get('ansible_become_pass')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def password(self):
|
|
|
|
def password(self):
|
|
|
|
return optional_secret(
|
|
|
|
return optional_secret(
|
|
|
|
self._host_vars.get('ansible_ssh_pass') or
|
|
|
|
self._host_vars.get('ansible_ssh_pass')
|
|
|
|
self._host_vars.get('ansible_password')
|
|
|
|
or self._host_vars.get('ansible_password')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def port(self):
|
|
|
|
def port(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._host_vars.get('ansible_ssh_port') or
|
|
|
|
self._host_vars.get('ansible_ssh_port')
|
|
|
|
self._host_vars.get('ansible_port') or
|
|
|
|
or self._host_vars.get('ansible_port')
|
|
|
|
C.DEFAULT_REMOTE_PORT
|
|
|
|
or C.DEFAULT_REMOTE_PORT
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def python_path(self):
|
|
|
|
def python_path(self):
|
|
|
@ -579,20 +582,21 @@ class MitogenViaSpec(Spec):
|
|
|
|
# #511, #536: executor/module_common.py::_get_shebang() hard-wires
|
|
|
|
# #511, #536: executor/module_common.py::_get_shebang() hard-wires
|
|
|
|
# "/usr/bin/python" as the default interpreter path if no other
|
|
|
|
# "/usr/bin/python" as the default interpreter path if no other
|
|
|
|
# interpreter is specified.
|
|
|
|
# interpreter is specified.
|
|
|
|
|
|
|
|
# raise ValueError(parse_python_path(s))
|
|
|
|
return parse_python_path(s or '/usr/bin/python')
|
|
|
|
return parse_python_path(s or '/usr/bin/python')
|
|
|
|
|
|
|
|
|
|
|
|
def private_key_file(self):
|
|
|
|
def private_key_file(self):
|
|
|
|
# TODO: must come from PlayContext too.
|
|
|
|
# TODO: must come from PlayContext too.
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._host_vars.get('ansible_ssh_private_key_file') or
|
|
|
|
self._host_vars.get('ansible_ssh_private_key_file')
|
|
|
|
self._host_vars.get('ansible_private_key_file') or
|
|
|
|
or self._host_vars.get('ansible_private_key_file')
|
|
|
|
C.DEFAULT_PRIVATE_KEY_FILE
|
|
|
|
or C.DEFAULT_PRIVATE_KEY_FILE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def ssh_executable(self):
|
|
|
|
def ssh_executable(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._host_vars.get('ansible_ssh_executable') or
|
|
|
|
self._host_vars.get('ansible_ssh_executable')
|
|
|
|
C.ANSIBLE_SSH_EXECUTABLE
|
|
|
|
or C.ANSIBLE_SSH_EXECUTABLE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def timeout(self):
|
|
|
|
def timeout(self):
|
|
|
@ -601,9 +605,9 @@ class MitogenViaSpec(Spec):
|
|
|
|
|
|
|
|
|
|
|
|
def ansible_ssh_timeout(self):
|
|
|
|
def ansible_ssh_timeout(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._host_vars.get('ansible_timeout') or
|
|
|
|
self._host_vars.get('ansible_timeout')
|
|
|
|
self._host_vars.get('ansible_ssh_timeout') or
|
|
|
|
or self._host_vars.get('ansible_ssh_timeout')
|
|
|
|
self.timeout()
|
|
|
|
or self.timeout()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def ssh_args(self):
|
|
|
|
def ssh_args(self):
|
|
|
@ -611,19 +615,19 @@ class MitogenViaSpec(Spec):
|
|
|
|
mitogen.core.to_text(term)
|
|
|
|
mitogen.core.to_text(term)
|
|
|
|
for s in (
|
|
|
|
for s in (
|
|
|
|
(
|
|
|
|
(
|
|
|
|
self._host_vars.get('ansible_ssh_args') or
|
|
|
|
self._host_vars.get('ansible_ssh_args')
|
|
|
|
getattr(C, 'ANSIBLE_SSH_ARGS', None) or
|
|
|
|
or getattr(C, 'ANSIBLE_SSH_ARGS', None)
|
|
|
|
os.environ.get('ANSIBLE_SSH_ARGS')
|
|
|
|
or os.environ.get('ANSIBLE_SSH_ARGS')
|
|
|
|
# TODO: ini entry. older versions.
|
|
|
|
# TODO: ini entry. older versions.
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
(
|
|
|
|
self._host_vars.get('ansible_ssh_common_args') or
|
|
|
|
self._host_vars.get('ansible_ssh_common_args')
|
|
|
|
os.environ.get('ANSIBLE_SSH_COMMON_ARGS')
|
|
|
|
or os.environ.get('ANSIBLE_SSH_COMMON_ARGS')
|
|
|
|
# TODO: ini entry.
|
|
|
|
# TODO: ini entry.
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
(
|
|
|
|
self._host_vars.get('ansible_ssh_extra_args') or
|
|
|
|
self._host_vars.get('ansible_ssh_extra_args')
|
|
|
|
os.environ.get('ANSIBLE_SSH_EXTRA_ARGS')
|
|
|
|
or os.environ.get('ANSIBLE_SSH_EXTRA_ARGS')
|
|
|
|
# TODO: ini entry.
|
|
|
|
# TODO: ini entry.
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -633,8 +637,8 @@ class MitogenViaSpec(Spec):
|
|
|
|
|
|
|
|
|
|
|
|
def become_exe(self):
|
|
|
|
def become_exe(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._host_vars.get('ansible_become_exe') or
|
|
|
|
self._host_vars.get('ansible_become_exe')
|
|
|
|
C.DEFAULT_BECOME_EXE
|
|
|
|
or C.DEFAULT_BECOME_EXE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def sudo_args(self):
|
|
|
|
def sudo_args(self):
|
|
|
@ -694,6 +698,6 @@ class MitogenViaSpec(Spec):
|
|
|
|
|
|
|
|
|
|
|
|
def ansible_doas_exe(self):
|
|
|
|
def ansible_doas_exe(self):
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
self._host_vars.get('ansible_doas_exe') or
|
|
|
|
self._host_vars.get('ansible_doas_exe')
|
|
|
|
os.environ.get('ANSIBLE_DOAS_EXE')
|
|
|
|
or os.environ.get('ANSIBLE_DOAS_EXE')
|
|
|
|
)
|
|
|
|
)
|
|
|
|