Make keepalived configuration future-proof

As keepalived, from v2.0.0, uses execev() instead
of system() for running scripts, the haproxy_check
and the pingable_check will fail when upgrading
keepalived. Exporting the full command into scripts
make them compatibale with newer version of keepalived.

Change-Id: Iea7d4565910046149d64dd1b4d8ec7bebb6e9e2a
Closes-bug: #1814064
This commit is contained in:
Domingues Luis Filipe 2019-01-31 13:02:32 +01:00
parent d4821d39d9
commit f91b88078a
3 changed files with 36 additions and 2 deletions

View File

@ -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

View File

@ -0,0 +1,16 @@
#!/bin/sh
# Copyright 2019, Luis Domingues <domigues.luis@gmail.com>
#
# 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)

View File

@ -0,0 +1,16 @@
#!/bin/sh
# Copyright 2019, Luis Domingues <domigues.luis@gmail.com>
#
# 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