Skip to content

Commit

Permalink
tidy up fulcrum-demo mysql dbs and hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
antmoth committed Aug 22, 2024
1 parent a6bca15 commit 61f27ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions manifests/profile/fulcrum/hosts.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class nebula::profile::fulcrum::hosts (
$fedora = '127.0.0.1',
$mysql = '127.0.0.1',
$keycard = '127.0.0.1',
$redis = '127.0.0.1',
$solr = '127.0.0.1',
) {
Expand All @@ -17,6 +18,10 @@
ip => $mysql,
}

host { 'keycard':
ip => $keycard,
}

host { 'redis':
ip => $redis,
}
Expand Down
11 changes: 5 additions & 6 deletions manifests/profile/fulcrum/mysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
class nebula::profile::fulcrum::mysql (
String $fedora_password,
String $fulcrum_password,
String $checkpoint_password,
String $shibd_password,
String $password,
String $root_password,
) {

# Install and configure mysql server
Expand All @@ -35,21 +34,21 @@
}

exec { "set-mysql-password":
unless => "mysqladmin -uroot -p$password status",
unless => "mysqladmin -uroot -p$root_password status",
path => ["/bin", "/usr/bin"],
command => "mysqladmin -uroot password $password",
command => "mysqladmin -uroot password $root_password",
require => Service["mysqld"],
}

$dbs = [['fedora', $fedora_password], ['fulcrum', $fulcrum_password],
['checkpoint', $checkpoint_password], ['shibd', $shibd_password]]
['checkpoint', $fulcrum_password], ['shibd', $shibd_password]]

$dbs.each |$db| {
$name = $db[0]
$password = $db[1]
exec { "create-${name}-db":
unless => "/usr/bin/mysql -u${name} -p${password} ${name}",
command => "/usr/bin/mysql -uroot -p${mysql_password} -e \"create database ${name}; grant all on ${name}.* to ${name}@localhost identified by '${password}';\"",
command => "/usr/bin/mysql -uroot -p${root_password} -e \"create database ${name}; grant all on ${name}.* to ${name}@localhost identified by '${password}';\"",
require => Service["mysqld"],
}
}
Expand Down

0 comments on commit 61f27ec

Please sign in to comment.