Last Updated: February 25, 2016
·
2.404K
· Lorin Hochstein

Check if security updates needed on Ubuntu servers

Here's an Ansible playbook that will output a message for each server that requires a security update.

- name: check if security updates are needed
  hosts: myhosts
  tasks:
    - name: apt-check
      shell: "/usr/lib/update-notifier/apt-check 2>&1 | cut -d ';' -f 2"
      changed_when: false
      register: security_update

    - debug: msg="Security update required"
      when: security_update.stdout != "0"

1 Response
Add your response

Excellent tips. Thanks

over 1 year ago ·