diff --git a/tests/lib/hardware/hardware_base.py b/tests/lib/hardware/hardware_base.py index 5532b9ad..5256fddb 100644 --- a/tests/lib/hardware/hardware_base.py +++ b/tests/lib/hardware/hardware_base.py @@ -151,15 +151,22 @@ def ansible_run_playbook(self, playbook: str, else: limit = "" + extra_vars_files="" # Supplied extra_vars from settings always take precedence if settings.ANSIBLE_EXTRA_VARS: - extra_vars.update(json.loads(settings.ANSIBLE_EXTRA_VARS)) + if settings.ANSIBLE_EXTRA_VARS.startswith('@'): + extra_vars_files=settings.ANSIBLE_EXTRA_VARS + else: + extra_vars.update(json.loads(settings.ANSIBLE_EXTRA_VARS)) if extra_vars: extra_vars_param = f"--extra-vars '{json.dumps(extra_vars)}'" else: extra_vars_param = "" + if extra_vars_files: + extra_vars_param += f" --extra-vars '{extra_vars_files}'" logger.info(f'Running playbook {path} ({limit})') + logger.info(f'Using extra vars: {extra_vars_param}') self.workspace.execute( f"ansible-playbook -i {self._ansible_inventory_dir} " f"{limit} {extra_vars_param} {path}",