On 16-09-14 20:50, Hilco Wijbenga wrote:
On 16 September 2014 10:59, Michael DeHaan <[email protected]> wrote:
Perhaps install the packages you need instead of a group, or ignore the
changed state.
I want to rely on the state to (conditionally) execute other things so
ignoring is not an option. Installing all the packages individually
does work even if it is rather clumsy and not very maintenance
friendly. :-)
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
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/5418A45A.4030804%40puzzled.xs4all.nl.
For more options, visit https://groups.google.com/d/optout.