import ansible.utils.display as default_display default_display.logger = logger default_display.Display.display = fabric_ansible_display from ansible.utils.display import Display display = Display(verbosity) from ansible.parsing.dataloader import DataLoader from ansible.vars.manager import VariableManager from ansible.inventory.manager import InventoryManager from ansible.executor.playbook_executor import PlaybookExecutor from job_manager.job_messages import MsgBundle from job_manager.job_manager_logger import job_mgr_logger JM_LOGGER = job_mgr_logger("FabricAnsible") class PlaybookHelper(object): def __init__(self): self._job_file_write = JobFileWrite(logger) def get_plugin_output(self, pbex): output_json = pbex._tqm._variable_manager._nonpersistent_fact_cache[ 'localhost'].get('output') return output_json def execute_playbook(self, playbook_info): output = None try:
from collections import namedtuple import ansible.utils.display as default_display from ansible.parsing.dataloader import DataLoader from ansible.vars.manager import VariableManager from ansible.inventory.manager import InventoryManager from ansible.executor.playbook_executor import PlaybookExecutor from ansible.utils.display import Display from ansible import constants as CONST from job_manager.job_messages import MsgBundle from job_manager.fabric_logger import fabric_ansible_logger from job_manager.job_manager_logger import job_mgr_logger logger = fabric_ansible_logger("ansible") JM_LOGGER = job_mgr_logger("FabricAnsible") # Overrides the default logger from ansible/utils/display.py. # fabric_ansible_logger customizes log message formatting # Note that some internal ansible code inherits "display" from __main__, # which is this file. # Also note that CONST is from ansible.cfg verbosity = CONST.DEFAULT_VERBOSITY or 0 default_display.logger = logger display = Display(verbosity) class PlaybookHelper(object): def get_plugin_output(self, pbex): output_json = pbex._tqm._variable_manager._nonpersistent_fact_cache[ 'localhost']['output']