def __init__(self, argument_spec={}, **kwargs): super(FabricAnsibleModule, self).__init__(argument_spec=argument_spec, **kwargs) self.module_name = self._name self.ctx = self.params.get('job_ctx') self.logger = fabric_ansible_logger(self.module_name) self.logger.debug("Module params: {}".format(self.params))
def __init__(self, argument_spec={}, **kwargs): super(FabricAnsibleModule, self).__init__(argument_spec=argument_spec, **kwargs) self.module_name = self._name self.job_ctx = self.params.get('job_ctx') self.logger = fabric_ansible_logger(self.module_name) self.results = dict() self.results['failed'] = False self.logger.debug("Module params: {}".format(self.params)) self.job_log_util = None
def __init__(self, argument_spec={}, **kwargs): super(FabricAnsibleModule, self).__init__(argument_spec=argument_spec, **kwargs) self.module_name = self._name self.job_ctx = self.params.get('job_ctx') self.logger = fabric_ansible_logger(self.module_name) self.results = dict() self.results['failed'] = False self.logger.debug("Module params: {}".format(self.params)) self.job_log_util = None self._job_file_write = JobFileWrite(self.logger)
def __init__(self, argument_spec={}, **kwargs): """Init routine for custom ansible module.""" super(FabricAnsibleModule, self).__init__(argument_spec=argument_spec, **kwargs) self.module_name = self._name self.job_ctx = self.params.get('job_ctx') self.logger = fabric_ansible_logger(self.module_name) self.results = dict() self.results['failed'] = False self.logger.debug("Module params: {}".format(self.params)) self.job_log_util = None self._job_file_write = JobFileWrite(self.logger)
from ansible import constants as CONST verbosity = CONST.DEFAULT_VERBOSITY or 0 # 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 # from job_manager.fabric_logger import fabric_ansible_logger from job_manager.job_utils import ( JobFileWrite, PLAYBOOK_EOL_PATTERN ) logger = fabric_ansible_logger("ansible") # Overrides the default display processing from ansible/utils/display.py # The default display method supresses certain output for remote hosts # while we want this information sent to the logs # def fabric_ansible_display(self, msg, color=None, stderr=False, screen_only=False, log_only=False): """ Display a message to the user Note: msg *must* be a unicode string to prevent UnicodeError tracebacks. """ nocolor = msg
import argparse 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[