- change puppetdb::sql to using the patroni profile - change puppetdb::api to use new patroni cluster - remove references to puppetlabs-puppetdb managed database - update consul rules to enable sessions Reviewed-on: https://git.query.consul/unkinben/puppet-prod/pulls/318
42 lines
1.4 KiB
Puppet
42 lines
1.4 KiB
Puppet
# configure the puppetdb sql service
|
|
class profiles::puppet::puppetdb_sql (
|
|
String $puppetdb_host = lookup('puppetdbsql'),
|
|
String $listen_address = $facts['networking']['ip'],
|
|
String $consul_test_db_pass = '',
|
|
) {
|
|
|
|
# disable the postgresql dnf module for el8+
|
|
if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] >= '8' {
|
|
# based on https://github.com/puppetlabs/puppetlabs-postgresql/blob/main/manifests/dnfmodule.pp
|
|
package { 'postgresql dnf module':
|
|
ensure => 'disabled',
|
|
name => 'postgresql',
|
|
provider => 'dnfmodule',
|
|
}
|
|
}
|
|
|
|
# create the postgresql::server::config_entry resources
|
|
$pg_config_entries = lookup('postgresql_config_entries', Hash[String, Data], 'hash', {})
|
|
$pg_config_entries.each |String $key, Data $value| {
|
|
postgresql::server::config_entry { $key:
|
|
ensure => 'present',
|
|
value => $value,
|
|
}
|
|
}
|
|
|
|
# create consul database + user to test the host is responsive
|
|
postgresql::server::db { 'consul_test_db':
|
|
user => 'consul_test_user',
|
|
password => postgresql::postgresql_password('consul_test_user', Sensitive($consul_test_db_pass) ),
|
|
}
|
|
|
|
file { '/usr/local/bin/check_consul_postgresql':
|
|
ensure => 'file',
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0755',
|
|
content => template('profiles/puppetdb/check_consul_postgresql.erb'),
|
|
before => Class['profiles::consul::client'],
|
|
}
|
|
}
|