combining lookups with prompts to provide choice lists for ansible vars

87 views
Skip to first unread message

Chris Ratcliffe

unread,
Apr 11, 2017, 7:11:35 PM4/11/17
to Ansible Project
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?

Reply all
Reply to author
Forward
0 new messages