How to get and parse the output from target hosts

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:

`

I believe something like:

`

  • name: Reboot if packages were updated
    command: reboot NOW
    when: “‘Complete!’ in yumoutput”
    `

would do the trick.

http://docs.ansible.com/ansible/playbooks_conditionals.html#applying-when-to-roles-and-includes

http://stackoverflow.com/questions/30533372/run-an-ansible-task-only-when-the-hostname-contains-a-string

That is assuming that you don’t have the string ‘Complete!’ turning up anywhere else in the output.

Hi Alexander,

you put me in the right direction. I’d like to give a short example for my solution:

`