This script is intended to be run as part of an ansible playbook that gathers information on what software packages have outstanding upgrades.
The script should run on any Redhat ( yum ) or Debian ( apt ) based system.
Obviously this can be run from the command line directly
or can be executed with wget to post the XML results to a processing system:
/usr/bin/wget -O /dev/null http://processing.host/path --post-data "$(check-updates.sh)" --header="Content-Type:application/xml"
The script will output the following data:
<?xml version="1.0" encoding="utf-8"?>
<updates> <host>
<name>hostname</name>
<engine>apt</engine>
<packages>
<package><name>PackageName</name><cur>1.0</cur><next>2.0</next></package>
...
</package>
</host>
</updates>
-
engine
- This field may returnapt
oryum
depending on the system its run on. -
cur
andnext
- These fields will show the current and upgraded package versions respectivly.
This script was generated with some code from the PatchDashboard project. Specifically this script