This repository has been archived by the owner on Oct 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
158 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
2019-08-04 Petr Vokac <[email protected]> | ||
* fix deprecation warnings | ||
2019-07-14 Petr Vokac <[email protected]> | ||
* LCGDM-2817 allow to configure epsv_match | ||
2019-09-05 Petr Vokac <[email protected]> | ||
* simpify StAR accounting | ||
* configure SSR via CGI | ||
* fix DB names conf | ||
* fix deprecations | ||
2019-02-26 Andrea Manzi <[email protected]> | ||
* fix conf for xrootd tpc delegation | ||
* raise dome limits | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,114 @@ | ||
# EGI StaR accounting - https://wiki.egi.eu/wiki/APEL/Storage | ||
# For publishing data in the EGI it is necessary to create | ||
# eu.egi.storage.accounting service for DPM headnode in GOCDB | ||
# (https://goc.egi.eu) with "Host DN" set to certificate subject | ||
# Usage: | ||
# class { '::dmlite::accounting': | ||
# site_name => 'praguelcg2', | ||
# } | ||
class dmlite::accounting ( | ||
$cron_interval = hiera('dmlite::accounting::cron_interval','weekly'), | ||
$enabled = hiera('dmlite::accounting::enabled',true), | ||
$cron_interval = hiera('dmlite::accounting::cron_interval','daily'), | ||
$bdii_url = hiera('dmlite::accounting::bdii_url','ldap://lcg-bdii.cern.ch:2170'), | ||
$broker_network = hiera('dmlite::accounting::broker_network','PROD'), | ||
$broker_host = hiera('dmlite::accounting::broker_host',''), | ||
$broker_port = hiera('dmlite::accounting::broker_port',''), | ||
$use_ssl = hiera('dmlite::accounting::use_ssl',false), | ||
$use_ssl = hiera('dmlite::accounting::use_ssl',true), | ||
$certificate = hiera('dmlite::accounting::certificate','/etc/grid-security/dpmmgr/dpmcert.pem'), | ||
$key = hiera('dmlite::accounting::key','/etc/grid-security/dpmmgr/dpmkey.pem'), | ||
$capath = hiera('dmlite::accounting::capath','/etc/grid-security/certificates'), | ||
|
||
$server_cert= hiera('dmlite::accounting::server_cert',''), | ||
$messaging_destination = hiera('dmlite::accounting::server_cert','/queue/global.accounting.test.storage.central'), | ||
$messaging_destination = hiera('dmlite::accounting::server_cert','/queue/global.accounting.storage.central'), | ||
$messaging_path = hiera('dmlite::accounting::messaging_path','/var/spool/apel/outgoing'), | ||
|
||
|
||
|
||
$site_name = hiera('dmlite::accounting::site_name',''), | ||
$nsconfig = hiera('dmlite::accounting::nsconfig','/usr/etc/NSCONFIG'), | ||
|
||
$nsconfig = hiera('dmlite::accounting::nsconfig','/usr/etc/NSCONFIG'), | ||
|
||
$dbhost = hiera('dmlite::accounting::dbhost','localhost'), | ||
$dbuser = hiera('dmlite::accounting::dbuser',''), | ||
$dbpwd = hiera('dmlite::accounting::dbpwd',''), | ||
$nsdbname = hiera('dmlite::accounting::nsdbname','cns_db'), | ||
$dpmdbname = hiera('dmlite::accounting::dpmdbname','dpm_db'), | ||
|
||
$log_file = hiera('dmlite::accounting::log_file','/var/log/apel/ssmsend.log'), | ||
$log_level = hiera('dmlite::accounting::log_level', 'INFO'), | ||
$console = hiera('dmlite::accounting::console', true), | ||
$ssm_url = hiera('dmlite::accounting::ssm_url', 'https://github.com/apel/ssm/releases/download/2.1.7-1/apel-ssm-2.1.7-1.el6.noarch.rpm'), | ||
$ssm_url = hiera('dmlite::accounting::ssm_url', ''), | ||
|
||
) { | ||
|
||
if $site_name == '' { | ||
fail("'site_name' not defined") | ||
} | ||
#install | ||
package {'python-daemon': | ||
ensure => 'installed', | ||
} | ||
package {'python-ldap': | ||
ensure => 'installed', | ||
} | ||
package {'python-lockfile': | ||
ensure => 'installed', | ||
} | ||
package {'stomppy': | ||
ensure => 'installed', | ||
} | ||
package { 'apel-ssm': | ||
ensure => 'installed', | ||
source => $ssm_url, | ||
provider => 'rpm' | ||
} | ||
|
||
file {'/etc/apel/sender.cfg': | ||
ensure => present, | ||
owner => root, | ||
group => root, | ||
content => template('dmlite/ssm/sender.cfg.erb'), | ||
require => Package['apel-ssm'] | ||
} | ||
|
||
file {"/etc/cron.${cron_interval}/dpm-accounting": | ||
if $site_name == '' { | ||
fail("'site_name' not defined") | ||
} | ||
|
||
# install | ||
if $enabled { | ||
package {['python-daemon','python-ldap','python-lockfile','stomppy']: | ||
ensure => 'installed', | ||
} | ||
} | ||
# apel-ssm also available in UMD repository | ||
if $ssm_url == '' { | ||
if $facts['os']['family'] == 'RedHat' { | ||
$ssm_package_url = $facts['os']['release']['major'] ? { | ||
'6' => 'https://github.com/apel/ssm/releases/download/2.3.0-2/apel-ssm-2.3.0-2.el6.noarch.rpm', | ||
'7' => 'https://github.com/apel/ssm/releases/download/2.3.0-2/apel-ssm-2.3.0-2.el7.noarch.rpm', | ||
} | ||
} | ||
} else { | ||
$ssm_package_url = $ssm_url | ||
} | ||
if !$ssm_package_url { | ||
fail("missing ssm_url on unsupported os ${facts['os']['family']} (${facts['os']['name']} ${facts['os']['release']['major']})") | ||
} | ||
package { 'apel-ssm': | ||
ensure => $enabled ? { | ||
true => 'installed', | ||
false => absent, | ||
}, | ||
source => $ssm_package_url, | ||
provider => 'rpm' | ||
} | ||
|
||
file {'/etc/apel/sender.cfg': | ||
ensure => $enabled ? { | ||
true => present, | ||
false => absent, | ||
}, | ||
owner => root, | ||
group => root, | ||
mode => '0755', | ||
content => inline_template(" | ||
#!/bin/sh | ||
content => template('dmlite/ssm/sender.cfg.erb'), | ||
require => Package['apel-ssm'] | ||
} | ||
|
||
/bin/mkdir -p /var/spool/apel/outgoing/`/bin/date +%Y%m%d` && | ||
/usr/share/lcgdm/scripts/star-accounting.py --reportgroups --nsconfig=<%= @nsconfig %> --site=<%= @site_name %> > /var/spool/apel/outgoing/`/bin/date +%Y%m%d`/`date +%Y%m%d%H%M%S` && ssmsend | ||
"), | ||
require => Package['apel-ssm'], | ||
ensure => present | ||
# do not break in case the new parameters are not defined | ||
if $dbuser == '' { | ||
$cron_content = inline_template('#!/bin/sh | ||
/bin/mkdir -p /var/spool/apel/outgoing/`date +%Y%m%d` && /usr/share/dmlite/StAR-accounting/star-accounting.py --reportgroups --nsconfig=<%= @nsconfig %> --site=<%= @site_name %> > /var/spool/apel/outgoing/`date +%Y%m%d`/`date +%Y%m%d%H%M%S` && ssmsend | ||
') | ||
} else { | ||
$cron_content = inline_template('#!/bin/sh | ||
/bin/mkdir -p /var/spool/apel/outgoing/`date +%Y%m%d` && /usr/share/dmlite/StAR-accounting/star-accounting.py --reportgroups --dbhost=<%= @dbhost %> --dbuser=<%= @dbuser %> --dbpwd=<%= @dbpwd %> --nsdbname=<%= @nsdbname %> --dpmdbname=<%= @dpmdbname %> --site=<%= @site_name %> > /var/spool/apel/outgoing/`date +%Y%m%d`/`date +%Y%m%d%H%M%S` && ssmsend | ||
') | ||
} | ||
|
||
file {"/etc/cron.${cron_interval}/dmlite-StAR-accounting": | ||
ensure => $enabled ? { | ||
true => present, | ||
false => absent, | ||
}, | ||
owner => root, | ||
group => root, | ||
mode => '0755', | ||
content => $cron_content, | ||
require => Package['apel-ssm'] | ||
} | ||
|
||
#purge old cron | ||
cron { 'dmlite-star-accounting': | ||
ensure => absent, | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.