fix: Use only_sudo failed

This commit is contained in:
feng
2024-08-14 14:53:07 +08:00
committed by Bryan
parent c56e1bdbbe
commit 0a39ba0a75
5 changed files with 29 additions and 14 deletions

View File

@@ -119,7 +119,8 @@ class Account(AbsConnectivity, LabeledMixin, BaseAccount):
return auth
auth.update(self.make_account_ansible_vars(su_from))
become_method = platform.su_method if platform.su_method else 'sudo'
become_method = platform.ansible_become_method
password = su_from.secret if become_method == 'sudo' else self.secret
auth['ansible_become'] = True
auth['ansible_become_method'] = become_method