problem meta: end_play with when conditional

33 views
Skip to first unread message

ryad9...@gmail.com

unread,
Feb 12, 2019, 11:11:57 AM2/12/19
to Ansible Project
Hi all,

I have a problem, i think there is a bug in ansible 2.8.0 but when i run this task :

- pause:
    prompt: "Voulez-vous effectuer ce deploiement ? (o/n)"
  register: response

- debug:
    msg: "deploiement effectue"
  when: response == "o"

-  meta: end_play
   when: response != "o"

The condition when: response != "0" not works !!

So, when i grab "o" for answer at the question "Voulez-vous effectuer ce deploiement ? (o/n)",  this task is play or he must exit !!

Why ?

Thank for your help guy !! :)


Pcis

unread,
Feb 12, 2019, 11:14:35 AM2/12/19
to Ansible Project
Could you show me what it does when you run it?

Jean-Yves LENHOF

unread,
Feb 12, 2019, 11:51:24 AM2/12/19
to ansible...@googlegroups.com, ryad9...@gmail.com
Le 2019-02-12 17:11, ryad9...@gmail.com a écrit :
> Hi all,
>
> I have a problem, i think there is a bug in ansible 2.8.0 but when i
> run this task :
>
> - pause:
> prompt: "Voulez-vous effectuer ce deploiement ? (o/n)"
> register: response
>
> - debug:
> msg: "deploiement effectue"
> when: response == "o"
>
> - meta: end_play
> when: response != "o"
>
> The condition WHEN: RESPONSE != "0" not works !!
>
> So, when i grab "o" for answer at the question "VOULEZ-VOUS EFFECTUER
> CE DEPLOIEMENT ? (O/N)", this task is play or he must exit !!
>
> Why ?
>
> Thank for your help guy !! :)
>


Perhaps because you don't read the documentation and instead said
there's a bug ;-)
You asks a lot of questions in little time on the list, try a little bit
to learn by yourself


A little more functionning sample should probably be :

- hosts: localhost
tasks:

- name: "Prompt it"
pause:
prompt: "Voulez-vous effectuer ce deploiement ? (o/n)"
register: response

- name: "Print value of register"
debug:
msg: "print value of register : {{ response }}"

- name: "Affiche si o est presse"
debug:
msg: "deploiement effectue"
when: response.user_input == "o"

- name: "Aller a la fin si o n est pas presse"
meta: end_play
when: response.user_input != "o"

- name: "This is something after it"
debug:
msg: "Print it"

Regards,

JYL

Jean-Yves LENHOF

unread,
Feb 12, 2019, 11:53:16 AM2/12/19
to ansible...@googlegroups.com, ryad9...@gmail.com
Le 2019-02-12 17:11, ryad9...@gmail.com a écrit :
> Hi all,
>
> I have a problem, i think there is a bug in ansible 2.8.0 but when i

And by the way, ansible 2.8.0 did'nt seem to exist yet... version 2.7.7
is the last stable release

Regards,

JYL


ryad9...@gmail.com

unread,
Feb 12, 2019, 11:59:04 AM2/12/19
to Ansible Project
Thank you very much Jean-Yves,

But i don't have a time, i must find solutions quickly.

And Documentation Ansible is so big and it's so difficult for find solution in this documentation.
When i write in recherche documentation ansible exemple "when", it's don't works recherche :/

Thank you !

Pcis

unread,
Feb 12, 2019, 12:00:54 PM2/12/19
to Ansible Project
I might be able to help you... If you can send the result of the code here
Reply all
Reply to author
Forward
0 new messages