Port in the state module as-is.

This is the module I've written that at least recognizes all of
my old puppet rules.