From 871d91cf26bcb95e10ed8805331be31e335afa14 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Tue, 23 Jun 2020 14:52:03 +0100 Subject: [PATCH] Optimise linear strategy access to physical host variables Change from using variable manager to the var we already have for the physical host. This saves nearly 50% time for re-running playbooks/lxc-container-create.yml Change-Id: Ic50763f9c74746ef94925a4dd52d16e1f313711b --- strategy/linear.py | 2 +- tests/inventory | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/strategy/linear.py b/strategy/linear.py index 0da4e285..a56209b0 100644 --- a/strategy/linear.py +++ b/strategy/linear.py @@ -164,7 +164,7 @@ class StrategyModule(LINEAR.StrategyModule): host=host, caplevel=0 ) - physical_host_vars = self._variable_manager.get_vars(host=ph) + physical_host_vars = ph.get_vars() for item in ['ansible_host', 'container_address', 'address']: addr = physical_host_vars.get(item) if addr: diff --git a/tests/inventory b/tests/inventory index ac8ec7e7..2fd500c9 100644 --- a/tests/inventory +++ b/tests/inventory @@ -7,7 +7,7 @@ container2 container_name=container2 # This is used to test I75f9d0f55ecd875caa1bf608a77c92f950b679a1 [hosts] -localhost_alt +localhost_alt ansible_host=127.0.0.1 [all_containers] container3 container_name=container3