multinode-db1: Add logic and template to create userlists by department.
This commit is contained in:
parent
c134f0771f
commit
60cb53e631
|
@ -18,6 +18,9 @@ class sunetdrive::multinode_db(){
|
||||||
notify { 'hostmessage':
|
notify { 'hostmessage':
|
||||||
message => "We are on multinode-db1. Set up statistics environment.",
|
message => "We are on multinode-db1. Set up statistics environment.",
|
||||||
}
|
}
|
||||||
|
$custdata=$customers.reduce({}) |$memo, $value| {
|
||||||
|
$memo + {$value => lookup($value)}
|
||||||
|
}
|
||||||
$rclone_url = 'https://downloads.rclone.org/rclone-current-linux-amd64.deb'
|
$rclone_url = 'https://downloads.rclone.org/rclone-current-linux-amd64.deb'
|
||||||
$local_path = '/tmp/rclone-current-linux-amd64.deb'
|
$local_path = '/tmp/rclone-current-linux-amd64.deb'
|
||||||
exec { 'rclone_deb':
|
exec { 'rclone_deb':
|
||||||
|
@ -44,5 +47,12 @@ class sunetdrive::multinode_db(){
|
||||||
group => 'root',
|
group => 'root',
|
||||||
mode => '0700',
|
mode => '0700',
|
||||||
}
|
}
|
||||||
|
file { '/root/tasks/genusersondepartmentlists.sh':
|
||||||
|
ensure => file,
|
||||||
|
content => template('sunetdrive/mariadb/genuserdeplists.sh.erb'),
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0700',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
templates/mariadb/genuserdeplists.sh.erb
Normal file
12
templates/mariadb/genuserdeplists.sh.erb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
<% @custdata.each do |cust,data| -%>
|
||||||
|
#Customer <%= cust %> has no billing departments.
|
||||||
|
<% if defined?(data[@environment]["billdomains"]) && data[@environment]["billdomains"] -%>
|
||||||
|
mkdir -p /opt/mariadb/statistics/users/<%= cust %>
|
||||||
|
chmod '0700' /opt/mariadb/statistics/users/<%= cust %>
|
||||||
|
<% data[@environment]["billdomains"].each do |dom| -%>
|
||||||
|
/root/tasks/listusersbydep.sh <%= cust %> <%= dom %> > /opt/mariadb/statistics/users/<%= cust %>/users-<%= dom.gsub(/[.]/, '-') %>.json
|
||||||
|
<% end -%>
|
||||||
|
<% end -%>
|
||||||
|
<% end -%>
|
Loading…
Reference in a new issue