Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Programmable surveys #20

Open
wenottingham opened this issue Sep 6, 2017 · 97 comments
Open

Feature: Programmable surveys #20

wenottingham opened this issue Sep 6, 2017 · 97 comments

Comments

@wenottingham
Copy link
Contributor

wenottingham commented Sep 6, 2017

AWX Feature Spec - Programmable Surveys

User Persona

Administrator delegating jobs to user
Delegated automation user

Usage Cases

High-level:

  • Administrator wants to present to the user a list of builds to choose to deploy.
  • Administrator wants to present to the user a verified list of configuration parameters to push to the chosen network devices.
  • Adminsitrator wants to present survey chocies that depend on prior survey choices, such as a choice to select an AWS region based on 'AWS' being a prior survey answer.

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. #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
Copy link
Contributor

j00bar commented Oct 3, 2017

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
Copy link

llaan commented Feb 21, 2018

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
Copy link

ooasis commented Mar 1, 2018

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

@stefanoabbate
Copy link

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

@sonjz
Copy link

sonjz commented Jul 31, 2018

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

  • Current User in AWX (and less-so User Lists)
  • Inventory Host Lists
  • Inventory Group Lists

@carrozzi
Copy link

carrozzi commented Aug 3, 2018

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:

  • The ability to pick a switch from a list and have that then change the options for the interface question to those on the chosen switch

  • have certain questions appear only if the answer to a previous question is a certain value.
    I see no one is assigned this yet, but has anyone worked towards it? (aside from Quick dynamic options hack #1408 ) I'd definitely be willing to help out, but I haven't had the chance to dig into the code yet.

@sumkincpp
Copy link
Contributor

Also would be great to have :

  • Inventory lists

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

  • "{{ awx_users }}" for awx users can be used
  • "{{ awx_inventories }}" for inventories can be used
  • "{{ awx_hosts }}" or something with jinja filter for hosts from current inventories

Though, this doesn't cover REST API multichoices.

mabashian pushed a commit to mabashian/awx that referenced this issue Jun 28, 2019
@RcRonco
Copy link

RcRonco commented Aug 5, 2019

I would like to see this feature added as well

@eliranw
Copy link

eliranw commented Aug 6, 2019

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
Copy link

rfedida commented Aug 6, 2019

We are a large enterprise that needs this feature asap.

@ItayZviCohen
Copy link

ItayZviCohen commented Aug 19, 2019

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
Copy link

MikeQ123 commented Aug 23, 2019

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
Copy link

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
Copy link

alex-mnt commented Oct 2, 2019

+1

1 similar comment
@Vuader
Copy link

Vuader commented Oct 18, 2019

+1

@Aprakash35
Copy link

Hi,
We are also look for this feature available in UI, please say is this request full filled or its working upon. Or any suggestions to achieve from tower 🗼.

Thanks in advance 🙏.

@bastolino
Copy link

Maybe as a Crossreference for all Ansible Tower / Ansible Automation Platform (AAP) Users who wish to have this feature implemented:
You could open up a Support Ticket at RH to upvote https://issues.redhat.com/browse/AAPRFE-252.

kdelee pushed a commit that referenced this issue Mar 8, 2023
…4 goes in

linting

linting again

Use the correct role on org permission check

Co-authored-by: Elijah DeLee <kdelee@redhat.com>

Update docs/bulk_api.md

Co-authored-by: Elijah DeLee <kdelee@redhat.com>

Update docs/bulk_api.md

Co-authored-by: Elijah DeLee <kdelee@redhat.com>

Update awx/main/access.py

Co-authored-by: Elijah DeLee <kdelee@redhat.com>

Update awx/main/access.py

Co-authored-by: Elijah DeLee <kdelee@redhat.com>

Update docs/bulk_api.md

Co-authored-by: Alan Rominger <arominge@redhat.com>

fix collection test (#19)

improve readability of through model object creation (#18)

lower num jobs/hosts in tests (#20)

we can test query scaling at lower numbers, to reduce
load in tests. We suspect this was causing some flake
in the tests on PRs

adjust the num of queries
@DBAverage
Copy link

+1

2 similar comments
@alice-rc
Copy link

+1

@fferraro87
Copy link

+1

@bastolino
Copy link

Maybe as a Crossreference for all Ansible Tower / Ansible Automation Platform (AAP) Users who wish to have this feature implemented: You could open up a Support Ticket at RH to upvote https://issues.redhat.com/browse/AAPRFE-252.

This Issue has been closed as duplicate, there is a (RH internal) successor: https://issues.redhat.com/browse/AAP-3502
So you would need to upvote the successor now...

@ffirg
Copy link

ffirg commented Apr 5, 2023

There is no need to upvote anything else as we are already aware this is a very popular feature request and have it on our planning list for consideration during the forthcoming dev cycles. If we have a fair wind and the opportunity to do this, it'll happen without further +1s etc.

@abenokraitis
Copy link
Collaborator

@ffirg Is it fair to say that PRs are welcome from the community on this until then?

@ffirg
Copy link

ffirg commented Apr 5, 2023

I'd welcome feedback on what functionality people want to see in this for sure.

@DBAverage
Copy link

I'd welcome feedback on what functionality people want to see in this for sure.

I'm interested in a few things that I think will make AWX far more useful in a large enterprise setting:

  1. Being able to run some arbitrary code in order to generate a list of selectable options for a drop down in a survey. Ideally we could also:

    • Cache the result for a period of time, and/or regenerate it at selected intervals
    • Access other selected input variables in our arbitrary code

    A few use case examples:

    • populating a list of existing users from active directory to be selected as an input
    • populating a list of database instances available in the company, or available on a specific host
  2. Being able to run some arbitrary code, and/or apply a regex to validate selected input. I can do this in my playbook as well, but the experience for the calling user is poor in that situation.

    A few use case examples:

    • Verifying an active directory user exists
    • Verifying an instance/database exists on a host
    • Verifying a URL path is in the correct format
    • Verifying from an external system that the submitter is authorized to interact with an endpoint specified in the input parameter

Thank you!

@KristofStroobants
Copy link

I need to make an automation to deploy new VMs.
Let's say we have 3 variables Name, Platform & SLA.

Now, only when the user picks the value Productionfrom the Platform option, i want the SLAfield to be presented.

As of now, is there any way of doing this?

@ffirg
Copy link

ffirg commented Apr 18, 2023

Thanks for the input @DBAverage and @KristofStroobants. It's been added to my design doc for consideration into the feature when we're able to land it.

@WebSpider
Copy link

WebSpider commented Apr 21, 2023

Additional usecase:

Workflow Job Template needs user-interaction to select which host to run on from inventory. Reason for this is to produce additional debug information for troubleshooting issues that occur on the host.
For simplicity, we're using surveys for this purpose. This means the list of choices in the survey spec should be related to the inventory, but as of now there doesn't seem a possibility to set the (filtered?) value of an inventory as a source for a choices-field.

We're working around this by having an awx job that rewrites the survey field on interval, but it certainly would be more elegant to have this based on dynamic inclusions of data already present in awx.

@williamhanseneric
Copy link

Solve this problem, and in my humble opinion you can make a legitimate argument to replace vRealize Automation... easily being able to configure dynamic survey forms that populate on dropdown via internal Ansible scripts (which make REST calls externally) are a real need.

@isopy
Copy link

isopy commented Aug 31, 2023

I need to make an automation to deploy new VMs. Let's say we have 3 variables Name, Platform & SLA.

Now, only when the user picks the value Productionfrom the Platform option, i want the SLAfield to be presented.

As of now, is there any way of doing this?

Upvoting the need for this functionality.

@abhijeet-AT
Copy link

I exactly want this https://ansibleforms.com/ inside AAP/AWX/Ansible Tower.

@MalfuncEddie
Copy link

I exactly want this https://ansibleforms.com/ inside AAP/AWX/Ansible Tower.

you win the internet in my book today!

@fosterseth
Copy link
Member

@chadmf more recent community requests for this feature, just in case you hadn't seen this 2017 RFE

@abhijeet-AT
Copy link

while waiting for this feature to be available I have created a role which based on text files updates values for dropdowns in particular job template. The values must be comma separated and one per line. One text file per question. One JT with multiple questions can be updated with this role at a time.

@itsBryantP
Copy link

+1 I'd also like to see this feature implemented.

@from88
Copy link

from88 commented Nov 14, 2023

has anyone a workaround for this ?

@nx2804
Copy link

nx2804 commented Jan 5, 2024

I would also need this feature any update ?

@leamese
Copy link

leamese commented May 6, 2024

We have multiple use cases that could benefit from this.

@TheRealHaoLiu
Copy link
Member

no clue what I'm getting myself into and how complicated this feature is gonna be but lets give it a shot

open a forum topic to discuss this https://forum.ansible.com/t/programable-survey-feature-in-awx/5806/2

@bastolino
Copy link

As an additional information: https://access.redhat.com/solutions/7068218
(AAP is a downstream project of AWX)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests