Create a password array

This commit is contained in:
Micke Nordin 2023-02-28 10:50:09 +01:00
parent ceb28450ee
commit 36d777ff8f
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257
2 changed files with 4 additions and 1 deletions

View file

@ -27,6 +27,9 @@ class sunetdrive::multinode (
$php_memory_limit_mb = 512 $php_memory_limit_mb = 512
$nodenumber = $::fqdn[9,1] $nodenumber = $::fqdn[9,1]
$customers = $tempcustomers - nil $customers = $tempcustomers - nil
$passwords = $customers.map | $index, $customer | {
hiera("${customer}_mysql_user_password")
}
user { 'www-data': ensure => present, system => true } user { 'www-data': ensure => present, system => true }
sunet::system_user {'mysql': username => 'mysql', group => 'mysql' } sunet::system_user {'mysql': username => 'mysql', group => 'mysql' }
ensure_resource('file', '/opt/nextcloud' , { ensure => directory, recurse => true } ) ensure_resource('file', '/opt/nextcloud' , { ensure => directory, recurse => true } )

View file

@ -120,6 +120,6 @@ mysql_users =
( (
<%- @customers.each do |index, customer| -%> <%- @customers.each do |index, customer| -%>
{ username = "nextcloud_<%= customer %>", password = "<%= hiera(customer.to_s + '_mysql_user_password') %>", default_hostgroup = 10, transaction_persistent = <%= @transaction_persistent %>, active = 1 }, { username = "nextcloud_<%= customer %>", password = "<%= @passwords[index] %>", default_hostgroup = 10, transaction_persistent = <%= @transaction_persistent %>, active = 1 },
<%- end -%> <%- end -%>
) )