Пример #1
0
def run_task_call_callback(module_name, module_path, inventory_path, subset, extra_vars, event_callback):
    callbacks_object = EmitterCallbacks(event_callback)
    runner = Runner(
        module_name     =   module_name,
        module_path     =   module_path,
        inventory       =   Inventory(inventory_path),
        module_args     =   extra_vars,
        callbacks       =   callbacks_object,
        subset          =   subset
    )
    results = runner.run()
    callbacks_object.on_complete()
Пример #2
0
def run_playbook_call_callback(playbook_path, inventory_path, subset, extra_vars, event_callback):
    callbacks_object = EmitterCallbacks(event_callback)
    stats = callbacks.AggregateStats()
    pb = PlayBook(
        playbook         =   playbook_path,
        host_list        =   inventory_path,
        callbacks        =   callbacks_object,
        runner_callbacks =   callbacks_object,
        stats            =   stats,
        extra_vars       =   extra_vars,
        subset           =   subset
    )
    results = pb.run()
    # TODO: use the result of AggregateStats - must be converted to a dict object
    callbacks_object.on_complete()