problem meta: end_play with when conditional

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 !! :slight_smile:

Could you show me what it does when you run it?

Perhaps because you don't read the documentation and instead said there's a bug :wink:
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

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

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 :confused:

Thank you !

I might be able to help you... If you can send the result of the code here