Yum Update thru Ansible

I wrote a playbook to send us alerts on rocket chat at work when a system has updates. I love that you can take the output and basically python the crap out of it.


This playbook lists yum updates

  • name: List Updates hosts: all gather_facts: yes become: yes become_method: sudo vars_files: vars/ansible_vars.yml

    tasks:

    • name: Check for yum updates yum: list: updates register: yum_output
    • name: Send update counts to Rocket Chat webhook rocketchat: token: #get this from Rocket Chat domain: #chat.fqdn msg: "{{ inventory_hostname }} running {{ ansible_distribution }} version {{ ansible_distribution_version }} is has {{ yum_output.results | list | length }} update(s)!" color: normal username: '' icon_url: '' protocol: 'https' when: yum_output.results | list | length > 0
/r/ansible Thread