|
|
@ -27,6 +27,7 @@ This example is a simple demonstration that shows how to minimally run a couple
|
|
|
|
#!/usr/bin/env python
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
|
|
|
|
import shutil
|
|
|
|
from collections import namedtuple
|
|
|
|
from collections import namedtuple
|
|
|
|
from ansible.parsing.dataloader import DataLoader
|
|
|
|
from ansible.parsing.dataloader import DataLoader
|
|
|
|
from ansible.vars.manager import VariableManager
|
|
|
|
from ansible.vars.manager import VariableManager
|
|
|
@ -34,6 +35,7 @@ This example is a simple demonstration that shows how to minimally run a couple
|
|
|
|
from ansible.playbook.play import Play
|
|
|
|
from ansible.playbook.play import Play
|
|
|
|
from ansible.executor.task_queue_manager import TaskQueueManager
|
|
|
|
from ansible.executor.task_queue_manager import TaskQueueManager
|
|
|
|
from ansible.plugins.callback import CallbackBase
|
|
|
|
from ansible.plugins.callback import CallbackBase
|
|
|
|
|
|
|
|
import ansible.constants as C
|
|
|
|
|
|
|
|
|
|
|
|
class ResultCallback(CallbackBase):
|
|
|
|
class ResultCallback(CallbackBase):
|
|
|
|
"""A sample callback plugin used for performing an action as results come in
|
|
|
|
"""A sample callback plugin used for performing an action as results come in
|
|
|
@ -99,6 +101,9 @@ This example is a simple demonstration that shows how to minimally run a couple
|
|
|
|
if tqm is not None:
|
|
|
|
if tqm is not None:
|
|
|
|
tqm.cleanup()
|
|
|
|
tqm.cleanup()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Remove ansible tmpdir
|
|
|
|
|
|
|
|
shutil.rmtree(C.DEFAULT_LOCAL_TMP, True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. note:: Ansible emits warnings and errors via the display object, which prints directly to stdout, stderr and the Ansible log.
|
|
|
|
.. note:: Ansible emits warnings and errors via the display object, which prints directly to stdout, stderr and the Ansible log.
|
|
|
|
|
|
|
|
|
|
|
|