Detecting OpenVZ

Reliably detecting if there is an OpenVZ Environment is pretty easy:

Just check for existance of /proc/user_beancounters.

But this will only tell you that OpenVZ is there. It won't tell you, if you are inside an unprivileged Virtual Environment (VE) or on the privileged Hardware Node (HN or VE0).
Still an easy check:

Read /proc/$PID/status and check for "envID: $VEID". $VEID will be 0 for the Hardware Node (hence the VE0 name). If it's greater than 0, you are inside an unprivileged VE.

Facter 1.5.3 will probably have support for this.