Hi,

should this work:

  tasks:
  - name: test
    shell: uname -a
    when:  env == "test"

  - name:  test 1
    file: path=/opt/test.txt state=touch
    when: env == "test1"
    register: test_1

  - name: test 2
    file: path=/opt/test2 state=touch
    when: test_1 is defined


Task "test 1" should run, if some conditional is true.
Depending on if it runs, task "test 2" should run.
That's why i registered a variable test_1.

The result is, that "test 1" ist skipped", because env != "test" (as expected; OK). But "test 2" does run too.

I could use a handler, but that does only run after all the tasks, which why I have to change the running order. Is there another way?


Marc

--
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/55005A0C.2010707%40ofd-z.niedersachsen.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to