From 5831207666e980b1f3db908d2738b2f1868f707b Mon Sep 17 00:00:00 2001 From: Andrew Biryukov Date: Wed, 13 Mar 2024 19:38:33 +0300 Subject: [PATCH] add ability to specify path to ansible-playbook binary file in runner --- src/cotea/runner.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cotea/runner.py b/src/cotea/runner.py index 12dc95f..2295e77 100644 --- a/src/cotea/runner.py +++ b/src/cotea/runner.py @@ -35,7 +35,8 @@ class runner: - def __init__(self, pb_path, arg_maker, debug_mod=None, show_progress_bar=False): + def __init__(self, pb_path, arg_maker, debug_mod=None, show_progress_bar=False, + ansible_pb_bin="/usr/local/bin/ansible-playbook"): logging_lvl = logging.INFO if debug_mod: logging_lvl= logging.DEBUG @@ -64,6 +65,8 @@ def __init__(self, pb_path, arg_maker, debug_mod=None, show_progress_bar=False): self.progress_bar = ansible_progress_bar() self.execution_tree = AnsibleExecTree() + self.ansible_pb_bin = ansible_pb_bin + self._set_wrappers() start_ok = self._start_ansible() self.logger.debug("Ansible start ok: %s", start_ok) @@ -133,7 +136,7 @@ def _except_hook(self, args, /): def _start_ansible(self): args = self.arg_maker.args - args.insert(0, "/usr/local/bin/ansible-playbook") + args.insert(0, self.ansible_pb_bin) args.insert(1, self.pb_path) self.pbCLI = PlaybookCLI(args) @@ -363,7 +366,7 @@ def get_all_error_msgs(self): return self.update_conn_wrapper.error_msgs - # returns last error msg that wasn't ignored + # returns last error msg that wasn't ignored def get_error_msg(self): res = ""