The AWX Project (AWX) is an open source community project. In addition, it’s the OpenSource version of the Ansible Tower software sponsored by Red Hat, that enables users to better control their Ansible project use in IT environments.
In this tutorial, we will show you how to use Survey to pass variables in user-friendly way, without the need to pass them from EXTRA VARIABLES box.
To begin, we are going to create a new ansible playbook to install httpd and copy the index.html
file, with a required variable called apache_custom_message
as a custom welcome message for our new website.
01- Download the playbook from the following Github link. to your project folder under the directory /var/lib/awx/projects/
02- Create a new job template for your project, here is our job template configuration :
03- After saving the job template, click ADD SURVEY
button and fill all the details as below:
-In our example we used a required prompt survey, a Text for the Answer Type
field with no minimum and default maximum length and a Default Answer
when the answer is not provided by the user.
04- To save the survey prompt, just click the +ADD
button and finaly the SAVE
button.
05- Click SAVE
again on the main Job Template page.
06- Launch the job template. When prompted, enter your desired custom message and click NEXT
button:
07- Once you have lunched the job template, you will be redirected to a job screen which is refreshing in realtime showing you the status of the job.
08- Once your job is successful, navigate to your website using the ip address of the host and you should see something like this, but with your own custom message.
Conclusion
In this tutorial, we have shown you how to use a Survey to set extra variables for the playbook in AWX Ansible Tower. For more information, you can now visit the official Ansible Tower Documentation page.
See Also:
4 comments
Hi,
thanks for your article which is great.
Do you know a way to put an URL to a browser that exactly pops up the survey window asking for the parameters ?
I would like to add this into the provisioning process, after Win 10 provisioning is finished, open the browser and asking the operator which for example which type of installation this is (Dev, Test, Prod) and other parameters.
I know that there is the api with the post function to launch a job with extra survey params, but I would like to use the existing input window from tower / awx to be shown to the user instead of programming my own.
Hi, unfortunatly it’s not possible to do that, you have to create your own code like php code + html page to do that using reset api
Is it possible to popup a survey input BETWEEN job templates in a workflow?
Hi,
It’s not possible to add survey between the job templates in a workflow.