diff --git a/callback_plugins/custom_logger.py b/callback_plugins/custom_logger.py index 8e1c109e..19bc706f 100644 --- a/callback_plugins/custom_logger.py +++ b/callback_plugins/custom_logger.py @@ -17,6 +17,16 @@ - Log file names: - test_run_result.out - summary_results.log + options: + output_dir: + description: todo + ini: + - section: custom_logger + key: output_dir + env: + - name: CUSTOM_LOGGER_OUTPUT_DIR + default: "." + type: path ''' class CallbackModule(CallbackBase): @@ -31,9 +41,11 @@ class CallbackModule(CallbackBase): def __init__(self): super(CallbackModule, self).__init__() - self.output_dir = os.path.expanduser("~/") - self.results = {} + self.set_options() + self.output_dir = self.get_option('output_dir') + self.results = {} + def playbook_on_stats(self, stats): #Log results for each host hosts= stats.processed @@ -89,4 +101,4 @@ def v2_runner_on_failed(self, result, ignore_errors=False): def v2_runner_on_skipped(self, result): host = result._host.get_name() task_name = result._task.get_name() - self.log_task_result(host, 'skipped', task_name) \ No newline at end of file + self.log_task_result(host, 'skipped', task_name) diff --git a/ci/ansible.cfg b/ci/ansible.cfg index 3c9d90c0..ff9d632d 100644 --- a/ci/ansible.cfg +++ b/ci/ansible.cfg @@ -3,3 +3,6 @@ callbacks_enabled = custom_logger callback_plugins = ../callback_plugins # additional paths to search for roles roles_path = ../roles:/usr/share/ansible/roles:/etc/ansible/roles:~/.ansible/roles:../../ci-framework/roles + +[custom_logger] +output_dir = /$HOME