Create aggregates + add hosts to aggregates
diff --git a/README.rst b/README.rst
index 4aeecf8..08f383e 100644
--- a/README.rst
+++ b/README.rst
@@ -281,6 +281,21 @@
             - availability_zone_01
             - availability_zone_02
 
+
+
+Aggregates
+
+.. code-block:: yaml
+
+    nova:
+      client:
+        enabled: true
+        server:
+          identity:
+            aggregates:
+            - aggregate1
+            - aggregate2
+
 SR-IOV
 ------
 
diff --git a/_modules/novang.py b/_modules/novang.py
index d2009ae..dcac2fc 100644
--- a/_modules/novang.py
+++ b/_modules/novang.py
@@ -243,3 +243,44 @@
         'Availability Zone': item.__getattr__('availability_zone'),
     }
     return ret
+
+def aggregate_list(profile=None):
+    '''
+    list existing aggregates
+    '''
+    connection_args = get_connection_args(profile)
+    conn = _auth(profile)
+    nt_ks = conn.compute_conn
+    ret = nt_ks.aggregates.list()
+    return ret
+
+
+def aggregate_get(name, profile=None):
+    '''
+    list existing aggregates
+    '''
+    connection_args = get_connection_args(profile)
+    conn = _auth(profile)
+    nt_ks = conn.compute_conn
+    aggregate_exists=False
+    items = aggregate_list(profile)
+    for p in items:
+        item = nt_ks.aggregates.get(p).__getattr__('name')
+        if item == name:
+            aggregate_exists = True
+    return aggregate_exists
+
+
+def aggregate_create(name, aggregate, profile=None):
+    '''
+    create aggregate
+    '''
+    connection_args = get_connection_args(profile)
+    conn = _auth(profile)
+    nt_ks = conn.compute_conn
+    item = nt_ks.aggregates.create(name, aggregate)
+    ret = {
+        'Id': item.__getattr__('id'),
+        'Aggregate Name': item.__getattr__('name'),
+    }
+    return ret
diff --git a/_states/novang.py b/_states/novang.py
index 46fae9c..17ba41c 100644
--- a/_states/novang.py
+++ b/_states/novang.py
@@ -67,6 +67,20 @@
         return _already_exists(availability_zone, 'availabilty zone')
     return existing_availability_zones
 
+def aggregate_present(name=None, aggregate=None, profile=None):
+    '''
+    Ensures that the nova aggregate exists
+    '''
+    name = aggregate
+    aggregate_exists = __salt__['novang.aggregate_get'](name, profile)
+    if aggregate_exists == False:
+        item_created = __salt__['novang.aggregate_create'](name, aggregate, profile)
+        if bool(item_created):
+            return _created(aggregate, 'aggregate', item_created)
+    else:
+        return _already_exists(aggregate, 'aggregate')
+    return existing_aggregate
+
 
 def instance_present(name, flavor, image, networks, security_groups=None, profile=None, tenant_name=None):
     ret = {'name': name,
@@ -166,4 +180,4 @@
     else:
         changes_dict['comment'] = \
             '{0} {1} is in correct state'.format(resource, name)
-    return changes_dict
\ No newline at end of file
+    return changes_dict
diff --git a/nova/client.sls b/nova/client.sls
index 2d20a8f..57d62e5 100644
--- a/nova/client.sls
+++ b/nova/client.sls
@@ -44,6 +44,17 @@
 
 {%- endif %}
 
+{%- if identity.aggregates is defined %}
+
+{%- for aggregate_name in identity.aggregates %}
+nova_aggregate_{{ aggregate_name }}:
+  novang.aggregate_present:
+    - aggregate: {{ aggregate_name }}
+    - profile: {{ identity_name }}
+{%- endfor %}
+
+{%- endif %}
+
 {%- endfor %}
 
 {%- endif %}
diff --git a/nova/compute.sls b/nova/compute.sls
index a599fcf..b12a759 100644
--- a/nova/compute.sls
+++ b/nova/compute.sls
@@ -143,8 +143,21 @@
   - name: "nova {{ identity_params }} aggregate-add-host {{ compute.availability_zone }} {{ pillar.linux.system.name }}"
   - unless: "nova {{ identity_params }} service-list | grep {{ compute.availability_zone }} | grep {{ pillar.linux.system.name }}"
 
+{%- if compute.aggregates %}
+
+{%- for aggregate in compute.aggregates %}
+Add_compute_to_aggregate_{{ aggregate }}:
+  cmd.run:
+  - name: "nova {{ identity_params }} aggregate-add-host {{ aggregate }} {{ pillar.linux.system.name }}"
+  - unless: "nova {{ identity_params }} aggregate-details {{ aggregate }} | grep {{ pillar.linux.system.name }}"
+
+{%- endfor %}
+
 {%- endif %}
 
+{%- endif %}
+
+
 {%- if compute.virtualization == 'kvm' %}
 
 {% if compute.ceph is defined %}
diff --git a/nova/map.jinja b/nova/map.jinja
index 10577d5..1842234 100644
--- a/nova/map.jinja
+++ b/nova/map.jinja
@@ -47,6 +47,7 @@
         'debug': false,
         'notification': false,
         'availability_zone': None,
+        'aggregates': [],
         'identity': {
             'region': 'RegionOne'
         },