diff --git a/doc/source/user/jobs.rst b/doc/source/user/jobs.rst index eb42c71de0..72743478fd 100644 --- a/doc/source/user/jobs.rst +++ b/doc/source/user/jobs.rst @@ -511,6 +511,13 @@ executor running the job is available: The path to the working directory. + .. var:: inventory_file + + The path to the inventory. This variable is needed for jobs running + without a nodeset since Ansible doesn't set it for localhost, see + this `porting guide + `_ + .. _user_sitewide_variables: Site-wide Variables diff --git a/tests/fixtures/config/ansible/git/common-config/playbooks/check-vars.yaml b/tests/fixtures/config/ansible/git/common-config/playbooks/check-vars.yaml index ad077e597e..e0b087db10 100644 --- a/tests/fixtures/config/ansible/git/common-config/playbooks/check-vars.yaml +++ b/tests/fixtures/config/ansible/git/common-config/playbooks/check-vars.yaml @@ -15,6 +15,7 @@ - zuul.executor.src_root is defined - zuul.executor.log_root is defined - zuul.executor.work_root is defined + - zuul.executor.inventory_file is defined - name: Assert zuul.project variables are valid. assert: @@ -39,4 +40,4 @@ - vartest_job == 'vartest_job' - vartest_secret.value == 'vartest_secret' - vartest_site == 'vartest_site' - - base_var == 'base_var' \ No newline at end of file + - base_var == 'base_var' diff --git a/zuul/executor/server.py b/zuul/executor/server.py index 85447e5864..61d0cc10ad 100644 --- a/zuul/executor/server.py +++ b/zuul/executor/server.py @@ -1350,7 +1350,8 @@ class AnsibleJob(object): src_root=self.jobdir.src_root, log_root=self.jobdir.log_root, work_root=self.jobdir.work_root, - result_data_file=self.jobdir.result_data_file) + result_data_file=self.jobdir.result_data_file, + inventory_file=self.jobdir.inventory) nodes = self.getHostList(args) setup_inventory = make_setup_inventory_dict(nodes)