Using variables from custom script

Howdy all

I have a playback that I want to run hourly to check for new hosts and I have a script that returns a variable of new and this host gets the yum update and yum reboot and then come around again this host variable is now old...

My question is how can I get this playbook to run the yum update and reboot when the variable returns as new?

If the variable is old then it skips this

Edit for spelling: Playbook

Bump?

Mikel,

You can use the reboot plugin with a conditional to control when the system is rebooted.

`

  • name: Reboot the system
    reboot:
    when: my_yum_variable != ‘new’
    `

This question is better answered on the Ansible Project mailing list or #ansible on IRC.