combining lookups with prompts to provide choice lists for ansible vars

Hello,

I am looking for a way to leverage Ansible Prompts directives to include choice lists, or even just to include a dynamic prompt based on the results of a url lookup.

This didn’t work:

  • hosts: all
    vars:
    directions: “North, South, East West”

vars_prompt:

  • name: “choice”
    prompt: “Pick a direction: {{ directions }}”

tasks:

  • debug: msg=" directions = {{ directions }} choice = {{ choice }}"

The prompt doesn’t replace the directions variable.

And this doesn’t seem to work either:

  • hosts: all
    vars:
    dir: “{{ lookup(‘pipe’, ‘./getDirFromUser.sh’) }}”

tasks:

  • debug: msg=" dir = {{ dir}} "

where the getDirFromuser.sh script would prompt for the direction.

Any thoughts on how I might be able to accomplish this?