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

Merge pull request #3932 from jocelynj/devel

Add option remote_user to task level, to specify the ssh login user
This commit is contained in:
jctanner 2013-10-15 06:34:57 -07:00
commit 69fa5954fd
2 changed files with 5 additions and 3 deletions

View file

@ -305,7 +305,7 @@ class PlayBook(object):
pattern=task.play.hosts, inventory=self.inventory, module_name=task.module_name, pattern=task.play.hosts, inventory=self.inventory, module_name=task.module_name,
module_args=task.module_args, forks=self.forks, module_args=task.module_args, forks=self.forks,
remote_pass=self.remote_pass, module_path=self.module_path, remote_pass=self.remote_pass, module_path=self.module_path,
timeout=self.timeout, remote_user=task.play.remote_user, timeout=self.timeout, remote_user=task.remote_user,
remote_port=task.play.remote_port, module_vars=task.module_vars, remote_port=task.play.remote_port, module_vars=task.module_vars,
default_vars=task.default_vars, private_key_file=self.private_key_file, default_vars=task.default_vars, private_key_file=self.private_key_file,
setup_cache=self.SETUP_CACHE, basedir=task.play.basedir, setup_cache=self.SETUP_CACHE, basedir=task.play.basedir,

View file

@ -28,7 +28,7 @@ class Task(object):
'notify', 'module_name', 'module_args', 'module_vars', 'default_vars', 'notify', 'module_name', 'module_args', 'module_vars', 'default_vars',
'play', 'notified_by', 'tags', 'register', 'role_name', 'play', 'notified_by', 'tags', 'register', 'role_name',
'delegate_to', 'first_available_file', 'ignore_errors', 'delegate_to', 'first_available_file', 'ignore_errors',
'local_action', 'transport', 'sudo', 'sudo_user', 'sudo_pass', 'local_action', 'transport', 'sudo', 'remote_user', 'sudo_user', 'sudo_pass',
'items_lookup_plugin', 'items_lookup_terms', 'environment', 'args', 'items_lookup_plugin', 'items_lookup_terms', 'environment', 'args',
'any_errors_fatal', 'changed_when', 'failed_when', 'always_run', 'delay', 'retries', 'until' 'any_errors_fatal', 'changed_when', 'failed_when', 'always_run', 'delay', 'retries', 'until'
] ]
@ -37,7 +37,7 @@ class Task(object):
VALID_KEYS = [ VALID_KEYS = [
'name', 'meta', 'action', 'only_if', 'async', 'poll', 'notify', 'name', 'meta', 'action', 'only_if', 'async', 'poll', 'notify',
'first_available_file', 'include', 'tags', 'register', 'ignore_errors', 'first_available_file', 'include', 'tags', 'register', 'ignore_errors',
'delegate_to', 'local_action', 'transport', 'sudo', 'sudo_user', 'delegate_to', 'local_action', 'transport', 'remote_user', 'sudo', 'sudo_user',
'sudo_pass', 'when', 'connection', 'environment', 'args', 'sudo_pass', 'when', 'connection', 'environment', 'args',
'any_errors_fatal', 'changed_when', 'failed_when', 'always_run', 'delay', 'retries', 'until' 'any_errors_fatal', 'changed_when', 'failed_when', 'always_run', 'delay', 'retries', 'until'
] ]
@ -135,6 +135,8 @@ class Task(object):
# can be hashes and lists, not just scalars # can be hashes and lists, not just scalars
self.args = ds.get('args', {}) self.args = ds.get('args', {})
self.remote_user = ds.get('remote_user', play.playbook.remote_user)
if self.sudo: if self.sudo:
self.sudo_user = ds.get('sudo_user', play.sudo_user) self.sudo_user = ds.get('sudo_user', play.sudo_user)
self.sudo_pass = ds.get('sudo_pass', play.playbook.sudo_pass) self.sudo_pass = ds.get('sudo_pass', play.playbook.sudo_pass)