Restructure: move statemachine to the top

Hopefully it's easier to digest if the high-level concept comes first
Extract variable - XENSERVER_PASSWORD
Extract variable
Extract variable