diff options
author | Matt Martz <matt@sivel.net> | 2017-10-03 16:59:37 +0200 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2017-10-04 17:50:10 +0200 |
commit | 2b08e00a540a538beafd66fc41f602baf1b61c18 (patch) | |
tree | 67e1827213de62e07113b7c80b087cc3a8abd127 /examples | |
parent | dont follow symlinks for inventories (diff) | |
download | ansible-2b08e00a540a538beafd66fc41f602baf1b61c18.tar.xz ansible-2b08e00a540a538beafd66fc41f602baf1b61c18.zip |
Update uptime.py example script with changes to the API. Fixes #31229
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/scripts/uptime.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/scripts/uptime.py b/examples/scripts/uptime.py index 5b92ed78dc..e27c5e83b2 100755 --- a/examples/scripts/uptime.py +++ b/examples/scripts/uptime.py @@ -3,7 +3,7 @@ from collections import namedtuple from ansible.executor.task_queue_manager import TaskQueueManager -from ansible.inventory import Inventory +from ansible.inventory.manager import InventoryManager from ansible.parsing.dataloader import DataLoader from ansible.playbook.play import Play from ansible.plugins.callback import CallbackBase @@ -33,21 +33,21 @@ def main(): host_list = ['localhost', 'www.example.com', 'www.google.com'] Options = namedtuple('Options', ['connection', 'module_path', 'forks', 'remote_user', 'private_key_file', 'ssh_common_args', 'ssh_extra_args', 'sftp_extra_args', - 'scp_extra_args', 'become', 'become_method', 'become_user', 'verbosity', 'check']) + 'scp_extra_args', 'become', 'become_method', 'become_user', 'verbosity', 'check', + 'diff']) # initialize needed objects - variable_manager = VariableManager() loader = DataLoader() 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) + become_user=None, verbosity=None, check=False, diff=False) passwords = dict() # create inventory and pass to var manager - inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=host_list) - variable_manager.set_inventory(inventory) + inventory = InventoryManager(loader=loader, sources=','.join(host_list)) + variable_manager = VariableManager(loader=loader, inventory=inventory) # create play with tasks play_source = dict( |