diff --git a/strategy/linear.py b/strategy/linear.py index 0454c62b..e27612f4 100644 --- a/strategy/linear.py +++ b/strategy/linear.py @@ -126,7 +126,7 @@ class StrategyModule(LINEAR.StrategyModule): _play_context = copy.deepcopy(play_context) pha = task_vars['physical_host_addrs'] = dict() - physical_host_item = host.vars.get('physical_host') + physical_host_item = task_vars.get('physical_host') if physical_host_item: LINEAR.display.verbose( u'The "physical_host" variable was found.', diff --git a/tests/host_vars/container3.yml b/tests/host_vars/container3.yml index 038607c7..789931d8 100644 --- a/tests/host_vars/container3.yml +++ b/tests/host_vars/container3.yml @@ -16,3 +16,7 @@ ansible_host: 10.100.100.4 ansible_become: True ansible_user: root + +# Test case to validate I3798529cf2bf73afbff2d2ef0f3fe17d91123fbc +# Ensure physical_host can be defined in group/host vars +physical_host: localhost_alt diff --git a/tests/inventory b/tests/inventory index f82c6dc4..5f58281f 100644 --- a/tests/inventory +++ b/tests/inventory @@ -9,7 +9,7 @@ container2 [hosts] localhost_alt [all_containers] -container3 physical_host=localhost_alt +container3 # This is meant to test If594914df53efacc6d5bba148f4f46280f5a117d [fake_hosts]