X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=apex%2Fcommon%2Futils.py;h=013c7ac8ea1026ec9bc6e031e12158ad69ac7e16;hb=10c4d35315d7ffd909520a1c7bc6a3b5b9b871ab;hp=2ac900a3c66d3cd110f6f605e057426edc3dd27e;hpb=ae22c3358b53a68b68de7d3ac5d6f56a1c384b61;p=apex.git diff --git a/apex/common/utils.py b/apex/common/utils.py index 2ac900a3..013c7ac8 100644 --- a/apex/common/utils.py +++ b/apex/common/utils.py @@ -75,12 +75,17 @@ def run_ansible(ansible_vars, playbook, host='localhost', user='root', Executes ansible playbook and checks for errors :param ansible_vars: dictionary of variables to inject into ansible run :param playbook: playbook to execute + :param host: inventory file or string of target hosts + :param user: remote user to run ansible tasks :param tmp_dir: temp directory to store ansible command :param dry_run: Do not actually apply changes :return: None """ logging.info("Executing ansible playbook: {}".format(playbook)) - inv_host = "{},".format(host) + if not os.path.isfile(host): + inv_host = "{},".format(host) + else: + inv_host = host if host == 'localhost': conn_type = 'local' else: