Fix for metadata agent enablement on nondvr computes.

Change-Id: Ia0c495220d774a4c34710839eeb83f761a79bfbe
diff --git a/README.rst b/README.rst
index 60b6fd0..f5169b5 100644
--- a/README.rst
+++ b/README.rst
@@ -869,6 +869,17 @@
         dhcp_agent_enabled: true
       ....
 
+Neutron with metadata agent on compute node
+-------------------------------------------
+
+.. code-block:: yaml
+
+    neutron:
+      ....
+      compute:
+        metadata_agent_enabled: true
+      ....
+
 Neutron with OVN
 ----------------
 
diff --git a/neutron/compute.sls b/neutron/compute.sls
index 1aba19f..9577550 100644
--- a/neutron/compute.sls
+++ b/neutron/compute.sls
@@ -61,6 +61,36 @@
 
     {% endif %}
 
+    {% if compute.get('metadata_agent_enabled', False) %}
+neutron_metadata_agent_packages:
+  pkg.installed:
+  - names:
+    - neutron-metadata-agent
+  - require_in:
+    - sls: neutron._ssl.rabbitmq
+
+neutron_metadata_agent:
+  service.running:
+    - enable: true
+    - names:
+      - neutron-metadata-agent
+    - watch:
+      - file: /etc/neutron/neutron.conf
+      - file: /etc/neutron/metadata_agent.ini
+    - require:
+      - pkg: neutron_metadata_agent_packages
+
+/etc/neutron/metadata_agent.ini:
+  file.managed:
+  - source: salt://neutron/files/{{ compute.version }}/metadata_agent.ini
+  - mode: 0640
+  - group: neutron
+  - template: jinja
+  - require:
+    - pkg: neutron_metadata_agent_packages
+
+    {% endif %}
+
     {%- if compute.opendaylight is defined %}
       {%- include "neutron/opendaylight/client.sls" %}
     {%- else %}
diff --git a/tests/pillar/compute_dhcp.sls b/tests/pillar/compute_dhcp.sls
index b19b0d9..01a513b 100644
--- a/tests/pillar/compute_dhcp.sls
+++ b/tests/pillar/compute_dhcp.sls
@@ -10,6 +10,7 @@
           driver: openvswitch
     dvr: false
     dhcp_agent_enabled: true
+    metadata_agent_enabled: true
     enabled: true
     external_access: false
     local_ip: 10.1.0.105