From 2da63541b8ff2c8d16da57e2e9bfb4553f747490 Mon Sep 17 00:00:00 2001
From: Tristan Cacqueray <tdecacqu@redhat.com>
Date: Wed, 27 Jun 2018 00:41:39 +0000
Subject: [PATCH] log-inventory: remove inventory_file usage

Change-Id: Idb785fd23e15316ae52650ed2ce62fe296cfd8b7
---
 roles/log-inventory/tasks/main.yaml | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/roles/log-inventory/tasks/main.yaml b/roles/log-inventory/tasks/main.yaml
index 8c76d3580..b8b935c64 100644
--- a/roles/log-inventory/tasks/main.yaml
+++ b/roles/log-inventory/tasks/main.yaml
@@ -1,8 +1,3 @@
-- name: Set inventory_file fact
-  set_fact:
-    inventory_file: "{{ zuul.executor.inventory_file }}"
-  when: inventory_file is not defined
-
 - name: Ensure Zuul Ansible directory exists
   delegate_to: localhost
   run_once: true
@@ -10,8 +5,11 @@
     path: "{{ zuul_info_dir }}"
     state: directory
 
+# We don't use the ansible inventory_file variable because it is not defined
+# for nodeless job running on the executor directly:
+# https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.4.html#inventory
 - name: Copy ansible inventory to logs dir
   delegate_to: localhost
   copy:
-    src: "{{ inventory_file }}"
+    src: "{{ zuul.executor.inventory_file }}"
     dest: "{{ zuul_info_dir }}"