Template robustness changes

A few small changes that make the bootstrap of the minions more robust:
1. Instead of "sleep 20" I put a loop that waits for the
private key file to exist.
2. Use python to obtain the hostname instead of "hostname --fqdn"
3. Add -ex to bash scripts, to help debugging problems