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