Skip to content

Commit

Permalink
[backport][release_2.2] Add examples for status_handler and event_han…
Browse files Browse the repository at this point in the history
…dler (ansible#1091)

Fixes: ansible#1078

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
  • Loading branch information
Akasurde committed Jun 6, 2022
1 parent 4c614e0 commit fef8f3e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/python_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,28 @@ Usage examples
print("Final status:")
print(r.stats)
.. code-block:: python
import ansible_runner
def my_status_handler(data, runner_config):
# Do something here
print(data)
r = ansible_runner.run(private_data_dir='/tmp/demo', playbook='test.yml', status_handler=my_status_handler)
.. code-block:: python
import ansible_runner
def my_event_handler(data):
# Do something here
print(data)
r = ansible_runner.run(private_data_dir='/tmp/demo', playbook='test.yml', event_handler=my_event_handler)
.. code-block:: python
import ansible_runner
Expand Down

0 comments on commit fef8f3e

Please sign in to comment.