Compare commits
No commits in common. "b096522c36420bea3f75229360d250889201de8d" and "7460019ec536a88020eb72b1a48b99c0761bd74b" have entirely different histories.
b096522c36
...
7460019ec5
|
@ -15,13 +15,9 @@ class sunetdrive::multinode_db(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if $facts["networking"]["fqdn"] =~ /^multinode-db1\.drive\.(test\.){1}sunet\.se$/ {
|
if $facts["networking"]["fqdn"] =~ /^multinode-db1\.drive\.(test\.){1}sunet\.se$/ {
|
||||||
$statistics_secret = safe_hiera('statistics_secret')
|
|
||||||
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':
|
||||||
|
@ -48,26 +44,5 @@ 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',
|
|
||||||
}
|
|
||||||
file {'/opt/mariadb/statistics/custdata.json':
|
|
||||||
ensure => file,
|
|
||||||
content => template('sunetdrive/mariadb/custconfig.json.erb'),
|
|
||||||
owner => 'root',
|
|
||||||
group => 'root',
|
|
||||||
mode => '0600',
|
|
||||||
}
|
|
||||||
sunet::scriptherder::cronjob { 'genuserdeplists':
|
|
||||||
cmd => '/root/tasks/genusersondepartmentlists.sh',
|
|
||||||
hour => '2',
|
|
||||||
minute => '5',
|
|
||||||
ok_criteria => ['exit_status=0','max_age=30h'],
|
|
||||||
warn_criteria => ['exit_status=1', 'max_age=60h'],
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<%= @custdata.to_json %>
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
<% basedir="statistics:drive-server-coms" -%>
|
|
||||||
<% cupath="/opt/mariadb/statistics/users/" -%>
|
|
||||||
<% custdata="/opt/mariadb/statistics/custdata.json" -%>
|
|
||||||
status=0
|
|
||||||
|
|
||||||
<% @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
|
|
||||||
if jq . <%= cupath + cust %>/users-<%= dom.gsub(/[.]/, '-') %>.json &>/dev/null
|
|
||||||
then
|
|
||||||
timeout 30s rclone copy -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies <%= cupath + cust %>/users-<%= dom.gsub(/[.]/, '-') %>.json <%= basedir%>/<%= cust %>-<%= @environment%>/
|
|
||||||
[[ $? -eq 0 ]] || { status=1 ; echo "Error: Upload of user data failed." ; }
|
|
||||||
else
|
|
||||||
echo "Error in json data"
|
|
||||||
status=1
|
|
||||||
fi
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
if [[ -f <%= custdata %> ]]
|
|
||||||
then
|
|
||||||
timeout 30s rclone copy -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies <%= custdata %> <%= basedir%>/
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit ${status}
|
|
Loading…
Reference in a new issue