From 28c8e3b979a78d0c194b6384679ca84c7bab7351 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 17 Jul 2017 16:27:50 -0700 Subject: [PATCH] Add more information on variables in jobs We should mention all of the Zuul facilities which impact job content in this section. Normal variables and secrets were missing. Change-Id: I4be887656d5c7c50407b1c66f564243e8fdf7305 --- doc/source/user/jobs.rst | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/source/user/jobs.rst b/doc/source/user/jobs.rst index 78121bcc85..c2c376ee64 100644 --- a/doc/source/user/jobs.rst +++ b/doc/source/user/jobs.rst @@ -70,8 +70,41 @@ behavior. .. TODO: link to base job documentation and/or document src (and logs?) directory +Variables +--------- + +Any variables specified in the job definition are available as Ansible +host variables. They are added to the `vars` section of the inventory +file under the `all` hosts group, so they are available to all hosts. +Simply refer to them by the name specified in the job's `vars` +section. + +Secrets +~~~~~~~ + +Secrets also appear as variables available to Ansible. Unlike job +variables, these are not added to the inventory file (so that the +inventory file may be kept for debugging purposes without revealing +secrets). But they are still available to Ansible as normal +variables. Because secrets are groups of variables, they will appear +as a dictionary structure in templates, with the dictionary itself +being the name of the secret, and its members the individual items in +the secret. For example, a secret defined as:: + + - secret: + name: credentials + data: + username: foo + password: bar + +Might be used in a template as:: + + {{ credentials.username }} {{ credentials.password }} + +.. TODO: xref job vars + Zuul Variables --------------- +~~~~~~~~~~~~~~ Zuul supplies not only the variables specified by the job definition to Ansible, but also some variables from the executor itself. They