Merge "Enable Keepalived check script for VIP nodes"
diff --git a/ceph/rgw/cluster.yml b/ceph/rgw/cluster.yml
index 31aae9a..82c9041 100644
--- a/ceph/rgw/cluster.yml
+++ b/ceph/rgw/cluster.yml
@@ -1,5 +1,5 @@
 classes:
 - system.haproxy.proxy.single
 - system.haproxy.proxy.listen.radosgw
-- service.keepalived.cluster.single
+- system.keepalived.cluster.instance.ceph_rgw_vip
 - service.ceph.radosgw.cluster
diff --git a/defaults/keepalived/init.yml b/defaults/keepalived/init.yml
index 6d457e5..65c2c46 100644
--- a/defaults/keepalived/init.yml
+++ b/defaults/keepalived/init.yml
@@ -1,4 +1,4 @@
 parameters:
   _param:
     keepalived_openstack_web_vrrp_script_check_pidof_args: "nginx"
-    keepalived_galera_vrrp_script_check_pidof_args: "/usr/sbin/haproxy"
+    keepalived_vrrp_script_check_pidof_args: "/usr/sbin/haproxy"
diff --git a/keepalived/cluster/instance/ceph_rgw_vip.yml b/keepalived/cluster/instance/ceph_rgw_vip.yml
new file mode 100644
index 0000000..e118ca7
--- /dev/null
+++ b/keepalived/cluster/instance/ceph_rgw_vip.yml
@@ -0,0 +1,9 @@
+classes:
+- service.keepalived.cluster.single
+- system.keepalived.cluster.vrrp_scripts.check_single_process
+parameters:
+  keepalived:
+    cluster:
+      instance:
+        VIP:
+          track_script: check_pidof
\ No newline at end of file
diff --git a/keepalived/cluster/instance/default_keepalived_check.yml b/keepalived/cluster/instance/default_keepalived_check.yml
index e088dd6..9f9afd2 100644
--- a/keepalived/cluster/instance/default_keepalived_check.yml
+++ b/keepalived/cluster/instance/default_keepalived_check.yml
@@ -1,21 +1,18 @@
+# DEPRECATED: for backward compatibility until openstack/control.yml migrate to
+# check_multiple_processes.yml
+#
 # This instance is needed for the example case, where on control node the GlusterFS is deployed with keepalived and
 # a `remote_agent` from `Stacklight` sends its queries to the control's VIP to gather the GlusterFS data.
 # In case of `glusterd` process failure, the VIP should be moved to another node, to prevent `remote_agent` from failing.
 # In addition, check for haproxy process too, as on its failure VIP should be also moved to another node.
 classes:
-- service.keepalived.support
+- service.keepalived.cluster.single
+- system.keepalived.cluster.vrrp_scripts.check_custom_content
 parameters:
   _param:
     keepalived_vip_vrrp_check_script_content: "pidof glusterd && pidof haproxy"
   keepalived:
     cluster:
-      vrrp_scripts:
-        vrrp_check:
-          content: ${_param:keepalived_vip_vrrp_check_script_content}
-          interval: 10
-          rise: 1
-          fall: 1
-      enabled: true
       instance:
         VIP:
           track_script: vrrp_check
diff --git a/keepalived/cluster/instance/galera_vip.yml b/keepalived/cluster/instance/galera_vip.yml
index 8b0a462..e118ca7 100644
--- a/keepalived/cluster/instance/galera_vip.yml
+++ b/keepalived/cluster/instance/galera_vip.yml
@@ -1,14 +1,9 @@
 classes:
 - service.keepalived.cluster.single
+- system.keepalived.cluster.vrrp_scripts.check_single_process
 parameters:
   keepalived:
     cluster:
-      vrrp_scripts:
-        check_pidof:
-          args: ${_param:keepalived_galera_vrrp_script_check_pidof_args}
-          interval: 10
-          rise: 1
-          fall: 1
       instance:
         VIP:
-          track_script: check_pidof
+          track_script: check_pidof
\ No newline at end of file
diff --git a/keepalived/cluster/instance/opencontrail_vip.yml b/keepalived/cluster/instance/opencontrail_vip.yml
new file mode 100644
index 0000000..e118ca7
--- /dev/null
+++ b/keepalived/cluster/instance/opencontrail_vip.yml
@@ -0,0 +1,9 @@
+classes:
+- service.keepalived.cluster.single
+- system.keepalived.cluster.vrrp_scripts.check_single_process
+parameters:
+  keepalived:
+    cluster:
+      instance:
+        VIP:
+          track_script: check_pidof
\ No newline at end of file
diff --git a/keepalived/cluster/instance/openstack_controller_vip.yml b/keepalived/cluster/instance/openstack_controller_vip.yml
new file mode 100644
index 0000000..30c839f
--- /dev/null
+++ b/keepalived/cluster/instance/openstack_controller_vip.yml
@@ -0,0 +1,11 @@
+classes:
+- service.keepalived.cluster.single
+- system.keepalived.cluster.vrrp_scripts.check_multiple_processes
+parameters:
+  _param:
+    keepalived_vrrp_script_check_multiple_processes: 'glusterd haproxy'
+  keepalived:
+    cluster:
+      instance:
+        VIP:
+          track_script: multiple_processes
\ No newline at end of file
diff --git a/keepalived/cluster/instance/openstack_proxy_vip.yml b/keepalived/cluster/instance/openstack_proxy_vip.yml
new file mode 100644
index 0000000..9af94ed
--- /dev/null
+++ b/keepalived/cluster/instance/openstack_proxy_vip.yml
@@ -0,0 +1,11 @@
+classes:
+- service.keepalived.cluster.single
+- system.keepalived.cluster.vrrp_scripts.check_multiple_processes
+parameters:
+  _param:
+    keepalived_vrrp_script_check_multiple_processes: 'nginx haproxy'
+  keepalived:
+    cluster:
+      instance:
+        VIP:
+          track_script: multiple_processes
\ No newline at end of file
diff --git a/keepalived/cluster/vrrp_scripts/check_custom_content.yml b/keepalived/cluster/vrrp_scripts/check_custom_content.yml
new file mode 100644
index 0000000..6cc7e80
--- /dev/null
+++ b/keepalived/cluster/vrrp_scripts/check_custom_content.yml
@@ -0,0 +1,9 @@
+parameters:
+  keepalived:
+    cluster:
+      vrrp_scripts:
+        vrrp_check:
+          content: ${_param:keepalived_vip_vrrp_check_script_content}
+          interval: 10
+          rise: 1
+          fall: 1
diff --git a/keepalived/cluster/vrrp_scripts/check_single_process.yml b/keepalived/cluster/vrrp_scripts/check_single_process.yml
new file mode 100644
index 0000000..4b605c3
--- /dev/null
+++ b/keepalived/cluster/vrrp_scripts/check_single_process.yml
@@ -0,0 +1,9 @@
+parameters:
+  keepalived:
+    cluster:
+      vrrp_scripts:
+        check_pidof:
+          args: ${_param:keepalived_vrrp_script_check_pidof_args}
+          interval: 10
+          rise: 1
+          fall: 1
diff --git a/opencontrail/control/control.yml b/opencontrail/control/control.yml
index 4719dff..4dd79f3 100644
--- a/opencontrail/control/control.yml
+++ b/opencontrail/control/control.yml
@@ -1,7 +1,7 @@
 classes:
-- service.keepalived.cluster.single
 - service.opencontrail.control.control
 - system.haproxy.proxy.listen.opencontrail.control
+- system.keepalived.cluster.instance.opencontrail_vip
 parameters:
   _param:
     multi_tenancy: true
diff --git a/opencontrail/control/control4_0.yml b/opencontrail/control/control4_0.yml
index 09b1e12..acf5530 100644
--- a/opencontrail/control/control4_0.yml
+++ b/opencontrail/control/control4_0.yml
@@ -1,8 +1,8 @@
 classes:
 - service.docker.host
-- service.keepalived.cluster.single
 - service.opencontrail.control.control
 - system.haproxy.proxy.listen.opencontrail.control4_0
+- system.keepalived.cluster.instance.opencontrail_vip
 parameters:
   _param:
     opencontrail_version: 4.0