Pass on vaiables

This commit is contained in:
Micke Nordin 2023-06-13 12:16:55 +02:00
parent e0139b0765
commit ff3a5c143c
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257
2 changed files with 13 additions and 10 deletions

View file

@ -4,7 +4,9 @@ define sunetdrive::db_type(
$bootstrap=undef, $bootstrap=undef,
$location=undef, $location=undef,
$override_config = undef, $override_config = undef,
$override_compose = undef) $override_compose = undef,
$replicate_rewrite_db = undef,
)
{ {
# Config from group.yaml # Config from group.yaml
@ -27,8 +29,8 @@ define sunetdrive::db_type(
$mysql_user_password = safe_hiera('mysql_user_password') $mysql_user_password = safe_hiera('mysql_user_password')
$mariadb_dir = '/etc/mariadb' $mariadb_dir = '/etc/mariadb'
$mycnf_path = 'sunetdrive/mariadb/my.cnf.erb' $mycnf_path = 'sunetdrive/mariadb/my.cnf.erb'
$server_id = 1000 + Integer($facts['hostname'][-1]) $server_id = 1000 + Integer($facts['networking']['hostname'][-1])
ensure_resource('file',"${mariadb_dir}", { ensure => directory, recurse => true } ) ensure_resource('file',$mariadb_dir, { ensure => directory, recurse => true } )
$dirs = ['datadir', 'init', 'conf', 'backups', 'scripts' ] $dirs = ['datadir', 'init', 'conf', 'backups', 'scripts' ]
$dirs.each |$dir| { $dirs.each |$dir| {
ensure_resource('file',"${mariadb_dir}/${dir}", { ensure => directory, recurse => true } ) ensure_resource('file',"${mariadb_dir}/${dir}", { ensure => directory, recurse => true } )
@ -90,7 +92,7 @@ define sunetdrive::db_type(
mode => '0744', mode => '0744',
} }
sunet::scriptherder::cronjob { 'purge_binlogs': sunet::scriptherder::cronjob { 'purge_binlogs':
cmd => "/usr/local/bin/purge-binlogs", cmd => '/usr/local/bin/purge-binlogs',
hour => '6', hour => '6',
minute => '0', minute => '0',
ok_criteria => ['exit_status=0','max_age=2d'], ok_criteria => ['exit_status=0','max_age=2d'],
@ -109,14 +111,14 @@ define sunetdrive::db_type(
content => template('sunetdrive/mariadb/status-test.erb'), content => template('sunetdrive/mariadb/status-test.erb'),
mode => '0744', mode => '0744',
} }
file { "/etc/sudoers.d/99-size-test": file { '/etc/sudoers.d/99-size-test':
ensure => file, ensure => file,
content => "script ALL=(root) NOPASSWD: /usr/local/bin/size-test\n", content => "script ALL=(root) NOPASSWD: /usr/local/bin/size-test\n",
mode => '0440', mode => '0440',
owner => 'root', owner => 'root',
group => 'root', group => 'root',
} }
file { "/etc/sudoers.d/99-status-test": file { '/etc/sudoers.d/99-status-test':
ensure => file, ensure => file,
content => "script ALL=(root) NOPASSWD: /usr/local/bin/status-test\n", content => "script ALL=(root) NOPASSWD: /usr/local/bin/status-test\n",
mode => '0440', mode => '0440',

View file

@ -8,12 +8,13 @@ class sunetdrive::mariadb (
$replicate_rewrite_db = undef, $replicate_rewrite_db = undef,
) { ) {
$quorum_id = $facts['facts['networking']['fqdn']'] $quorum_id = $facts['networking']['fqdn']
$quorum_password = safe_hiera('quorum_password') $quorum_password = safe_hiera('quorum_password')
$db = sunetdrive::db_type { 'base_db': $db = sunetdrive::db_type { 'base_db':
bootstrap => $bootstrap, bootstrap => $bootstrap,
tag_mariadb => $tag_mariadb, tag_mariadb => $tag_mariadb,
location => $location, location => $location,
replicate_rewrite_db => $replicate_rewrite_db,
} }
file { '/etc/quorum.conf': file { '/etc/quorum.conf':
ensure => file, ensure => file,