When calling yum check-update from an ansible playbook, your play may fail because check-update returns non-zero exit status for two reasons:
check-update […] returns exit value of 100 if there are packages available for an update. Also returns a list of the packages to be updated in list format. Returns 0 if no packages are available for update. Returns 1 if an error occurred.
One quick and dirty way to bypass this is to use ignore_errors: yes in your task, but this will ignore both the case of pending updates and any other kind of error and your play will continue regardless. To avoid this one can modify the play sightly to check for the exit status:
- name: yum check-update shell: 'yum check-update || test $? -eq 100'
The single quotes in the shell command above do matter.
The equivalent in a Chef recipe would be
To each his ladle
Thanks so much!!! This fixed my playbook!!!
Hello, you can change your code like this:
My post is from 2013. TTBOMK this way it was not possible back then. So I am not fixing it. It is best that I keep your response separate in order to be seen how would one do it in 2018.