Set the -u flag so undefined variabled are counted as errors
Moved the hva node id setup and machine image downloading before the database setup
Commented and indented the *-manage commands