Merge pull request 'feat: mysql wsrep_ facts' (#87) from neoloc/mysql_wsrep_fact into develop
Reviewed-on: unkinben/puppet-prod#87
This commit is contained in:
commit
c91e3e632e
21
site/profiles/lib/facter/mysql_wsrep.rb
Normal file
21
site/profiles/lib/facter/mysql_wsrep.rb
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# skip if mysql isnt installed or active
|
||||||
|
next unless system('which mysql > /dev/null 2>&1')
|
||||||
|
next unless system('systemctl is-active --quiet mariadb')
|
||||||
|
|
||||||
|
# export mysql wsrep status
|
||||||
|
wsrep_status = `mysql -e "SHOW STATUS LIKE 'wsrep%';"`
|
||||||
|
|
||||||
|
# loop over the output
|
||||||
|
wsrep_status.each_line do |line|
|
||||||
|
# skip the line unless it starts with 'wsrep_'
|
||||||
|
next unless line.match(/^wsrep_/)
|
||||||
|
|
||||||
|
key, value = line.split("\t")
|
||||||
|
Facter.add("mysql_#{key.strip}") do
|
||||||
|
setcode do
|
||||||
|
value.strip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue
Block a user