diff --git a/automation/tracker.go b/automation/tracker.go
index 9f38b23..e299a68 100644
--- a/automation/tracker.go
+++ b/automation/tracker.go
@@ -3,9 +3,11 @@
 import (
 	"encoding/json"
 	"github.com/fzzy/radix/redis"
+	consul "github.com/hashicorp/consul/api"
 	"log"
 	"net/url"
 	"os"
+	"strings"
 )
 
 type ProvisionState int8
@@ -48,6 +50,46 @@
 	Clear(key string) error
 }
 
+type ConsulTracker struct {
+	client *consul.Client
+	kv     *consul.KV
+}
+
+func (c *ConsulTracker) Get(key string) (*TrackerRecord, error) {
+	pair, _, err := c.kv.Get(key, nil)
+	if err != nil {
+		return nil, err
+	}
+
+	if pair == nil {
+		var record TrackerRecord
+		record.State = Unprovisioned
+		return &record, nil
+	}
+
+	var record TrackerRecord
+	err = json.Unmarshal([]byte(pair.Value), &record)
+	if err != nil {
+		return nil, err
+	}
+	return &record, nil
+}
+
+func (c *ConsulTracker) Set(key string, record *TrackerRecord) error {
+	data, err := json.Marshal(record)
+	if err != nil {
+		return err
+	}
+	pair := &consul.KVPair{Key: key, Value: data}
+	_, err = c.kv.Put(pair, nil)
+	return err
+}
+
+func (c *ConsulTracker) Clear(key string) error {
+	_, err := c.kv.Delete(key, nil)
+	return err
+}
+
 // RedisTracker redis implementation of the tracker interface
 type RedisTracker struct {
 	client *redis.Client
@@ -77,7 +119,11 @@
 }
 
 func (t *RedisTracker) Set(key string, record *TrackerRecord) error {
-	reply := t.client.Cmd("set", key, true)
+	data, err := json.Marshal(record)
+	if err != nil {
+		return err
+	}
+	reply := t.client.Cmd("set", key, data)
 	return reply.Err
 }
 
@@ -114,8 +160,14 @@
 //            depends on the environment. If a link to a redis instance is defined then this will
 //            be used, else an in memory version will be used.
 func NewTracker() Tracker {
-	// Check the environment to see if we are linked to a redis DB
-	if os.Getenv("AUTODB_ENV_REDIS_VERSION") != "" {
+	driver := os.Getenv("AUTODB_DRIVER")
+	if driver == "" {
+		log.Printf("[info] No driver specified, defaulting to in memeory persistence driver")
+		driver = "MEMORY"
+	}
+
+	switch strings.ToUpper(driver) {
+	case "REDIS":
 		tracker := new(RedisTracker)
 		if spec := os.Getenv("AUTODB_PORT"); spec != "" {
 			port, err := url.Parse(spec)
@@ -124,14 +176,27 @@
 			checkError(err, "[error] unable to connect to redis database : '%s' : %s", port, err)
 			log.Println("[info] Using REDIS to track provisioning status of nodes")
 			return tracker
-		} else {
-			log.Fatalf("[error] looks like we are configured for REDIS, but no PORT defined in environment")
 		}
+		log.Fatalf("[error] No connection specified to REDIS server")
+	case "CONSUL":
+		var err error
+		config := consul.Config{
+			Address: "autodb:8500",
+			Scheme:  "http",
+		}
+		tracker := new(ConsulTracker)
+		tracker.client, err = consul.NewClient(&config)
+		checkError(err, "[error] unable to connect to redis server : 'autodb:8500' : %s", err)
+		log.Println("[info] Using Consul to track provisioning status of nodes")
+		tracker.kv = tracker.client.KV()
+		return tracker
+	case "MEMORY":
+		tracker := new(MemoryTracker)
+		tracker.data = make(map[string]TrackerRecord)
+		log.Println("[info] Using memory based structures to track provisioning status of nodes")
+		return tracker
+	default:
+		log.Fatalf("[error] Unknown persistance driver specified, '%s'", driver)
 	}
-
-	// Else fallback to an in memory tracker
-	tracker := new(MemoryTracker)
-	tracker.data = make(map[string]TrackerRecord)
-	log.Println("[info] Using memory based structures to track provisioning status of nodes")
-	return tracker
+	return nil
 }
