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

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/63d7459f-ada7-4d6e-b9e7-805049d5fced%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to