diff --git a/inventory/group_vars/haproxy/keepalived.yml b/inventory/group_vars/haproxy/keepalived.yml index 721c04982f..83363476dd 100644 --- a/inventory/group_vars/haproxy/keepalived.yml +++ b/inventory/group_vars/haproxy/keepalived.yml @@ -35,9 +35,11 @@ keepalived_global_defs: keepalived_scripts: haproxy_check_script: - check_script: "/bin/kill -0 `cat /var/run/haproxy.pid`" + check_script: "/etc/keepalived/haproxy_check.sh" + src_check_script: "{{ playbook_dir }}/../scripts/keepalived_haproxy_check.sh" pingable_check_script: - check_script: "/bin/ping -c {{ keepalived_ping_count }} {{ keepalived_ping_address }} 1>&2" + check_script: "/etc/keepalived/pingable_check.sh {{ keepalived_ping_count }} {{ keepalived_ping_address }}" + src_ping_script: "{{ playbook_dir }}/../scripts/keepalived_pingable_check.sh" interval: "{{ keepalived_ping_interval }}" fall: 2 rise: 4 diff --git a/scripts/keepalived_haproxy_check.sh b/scripts/keepalived_haproxy_check.sh new file mode 100644 index 0000000000..60d5f58ffa --- /dev/null +++ b/scripts/keepalived_haproxy_check.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Copyright 2019, Luis Domingues +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +/bin/kill -0 $(cat /var/run/haproxy.pid) diff --git a/scripts/keepalived_pingable_check.sh b/scripts/keepalived_pingable_check.sh new file mode 100644 index 0000000000..1a2573dcfd --- /dev/null +++ b/scripts/keepalived_pingable_check.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Copyright 2019, Luis Domingues +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +/bin/ping -c $1 $2 1>&2