Skip to content

stathy/drift_tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

drift_tracking Cookbook

Requirements

On workstation / report generation side

gem install ruport
gem install ruport-util

On node side, where drift_tracking::detect_drift is run

# Included in recipe
chef_gem 'hashdiff'

Attributes

default['drift_tracking']['is_baseline'] = false
default['drift_tracking']['timestamp'] = Time.new.strftime("%Y_%m_%d-%H:%M:%S")
default['drift_tracking']['config'] = Mash.new

Usage

drift_tracking::baseline

In the drift_tracking::baseline recipe assign the appropriate attributes to be tracked :

node.set['drift_tracking']['config']['rpm'] = node['rpm']

Include drift_tracking::baseline on the node which will act as 'baseline' or 'standard' config :

{
  "name":"my_node",
  "run_list": [
    "recipe[drift_tracking::baseline]"
  ]
}

It will remove itself after running. This behavior can be changed by removing the resource ruby_block[remove_baseline]

drift_tracking::detect_drift

Just include drift_tracking::baseline on the node which will act as 'baseline' or 'standard' config :

{
  "name":"my_node",
  "run_list": [
    "recipe[drift_tracking::drift_tracking]"
  ]
}

No changes will need to be made. It will write out a new attribute called 'delta' which will contain a delta of the baseline and the current node config.

node['drift_tracking']['delta']

bin/generate_drift_report.rb

Modify to accomodate environment in solr search and output format. Currently leverages ruport for generating presentation format.

dt-m1

Delta RPM Name Baseline Release Baseline Version Target Release Target Version
~ rpm.dbus-glib.release   10.el5_5   11.el5_9
~ rpm.perl.release   38.el5_8   40.el5_9
~ rpm.cups-libs.release   30.el5   30.el5_9.3
~ rpm.libxml2.release   2.1.15.el5_8.6   2.1.21.el5_9.2
~ rpm.openssl.release   22.el5_8.4   26.el5_9.1
~ rpm.kernel-headers.release   348.1.1.el5   348.3.1.el5
~ rpm.gnutls.release   10.el5   10.el5_9.1
~ rpm.sudo.release   22.el5   22.el5_9.1
~ rpm.rpm-libs.release   31.el5   32.el5_9
~ rpm.kernel.release   348.1.1.el5   348.3.1.el5
~ rpm.openssl-devel.release   22.el5_8.4   26.el5_9.1
~ rpm.libxml2-python.release   2.1.15.el5_8.6   2.1.21.el5_9.2
~ rpm.libxml2-devel.release   2.1.15.el5_8.6   2.1.21.el5_9.2
~ rpm.popt.release   31.el5   32.el5_9
~ rpm.java-1.6.0-openjdk.release   1.33.1.11.6.el5_9   1.36.1.11.9.el5_9
~ rpm.rpm-python.release   31.el5   32.el5_9
~ rpm.rpm-build.release   31.el5   32.el5_9
~ rpm.tzdata.version   2012j   2013b
~ rpm.tzdata-java.version   2012j   2013b
~ rpm.java-1.6.0-openjdk-devel.release   1.33.1.11.6.el5_9   1.36.1.11.9.el5_9
~ rpm.rpm.release   31.el5   32.el5_9

interpreting the output

With the exception of column 1, the results should be self-explanatory. The first column can be one of three possible values, each of which is described here:

Character Description
- Package needs to be removed from target, because it *isn't* part of the baseline.
+ Package needs to be added to the target, because it *is* part of the baseline.
~ Package is the wrong version on the target, so *upgrade/downgrade* the package.

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write you change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Authors: Stathy Touloumis stathy@opscode.com

About

Opscode Chef repo and cookbook for identifying a baseline configuration and determining drift across assigned nodes with sample reporting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages