Merge pull request #2 from noskovao/master

Refactoring of formula to support external DNS server
diff --git a/README.rst b/README.rst
index ec8d30f..3797b05 100644
--- a/README.rst
+++ b/README.rst
@@ -12,6 +12,9 @@
 
       designate:
         server:
+          backend:
+            bind9:
+              rndc_key: AahjHKbdslHOLs42h/asQA==
           database:
             host: ${_param:database_vip_address}
           notification: true
diff --git a/designate/files/rndc.key b/designate/files/rndc.key
new file mode 100644
index 0000000..dac4358
--- /dev/null
+++ b/designate/files/rndc.key
@@ -0,0 +1,5 @@
+{%- from "designate/map.jinja" import server with context -%}
+key "rndc-key" {
+        algorithm hmac-md5;
+        secret "{{ server.backend.bind9.rndc_key }}";
+};
diff --git a/designate/server.sls b/designate/server.sls
index a795a3d..e348118 100644
--- a/designate/server.sls
+++ b/designate/server.sls
@@ -1,23 +1,21 @@
 {%- from "designate/map.jinja" import server with context %}
 {%- if server.enabled %}
 
-{%- if server.local_bind %}
-bind9:
+{%- if server.backend.bind9 is defined %}
+bind9utils:
   pkg.installed
 
-/etc/bind/named.conf.options:
+{%- if server.backend.bind9.rndc_key is defined %}
+
+/etc/designate/rndc.key:
   file.managed:
-    - source: salt://designate/files/named.conf.options
+    - source: salt://designate/files/rndc.key
     - template: jinja
     - require:
-      - pkg: bind9
+      - pkg: bind9utils
 
-bind9_service:
-  service.running:
-    - enable: true
-    - name: bind9
-    - watch:
-      - file: /etc/bind/named.conf.options
+{%- endif %}
+
 {%- endif %}
 
 designate_server_packages:
diff --git a/metadata/service/server/cluster.yml b/metadata/service/server/cluster.yml
index f1e9f69..e23f900 100644
--- a/metadata/service/server/cluster.yml
+++ b/metadata/service/server/cluster.yml
@@ -6,7 +6,6 @@
   designate:
     server:
       enabled: true
-      local_bind: true
       region: RegionOne
       domain_id: 5186883b-91fb-4891-bd49-e6769234a8fc
       version: ${_param:designate_version}
diff --git a/metadata/service/server/single.yml b/metadata/service/server/single.yml
index 0939d68..6fec47d 100644
--- a/metadata/service/server/single.yml
+++ b/metadata/service/server/single.yml
@@ -6,7 +6,6 @@
   designate:
     server:
       enabled: true
-      local_bind: true
       region: RegionOne
       domain_id: 5186883b-91fb-4891-bd49-e6769234a8fc
       version: ${_param:designate_version}
diff --git a/tests/pillar/designate.sls b/tests/pillar/designate.sls
index df19b6d..7b990da 100644
--- a/tests/pillar/designate.sls
+++ b/tests/pillar/designate.sls
@@ -1,7 +1,9 @@
 designate:
   server:
+    backend:
+      bind9:
+        rndc_key: MqoG9BsOgQgwB5sch/oJqA==
     enabled: true
-    local_bind: true
     region: RegionOne
     domain_id: 5186883b-91fb-4891-bd49-e6769234a8fc
     version: ${_param:designate_version}