mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix for sudo defaults if sudo is passed in via --extra-vars
This commit is contained in:
parent
7d7ff9d616
commit
a768e9a9ff
2 changed files with 12 additions and 2 deletions
|
@ -68,8 +68,9 @@ class Task(object):
|
|||
self.name = ds.get('name', None)
|
||||
self.tags = [ 'all' ]
|
||||
self.register = ds.get('register', None)
|
||||
self.sudo = ds.get('sudo', play.sudo)
|
||||
if self.sudo is True:
|
||||
self.sudo = utils.boolean(ds.get('sudo', play.sudo))
|
||||
|
||||
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:
|
||||
|
|
|
@ -499,3 +499,12 @@ def get_available_modules(dirname=None):
|
|||
modules_list.update(os.listdir(path))
|
||||
modules_list = list(modules_list)
|
||||
return modules_list
|
||||
|
||||
def boolean(value):
|
||||
val = str(value)
|
||||
if val.lower() in [ "true", "t", "y", "1", "yes" ]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue