puppet-prod/site/profiles/lib/facter/mariadb_datapath.rb
Ben Vincent 11a98b16bb feat: setup galera cluster member profile
- add eyaml support for role
- add /data volume for galera cluster members
- create profiles::selinux namespace for defining selinux configuration
  - create profiles::selinux::mysqld for managing specifics for mysqld
  - create profiles::selinux::setenforce to manage selinux mode
- parameterised options required in mysqld::server module
- add mariadb repo
- add additional facts for managing mysqld and galera
2023-12-10 16:31:57 +11:00

23 lines
539 B
Ruby

# frozen_string_literal: true
# check if the /etc/my.cnf.d/server.cnf file exists,
# open it and search for the 'datadir =' option
# store the datadir value as this fact
require 'facter'
Facter.add('mariadb_datapath') do
setcode do
if File.exist?('/etc/my.cnf.d/server.cnf')
datadir = nil
File.foreach('/etc/my.cnf.d/server.cnf') do |line|
match = line.match(/^\s*datadir\s*=\s*(.+)\s*$/)
if match
datadir = match[1].strip
break
end
end
datadir
end
end
end