Re: [ansible-project] Iterate through user input data

2017-01-05 Thread Brian Coca
The `pause` module can prompt and use the responses for a more
'interactive' play. So for example, you can use `stat` to check if the
directory exists and `pause` to ask what to do next.


--
Brian Coca

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7d4r7OArExyB45aJADt4QwFVAAOcUE2pswctqJ4fMfZZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Iterate through user input data

2016-12-29 Thread Kai Stian Olstad

On 24. des. 2016 22:37, Ahmed Jaad wrote:

Im a newbie to ansible, and im trying to write an ansible script which
would continuously prompt user to insert data and use the data to perform
some tasks until the user decides to end the loop, a shell script serving
the same purpose would look like this.

read -s -p "Create new directory? y/n: " response while [[ "$response" == "y" ]] do read -s -p "Enter 
the name of direcory: " name mkdir $name if [ $? -ne 0 ] then echo "Failed to create new directory $name" exit 1 fi read -s 
-p "Create another new directory? y/n: " response done

so how do i go about this?


It's not possible with Ansible, Ansible have prompts
https://docs.ansible.com/ansible/playbooks_prompts.html
But this is question you will have to ask and answer upfront before 
playbook the rest of the playbook get executed.


--
Kai Stian Olstad

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/64296fe5-6f49-de5a-fe86-e46228df2ef1%40olstad.com.
For more options, visit https://groups.google.com/d/optout.