In this demo, we will examine surveys.
We will add a survey to an existing template and fill out the required details.
So under the RESOURCES section, we can select a template, and
we're going to use an existing template. At the very end of the
write, we have the option of adding a survey. So a survey is a
prompt that results in a variable.
Here we have a prompt, description, that is optional, the answer
variable name, and answer type. And you should have a description, as
this will make it much easier for the user that is prompted,
especially if they are less technical.
In our case, we have a prompt, we have the username, we'll
select to describe, which we'll describe the user to create, and
then we'll have the answer variable.
This is the name of the variable that you're going to create, and
when you hover over the question mark, you will have some guidelines
here, and the variable we will use will be username. Then we'll have
answer types, and here we'll have a list from Text down to Float, and
these are the different types of variables, and for our case I will
select Text.
Now, let us go back to the template, and we can run the template, and we have a
survey that pops up, and here we're asked to create a user called Gina, and
then it launches, and then we have a preview first.
So within the job template, we could define variables in YAML and JSON
format, and we can also select prompt on launch if we wish to.
So surveys are really easy and more of a user‑friendly way, and allows
dynamic variables to be placed in your playbook.
So when we actually go in and launch this template,
you will see on the left‑hand side we have the section at the bottom left,
which is the extra variables of the username parameter
which we have specified in the survey.