On 14.09.2019 17:55, Damon Powell wrote:
This was also throwing me off, it would be nice if there was a way around
it as well.

Even though the logic is working and node1 stops after the check, the block output displays the same msg for all hosts. I would have thought that this would only show the msg for node1 as thats the node thta meets the end_host check. Node2 continues to run all other checks but the message is confusing
as it first looks like its skipping both hosts but its really not.

TASK [end play for host host if nothing to upgrade]
****************************
ok: [node1.test.com] => {
    "msg": "Nothing to upgrade, ending play for host"
}
ok: [node2.test.com] => {
    "msg": "Nothing to upgrade, ending play for host"
}

That's because your when: is indented to fare.
It need to be on the same level as the block.


    - block:
        - name: "end play for host host if nothing to upgrade"
          debug:
            msg: "nothing to upgrade, ending play for host"

        - meta: end_host
          when: package_precheck.stdout > 0

As you can see, the when is only on meta task so the debug in the block will always run.

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f737f0967f4656eaa8858610f85ee4fd%40olstad.com.

Reply via email to