The following is pseudo code, parts of it may not be entirely correct.
But the real trick is to use when.

==
- name: ask for variable
   when: my_var_name is not defined
   register: my_var_name_result
   vars_prompt: .....

- name: save vars
   when: my_var_name_result.changed
   $action:

==

On 01/28/2014 08:42 AM, Michael DeHaan wrote:
There's no mechanism for this.

vars_prompt always prompts for the variable.




On Tue, Jan 28, 2014 at 9:25 AM, Marcin Prączko
<marcin.prac...@gmail.com <mailto:marcin.prac...@gmail.com>> wrote:

    Hi,

    Have question whether is possible (ansible 1.4.2 >) setup prompt for
    volue for variable in variable is not defined.

    For example:
    First run of playbook:
    - variable is not defined
    - ask for value
    - task write value of variable to some ansible vars file

    ... Do other tasks...

    Next run of playbook:
    - variable is read from ansible vars file
    - no prompt for value


    ... Do other tasks ....

    Tried find this in ansible help, but so far no luck.

    Best regards,
    Marcin Praczko

    --
    You received this message because you are subscribed to the Google
    Groups "Ansible Project" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to ansible-project+unsubscr...@googlegroups.com
    <mailto:ansible-project%2bunsubscr...@googlegroups.com>.
    To post to this group, send email to
    ansible-project@googlegroups.com
    <mailto:ansible-project@googlegroups.com>.
    For more options, visit https://groups.google.com/groups/opt_out.




--
Michael DeHaan <mich...@ansibleworks.com <mailto:mich...@ansibleworks.com>>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

--
You received this message because you are subscribed to the Google
Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to