ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.54k stars 3.35k forks source link

Feature: Programmable surveys #20

Open wenottingham opened 6 years ago

wenottingham commented 6 years ago

AWX Feature Spec - Programmable Surveys

User Persona

Administrator delegating jobs to user Delegated automation user

Usage Cases

High-level:

API Considerations

We must keep the survey JSON specification stable, or CLEARLY notify users when it changes. This may require a v2 survey spec.

http://json-schema.org/ may be of use.

UI/UX Considerations

Larger surveys should have options to collapse questions until needed. (c.f. https://github.com/ansible/awx/issues/290)

Docs

Should have sample survey examples

QA Suggestions

Notes

Updates/Changelog

2017-09-06: initial/updated spec 2017-09-25: added note about collapsible surveys

j00bar commented 6 years ago

There's a happy medium to be found here between usable simplicity and encompassing an entire range of user possibilities in a JSON/YAML markup language. I'm going to strongly recommend that at most we support dependency chaining between fields and support data-url attributes for fields that GET option values given partial user provided input. Users writing their own logic in their own server-hosted microservices will allow almost anything the user can imagine without making an overly complicated schema.

llaan commented 6 years ago

I would really like to see this added as well. We're currently using Ansible to roll out stacks in AWS and we need to be able to select the application version to deploy which we want to populate from the version tags set on the available AMI's

ooasis commented 6 years ago

If you really need the feature now, take a look at a hack I did in #1408. That works for me.

stefanoabbate commented 5 years ago

I was looking for the same thing! This would be good to retrieve previously data stored by an AWX job.

sonjz commented 5 years ago

Some variables/lists I'd be interested in templating into a survey:

carrozzi commented 5 years ago

I'm not sure how I missed this before now, but just stumbled across this. I would really like this as well. We are trying to put together almost a wizard like interface to configure network devices. We already have a playbook that gathers data form devices and uses the REST API to build drop-down lists for surveys, but it would really be nice to have:

sumkincpp commented 5 years ago

Also would be great to have :

All cases might be covered with custom type of multichoice selector with values from fact or variable, where

Though, this doesn't cover REST API multichoices.

RcRonco commented 4 years ago

I would like to see this feature added as well

eliranw commented 4 years ago

I am part of a large company that needs this feature to switch their Ansible infrastructure completely from Rundeck to AWX, so I will be happy to see this implemented.

rfedida commented 4 years ago

We are a large enterprise that needs this feature asap.

ItayZviCohen commented 4 years ago

Would like to have that feature/ability as well. Every large company that I've worked for so far thought it's a mandatory feature for a Rundeck replacement. Currently my (very large) company wants to migrate all of our operations to AWX, and we can't without this feature.

MikeQ123 commented 4 years ago

I wrote python script to update surveys choices with tower-cli. In my case I need to automate updating backup files list in awx survey. This script can be easily adopted to any other tasks. Script can be executed by cron.

#!/usr/bin/python

import json
import os
import random
import string

######################
smb_creds='/etc/tower/smbcredentials.conf'
backup_path='\\\\\\\\backup01\\\\sql'
backup_folder='\\\\SRV-NAV18-SQL\\\\ASR_PROD\\\\'
survey_name='SBL Deploy ASOR Test Environment'
survey_question='DataBase backup file path'
#####################

cmd = 'smbclient ' + backup_path + ' -D ' + backup_folder + ' -A ' + smb_creds + ' -c ls 2>/dev/null | awk \'{print $1}\' | grep -e \'^\..*$\' -v | grep \'.bak\''
choices = ""

for file in os.popen(cmd).readlines():
    choices = choices + '\n' + backup_path + backup_folder + file.rstrip()
choices = choices[2:]
choices = choices.replace('\\\\','\\')

cmd = 'tower-cli job_template survey -n "' + survey_name + '"'
survey_content = os.popen(cmd).read()

survey_obj = json.loads(survey_content)

for question in survey_obj['spec']:
    if question["question_name"] == survey_question:
       question["choices"] = choices

filename='/tmp/' + ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(5)) + '.json'
f = open(filename, "w")
f.write(json.dumps(survey_obj, sort_keys=True, indent=4))
f.close()

cmd = 'tower-cli job_template modify -n "' + survey_name + '" --survey-spec=@' + filename + ' --survey-enabled=true'

survey_mod = os.popen(cmd).read()
os.remove(filename)
Spreadcat commented 4 years ago

I'd also like to put in my request to get this feature implemented. There are just many situations where external parameter need to be in a survey and the user has not the capacity to know all available values. As mentioned above I also see this requirement mostly in bigger enterprise setups. The workaround with the python script by MikeQ123 is a nice workaround though, which at least implements one part of the functionality. Thanks for that, Mike!

alex-mnt commented 4 years ago

+1

Vuader commented 4 years ago

+1

Dodofox commented 4 years ago

THAT is really what all my clients need !

markandrewj commented 4 years ago

This would be really useful. I was looking at dynamically creating a list of packages from a repository today for a survey drop down list. Initially for the project I am working on I tried using disablerepo: "*", enablerepo: "repoa, reopb, repoc", to try and allow some users to be able to self install packages from only the specified repositories via yum using an input box. When I tried to do this however the packages the user was trying to install had dependencies located in the main RHEL repositories. I have started to create a static list of packages the user can pick from. I was thinking it would be really nice if I could dynamically populate the list somehow. This is a bit different then some of the use cases listed in this issue, so I thought I would mention it. I will probably end up trying something like @MikeQ123 suggested.

uDuCkV commented 4 years ago

+1

markandrewj commented 4 years ago

I am not sure if this is helpful for people, but I tried modifying the survey_spec resource with the new awx-cli (since tower-cli is being depreciated), and it doesn't look like the action has been built in yet (unless there is a way to do it that wasn't documented). However, it was easy enough to just use a raw post request to the endpoint ('/api/v2/job_templates/{id}/survey_spec/). You can use a personal access token or basic auth (I used a token). You can find the JSON format the endpoint expects via the API documentation https://docs.ansible.com/ansible-tower/latest/html/towerapi/api_ref.html.

mviniciusleal commented 4 years ago

+1

gnuheidix commented 4 years ago

That feature would be awesome to have.

l3ender commented 4 years ago

Given the demand for this (add our organization to the list), is there anything in process to add this as a feature? What would need to be done to help move it forward?

kevev commented 4 years ago

Yes please add this. We just implemented Ansible and are very dissapointed that this feature does not exist.

henriavelabarbe commented 4 years ago

I want to believe referencing inventory variables in a dropdown list should not be so difficult to implement. That feature alone would help me a lot for my customer needs.

lloydwilke commented 4 years ago

I would also like to see this feature added as we are building plays with options based on the different roles and would ensure the user doesnt skip a field that needs to be completed

sbarbo01 commented 4 years ago

Lots of people ask for this feature. Planned in next release since other tools already allow that?

ghost commented 4 years ago

We need this feature too. Our case is mostly with communicating MySQL servers. It should go something like this (just one example, we need it for many other cases):

Survey Wizard | Step 1: Select DB host (available hosts from inventory group)
 >>> Execute Play/Task  that connects to a host, runs a query and registers a result list (ex. list of available databases on host)
Survey Wizard | Step 2: Select Database (dropdown)
>>> Execure Play/Task that runs a query on that DB and registers a result list (ex. list of tables)
Survey Wizard | Step 3: Select Tables (dropdown, multiselect)
>>> Execute Play/Task with gathered table info ...

It would be very nice and user friendly to have this feature.

lucasafonsokremer commented 4 years ago

+1

surajrahel commented 4 years ago

+1

joreast commented 4 years ago

+1

nickjmv commented 4 years ago

+1

fsdrw08 commented 4 years ago

I need similar feature to get user's client IP and resolve the hostname then run playbook to install software into their client computer. If AWX do not provide such feature, I had to learn some front-end programing to build a front-end web site to let user finish their request there.

BhavanaMS commented 4 years ago

Is this feature being implemented ?Can we expect it any time soon?

FrederikSuijs commented 4 years ago

+1

wenottingham commented 4 years ago

When there is a an update on progress, it will appear here.

vpopiol commented 3 years ago

Very important feature to have for reusability of playbooks. I would like to see a way for using the output of a playbook as options of a survey in a second playbook as part of a workflow.

vin-c commented 3 years ago

Needed here too for this usecase :

sbenita commented 3 years ago

It's super important feature to have user friendly jobs.

nathantabailey commented 3 years ago

+1 From another large enterprise user.

AdirShaubi commented 3 years ago

+1 Would really like to see this feature implemented, it’ll be very useful and time saving

Dumh1233 commented 3 years ago

Would like to see this feature soon, we need it badly in our large enterprise company. Will help us a lot!

kpanus commented 3 years ago

Actually this is one of very useful ansible playbook features. It's an essential feature for awx (and downstream tower) to be accepted by broader users. Currently we have headache with Tower deployment for some of our client use cases, due to lacking of this feature.

wenottingham commented 3 years ago

Actually this is one of very useful ansible playbook features

I'm not sure what you mean by this, because playbooks don't have surveys, dynamic, or otherwise. It's just a blob of extra variables.

SasBer commented 3 years ago

+1 Another example where Tower is too slow in standard features to be implemented. Especially considering the date when the case has been opened.

Brantlab commented 3 years ago

+1

timdenholm commented 3 years ago

+1

The-Abe commented 3 years ago

+1

fvzwieten commented 3 years ago

+1

Lextum commented 3 years ago

+1

ste-snape commented 3 years ago

some that would be useful in our environment as well, with ability to call Vmware for cluster datastore to them populate survey with dropdown