mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 18:04:02 -07:00
improve become_method: runas error handling (#23328)
Prescriptive errors for username/password issues and NTLM/Kerb auth failures, cleans up exception noise.
This commit is contained in:
parent
e66c98281e
commit
8d291f91ee
2 changed files with 34 additions and 3 deletions
|
@ -553,6 +553,13 @@ class PlayContext(Base):
|
|||
elif self.become_method == 'runas':
|
||||
# become is handled inside the WinRM connection plugin
|
||||
display.warning("The Windows 'runas' become method is experimental, and may change significantly in future Ansible releases.")
|
||||
|
||||
if not self.become_user:
|
||||
raise AnsibleError(("The 'runas' become method requires a username "
|
||||
"(specify with the '--become-user' CLI arg, the 'become_user' keyword, or the 'ansible_become_user' variable)"))
|
||||
if not self.become_pass:
|
||||
raise AnsibleError(("The 'runas' become method requires a password "
|
||||
"(specify with the '-K' CLI arg or the 'ansible_become_password' variable)"))
|
||||
becomecmd = cmd
|
||||
|
||||
elif self.become_method == 'doas':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue