- add additional modules in Puppetfile
- update puppetlabs-lvm to 2.1.0
- add facts.d base path to hieradata
- add infra/storage and infra/storage/minio role data to hieradata
- add new facts for minio setup status
- add a static yaml minio-facts file to assist dynamic ruby facts
- updated hiera with additional directories (country/{role,region})
27 lines
718 B
Ruby
27 lines
718 B
Ruby
# frozen_string_literal: true
|
|
|
|
# check all datadirs for minio are initialised
|
|
|
|
require 'yaml'
|
|
Facter.add('minio_datadirs_initialised') do
|
|
setcode do
|
|
yaml_file_path = '/opt/puppetlabs/facter/facts.d/minio_facts.yaml'
|
|
|
|
# check if the YAML file exists first
|
|
next false unless File.exist?(yaml_file_path)
|
|
|
|
minio_facts = YAML.load_file(yaml_file_path)
|
|
dev_count = minio_facts['minio_blockdev_count']
|
|
datadir = minio_facts['minio_datadir']
|
|
|
|
# check datadir if no blockdevices are used, otherwise check the store locations
|
|
if dev_count.zero?
|
|
Dir.exist?(datadir)
|
|
else
|
|
(1..dev_count).all? do |number|
|
|
Dir.exist?("#{datadir}/store#{number}")
|
|
end
|
|
end
|
|
end
|
|
end
|