Turn off haproxy service instead of masking it

Use init system agnostic method to disable haproxy service.
Also wrap l2gw service mask in systemd presence condition.

Change-Id: If0b6bc958cb79c9758fe2e5292baf629888a721b
Closes-Bug: PROD-21105
diff --git a/neutron/agents/_l2gw.sls b/neutron/agents/_l2gw.sls
index 9f565a9..ddb665d 100644
--- a/neutron/agents/_l2gw.sls
+++ b/neutron/agents/_l2gw.sls
@@ -14,6 +14,7 @@
 
 {%- if not grains.get('noservices', False) %}
 
+{%- if grains.init == 'systemd' %}
 {%- if grains['saltversioninfo'] < [2017, 7] %}
 service.mask:
   module.run:
@@ -25,6 +26,7 @@
 {%- endif %}
   - require_in:
     - pkg: l2gw_agent_packages
+{%- endif %}
 
 neutron-l2gateway-agent:
   service.running:
diff --git a/neutron/gateway.sls b/neutron/gateway.sls
index 1d2170e..66390d8 100644
--- a/neutron/gateway.sls
+++ b/neutron/gateway.sls
@@ -10,18 +10,13 @@
   pkg.installed:
   - names: {{ gateway.pkgs }}
 
-{%- if not grains.get('noservices', False) %}
+{%- if not grains.get('noservices', False) and pillar.haproxy is not defined %}
 # NOTE(mpolenchuk): haproxy is used as a replacement for
 # neutron-ns-metadata-proxy Python implementation starting from Pike
 haproxy:
-  {%- if grains['saltversioninfo'] < [2017,7] %}
-  module.run:
-  - name: service.mask
-  - m_name: haproxy
-  {%- else %}
-  service.masked:
-  {%- endif %}
-  - prereq:
+  service.dead:
+  - enable: False
+  - require:
     - pkg: neutron_gateway_packages
 {%- endif %}