evrardjp / ansible-keepalived

Keepalived role for ansible deployment
Apache License 2.0
98 stars 98 forks source link

Validate configuration if keepalived >= 2.0.4 #217

Closed evrardjp closed 2 years ago

evrardjp commented 2 years ago

This should ensure the config is working well before attempting a reboot.

Closes: #172

evrardjp commented 2 years ago

It seems to work for rockylinux, but not for others, investigating tomorrow.

Kariton commented 2 years ago

does work for me (well - EL 8 like):

# cat /etc/os-release
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"
evrardjp commented 2 years ago

It was working well under centos/RH because the version of the package was directly linked to the version of keepalived. For ubuntu/debian, the string is similar to 1:<version><otherdata> which was always parsed as v1, regardless of actual version of keepalived. As packge fact doesn't show the software version, I will be using keepalived directly instead.

evrardjp commented 2 years ago

In my other branch, I have a job that rightfully failed now (Xenial doesn't test, the others do).

  TASK [ansible-keepalived : Configure keepalived] *******************************
  fatal: [keepalived-rockylinux8]: FAILED! => {"changed": false, "checksum": "f8c7de99baaf11d01c6b188cb382d4888c634be8", "exit_status": 4, "msg": "failed to validate", "stderr": "(/root/.ansible/tmp/ansible-tmp-1657871277.924054-15651-219966251520729/source: Line 1) Unknown keyword 'boop'\n(/root/.ansible/tmp/ansible-tmp-1657871277.924054-15651-219966251520729/source: Line 1) Unknown keyword 'boop'\n(/root/.ansible/tmp/ansible-tmp-1657871277.924054-15651-219966251520729/source: Line 1) Unknown keyword 'boop'\n", "stderr_lines": ["(/root/.ansible/tmp/ansible-tmp-1657871277.924054-15651-219966251520729/source: Line 1) Unknown keyword 'boop'", "(/root/.ansible/tmp/ansible-tmp-1657871277.924054-15651-219966251520729/source: Line 1) Unknown keyword 'boop'", "(/root/.ansible/tmp/ansible-tmp-1657871277.924054-15651-219966251520729/source: Line 1) Unknown keyword 'boop'"], "stdout": "", "stdout_lines": []}
  fatal: [keepalived-bullseye]: FAILED! => {"changed": false, "checksum": "54b51a0c21d865a6ff9635a4ba758b0d4449695a", "exit_status": 4, "msg": "failed to validate", "stderr": "(/root/.ansible/tmp/ansible-tmp-1657871277.785569-15646-202748968320221/source: Line 1) Unknown keyword 'boop'\n(/root/.ansible/tmp/ansible-tmp-1657871277.785569-15646-202748968320221/source: Line 1) Unknown keyword 'boop'\n(/root/.ansible/tmp/ansible-tmp-1657871277.785569-15646-202748968320221/source: Line 1) Unknown keyword 'boop'\n(/root/.ansible/tmp/ansible-tmp-1657871277.785569-15646-202748968320221/source: Line 1) Unknown keyword 'boop'\n", "stderr_lines": ["(/root/.ansible/tmp/ansible-tmp-1657871277.785569-15646-202748968320221/source: Line 1) Unknown keyword 'boop'", "(/root/.ansible/tmp/ansible-tmp-1657871277.785569-15646-202748968320221/source: Line 1) Unknown keyword 'boop'", "(/root/.ansible/tmp/ansible-tmp-1657871277.785569-15646-202748968320221/source: Line 1) Unknown keyword 'boop'", "(/root/.ansible/tmp/ansible-tmp-1657871277.785569-15646-202748968320221/source: Line 1) Unknown keyword 'boop'"], "stdout": "", "stdout_lines": []}
  fatal: [keepalived-focal]: FAILED! => {"changed": false, "checksum": "0cc19aa3db7999c52b816ee083908181530094cc", "exit_status": 4, "msg": "failed to validate", "stderr": "(Line 1) Unknown keyword 'boop'\n(Line 1) Unknown keyword 'boop'\n(Line 1) Unknown keyword 'boop'\n(Line 1) Unknown keyword 'boop'\n", "stderr_lines": ["(Line 1) Unknown keyword 'boop'", "(Line 1) Unknown keyword 'boop'", "(Line 1) Unknown keyword 'boop'", "(Line 1) Unknown keyword 'boop'"], "stdout": "", "stdout_lines": []}
  changed: [keepalived-xenial]