Skip to content

Instantly share code, notes, and snippets.

@bborysenko
Created January 15, 2019 16:15
Show Gist options
  • Save bborysenko/6079f13b09b1137a750ebac4c787a78f to your computer and use it in GitHub Desktop.
Save bborysenko/6079f13b09b1137a750ebac4c787a78f to your computer and use it in GitHub Desktop.
Ansible Percona XtraDB Cluster local fact
#!/bin/bash
set -e
set -o pipefail
WSREP=$(mysql --unbuffered --skip-column-names --batch --connect-timeout=3 -e "SHOW GLOBAL STATUS LIKE 'wsrep_%';" 2> /dev/null | sed 's/^/ "/g; s/\t/": "/g; ;s/$/",/g' | sed -z 's/\(.*\),/\1/')
cat <<EOF
{
$WSREP
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment