Local Nomad Cluster Using Vagrant

A note for future readers:

In the end I managed to create a local nomad cluster as follows:

  1. Install Vagrant, and Ansible in the host (my laptop)
  2. Create a Vagrantfile to spin up three virtual machines - one server, two clients
  3. Provision them (I used Ansible, mainly because I’m very familiar with the tool)
    1. Install Docker (I used the vagrant-docker-compose plugin)
    2. Install Consul
    3. Configure Consul - consul.hcl, systemd unit
    4. Install Nomad
    5. Configure Nomad - server/client.hcl, systemd unit
  4. Finally, run vagrant up

With the cluster up and running I tested out the official tutorial on load balancing using Fabio. I did run into some issues there, but those were unrelated to the cluster itself.

Note that I did not use the official(-ish) ansible-consul, and ansible-nomad roles as I could not get them to work together. Instead I wrote simple roles to install (using apt), and configure (combination of copy, and template) Consul and Nomad.