feat: puppetdb sql updates

- add consul support
- enable local script checks in consul agents
- add a test DB/User for consult to verify the psql instance is running
- manage the postgresql repo and gpg key
This commit is contained in:
2024-05-20 21:07:37 +10:00
parent 4b0ff2deee
commit 39aa6e114e
6 changed files with 71 additions and 12 deletions
+21 -3
View File
@@ -2,6 +2,7 @@
class profiles::puppet::puppetdb_sql (
String $puppetdb_host = lookup('profiles::puppet::puppetdb::puppetdb_host'),
String $listen_address = $facts['networking']['ip'],
String $consul_test_db_pass = '',
) {
# disable the postgresql dnf module for el8+
@@ -17,9 +18,11 @@ class profiles::puppet::puppetdb_sql (
# Install and configure PostgreSQL for PuppetDB
class { 'puppetdb::database::postgresql':
listen_addresses => $listen_address,
postgres_version => '15',
puppetdb_server => $puppetdb_host,
listen_addresses => $listen_address,
postgres_version => '15',
puppetdb_server => $puppetdb_host,
manage_package_repo => false,
require => [ Yumrepo['postgresql-15'],Yumrepo['postgresql-common'] ],
}
contain ::puppetdb::database::postgresql
@@ -32,4 +35,19 @@ class profiles::puppet::puppetdb_sql (
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'],
}
}