alphagov/machine-bootstrap — pull request #4 by samjsharpe (2013-12-03 15:38:37+00:00)
Title: Reimplement everything with fabric

This is a massive commit and probably doesn't make sense to review in the comparison view, because I have basically ripped out the custom python scripting and puppet and re-implemented everything with [Fabric](http://docs.fabfile.org/en/1.8/).

I recommend marveling at the symplicity in the [branch view](https://github.com/alphagov/machine-bootstrap/tree/reimplement-with-fabric) instead.

All of the functions available in the old script are still here, but you will either have to call them directly or just call the `default` task which does something sensible. There are other invocations documented in the README.

Here is an example of usage:

```
$ fab --port=2222 -H 127.0.0.1 default
[127.0.0.1] Running apt-get update
[127.0.0.1] Setting up SSH key-auth for ubuntu
[127.0.0.1] New SSH private key for ubuntu@127.0.0.1

-----BEGIN RSA PRIVATE KEY-----

-----END RSA PRIVATE KEY-----

[127.0.0.1] Creating a GPG key for root
[127.0.0.1] Name: GPG Key
[127.0.0.1] Email: root@localhost.localdomain
[127.0.0.1] - Installing gnupg2 and haveged
[127.0.0.1] - Creating GPG key
[127.0.0.1] New GPG public key - please use wisely

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.17 (GNU/Linux)

-----END PGP PUBLIC KEY BLOCK-----

[127.0.0.1] Changing password for ubuntu user
[127.0.0.1] New password for ubuntu is
[127.0.0.1] Running hardening tasks
[127.0.0.1] Running apt-get upgrade
[127.0.0.1] Enabling UFW with allow for 22/tcp
[127.0.0.1] Installing and starting fail2ban
[127.0.0.1] Disabling password logins to SSH
[127.0.0.1] Rebooting machine immediately
```