mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update example uptime script to provide correct type for explicit individual hosts (#34740)
This commit is contained in:
parent
8f1ab70cf2
commit
d72587084b
1 changed files with 7 additions and 2 deletions
|
@ -35,10 +35,15 @@ def main():
|
|||
'private_key_file', 'ssh_common_args', 'ssh_extra_args', 'sftp_extra_args',
|
||||
'scp_extra_args', 'become', 'become_method', 'become_user', 'verbosity', 'check',
|
||||
'diff'])
|
||||
# required for
|
||||
# https://github.com/ansible/ansible/blob/devel/lib/ansible/inventory/manager.py#L204
|
||||
sources = ','.join(host_list)
|
||||
if len(host_list) == 1:
|
||||
sources += ','
|
||||
|
||||
# initialize needed objects
|
||||
loader = DataLoader()
|
||||
options = Options(connection='smart', module_path='/usr/share/ansible', forks=100,
|
||||
options = Options(connection='smart', module_path=['/usr/share/ansible'], forks=100,
|
||||
remote_user=None, private_key_file=None, ssh_common_args=None, ssh_extra_args=None,
|
||||
sftp_extra_args=None, scp_extra_args=None, become=None, become_method=None,
|
||||
become_user=None, verbosity=None, check=False, diff=False)
|
||||
|
@ -46,7 +51,7 @@ def main():
|
|||
passwords = dict()
|
||||
|
||||
# create inventory and pass to var manager
|
||||
inventory = InventoryManager(loader=loader, sources=','.join(host_list))
|
||||
inventory = InventoryManager(loader=loader, sources=sources)
|
||||
variable_manager = VariableManager(loader=loader, inventory=inventory)
|
||||
|
||||
# create play with tasks
|
||||
|
|
Loading…
Reference in a new issue