Hello,
I would like to write a playbook to install Red Hat Security Advisory on my hosts. The idea is to put the published information about the advisories with their Numbers (e.g. RHSA-2016:1234) in a variable and run the following playbook on all hosts:
---
- hosts: all
tasks:
- name: Group by OS
group_by: key=os_{{ ansible_distribution }}
changed_when: False
- hosts: os_RedHat
vars:
RHSA: "RHSA-2016:1633, RHSA-2016:1626"
tasks:
- name: Install Red Hat Security Advisory
command: yum update-minimal --advisory {{ RHSA }}
register: yumoutput
- name: Reboot if packages were updated
command: reboot NOW
when: yumoutput = ???
As you could see I would like to reboot a host only in case packages were updated. As far as I know the last line in the yum output on the host should be "Complete!". But I have trouble to get only the last line from the output and use it in the conditional when clause.
Could someone help me here, please?
Because english is not my first language I may have difficulties to make my point. Please bare with me and ask for more details or points I have to make more clear.
Kind regards,
Joerg