From f7ff28336d4922ac23e8e180d83469f9d79ae315 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 21 Dec 2016 21:00:18 -0600 Subject: [PATCH] Correctly set loader path when using list tags/tasks Fixes #19398 (cherry picked from commit b688f1147474df7ab0c42a62f8c8258edcd9b425) --- lib/ansible/cli/playbook.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/cli/playbook.py b/lib/ansible/cli/playbook.py index ec3a91776e..c1983b3649 100644 --- a/lib/ansible/cli/playbook.py +++ b/lib/ansible/cli/playbook.py @@ -158,6 +158,12 @@ class PlaybookCLI(CLI): display.display('\nplaybook: %s' % p['playbook']) for idx, play in enumerate(p['plays']): + if play._included_path is not None: + loader.set_basedir(play._included_path) + else: + pb_dir = os.path.realpath(os.path.dirname(p['playbook'])) + loader.set_basedir(pb_dir) + msg = "\n play #%d (%s): %s" % (idx + 1, ','.join(play.hosts), play.name) mytags = set(play.tags) msg += '\tTAGS: [%s]' % (','.join(mytags))