mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 21:30:22 -07:00
Revert "Revert "Merge pull request #5325 from angstwad/add-su-support""
This reverts commit c17d0e0357
.
Conflicts:
lib/ansible/runner/connection_plugins/paramiko_ssh.py
This commit is contained in:
parent
4c84ba74b0
commit
f72f5a20df
17 changed files with 304 additions and 94 deletions
|
@ -30,7 +30,8 @@ class Task(object):
|
|||
'delegate_to', 'first_available_file', 'ignore_errors',
|
||||
'local_action', 'transport', 'sudo', 'remote_user', 'sudo_user', 'sudo_pass',
|
||||
'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',
|
||||
'su', 'su_user', 'su_pass'
|
||||
]
|
||||
|
||||
# to prevent typos and such
|
||||
|
@ -39,7 +40,8 @@ class Task(object):
|
|||
'first_available_file', 'include', 'tags', 'register', 'ignore_errors',
|
||||
'delegate_to', 'local_action', 'transport', 'remote_user', 'sudo', 'sudo_user',
|
||||
'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',
|
||||
'su', 'su_user', 'su_pass'
|
||||
]
|
||||
|
||||
def __init__(self, play, ds, module_vars=None, default_vars=None, additional_conditions=None, role_name=None):
|
||||
|
@ -117,6 +119,7 @@ class Task(object):
|
|||
self.tags = [ 'all' ]
|
||||
self.register = ds.get('register', None)
|
||||
self.sudo = utils.boolean(ds.get('sudo', play.sudo))
|
||||
self.su = utils.boolean(ds.get('sudo', play.su))
|
||||
self.environment = ds.get('environment', {})
|
||||
self.role_name = role_name
|
||||
|
||||
|
@ -142,13 +145,18 @@ class Task(object):
|
|||
else:
|
||||
self.remote_user = ds.get('remote_user', play.playbook.remote_user)
|
||||
|
||||
self.sudo_user = None
|
||||
self.sudo_pass = None
|
||||
self.su_user = None
|
||||
self.su_pass = None
|
||||
|
||||
if self.sudo:
|
||||
self.sudo_user = ds.get('sudo_user', play.sudo_user)
|
||||
self.sudo_pass = ds.get('sudo_pass', play.playbook.sudo_pass)
|
||||
else:
|
||||
self.sudo_user = None
|
||||
self.sudo_pass = None
|
||||
|
||||
elif self.su:
|
||||
self.su_user = ds.get('su_user', play.su_user)
|
||||
self.su_pass = ds.get('su_pass', play.playbook.su_pass)
|
||||
|
||||
# Both are defined
|
||||
if ('action' in ds) and ('local_action' in ds):
|
||||
raise errors.AnsibleError("the 'action' and 'local_action' attributes can not be used together")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue