Perhaps you can use a 'register' in your task to get the results which
can then be used as a condition in a 'when' statement in the next task?
Here's the content of a register var when a group is already installed:
TASK: [debug var=yum_results] ***
ok: [test.local] => {
"yum_results": {
"changed": true,
"invocation": {
"module_args": "name='@development' state=latest",
"module_name": "yum"
},
"msg": "",
"rc": 0,
"results": [
"No packages marked for update\n"
]
}
}
In the next task use a 'when' condition that "No packaged marked for
update" should be <what you need>:
- name: next task
yum: name=otherpackage state=latest
when: yum_results.results.find('No packages marked for update') = -1
The 'when' statement is untested and just to give an idea. More here:
http://docs.ansible.com/playbooks_conditionals.html#register-variables
HTH,
Patrick