diff --git a/CHANGELOG.md b/CHANGELOG.md index aa01fab..07c935b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [v1.3.0] 1 September 2019 - Petr Vokac +- new templates and configuration parameters +- allow to configure Top/Site BDII with hierra + ## [v1.2.2] 31 August 2018 - Steve Traylen - Empty release for build problem diff --git a/README.md b/README.md index 0256a82..3dd7cf9 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ defaults in params.pp if this is more convenient. * `port` defaults to `2170` * `user` defaults `ldap` * `slapdconf` defaults to `/etc/bdii/bdii/bdii-slapd.conf` - * `delete_delay` defaults to `/deleted + * `deletedelay` defaults to `0` (no delay) * `$selinux` defaults to `true` diff --git a/data/common.yaml b/data/common.yaml new file mode 100644 index 0000000..8f613ed --- /dev/null +++ b/data/common.yaml @@ -0,0 +1,59 @@ +--- +# daemon configuration +#bdii::log_level: 'ERROR' +#bdii::port: 2170 +#bdii::user: 'ldap' +#bdii::slapdconf: '/etc/bdii/bdii-slapd.conf' +#bdii::selinux: false +bdii::firewall: true +#bdii::bdiipasswd: 'secret' +#bdii::bdiihost: 'somehost.example.com' +#bdii::deletedelay: 0 +#bdii::slapdthreads: 16 +#bdii::slapdloglevel: 0 +bdii::ramsize: ~ +# site specific stuff +#bdii::siteurls: +# - '# DUMMY ldap://localhost:2170/mds-vo-name=resource,o=grid' +#bdii::sitename: 'somesite' +#bdii::sitebdiihost: 'somehost.example.com' +#bdii::sitedesc: 'somesite descr' +#bdii::siteweb: 'www.somesite.example.com' +#bdii::sitedistributed: '' +#bdii::siteloc: '' +#bdii::sitecountry: 'somecountry' +#bdii::sitelat: '' +#bdii::sitelong: '' +#bdii::siteemail: '' +#bdii::sitesecuritymail: '' +#bdii::sitesupportemail: '' +#bdii::config: 'puppet' +#bdii::egeeroc: '' +#bdii::egeeservice: 'prod' +#bdii::grid: [] +#bdii::wlcgtier: ~ +#bdii::otherinfo: [] +# templates +bdii::template_config: 'bdii/bdiiconf.erb' +bdii::template_sysconfig: 'bdii/bdiisysconf.erb' +bdii::template_slapd: 'bdii/bdii-slapd.conf.erb' +bdii::template_glite: 'bdii/glite-info-site-defaults.erb' +bdii::template_site: 'bdii/site.erb' +bdii::template_site_urls: 'bdii/site_urls.erb' + + +# +# Top-BDII modifications +# +bdii::topbdii::slapdconf: '/etc/bdii/bdii-top-slapd.conf' +bdii::topbdii::deletedelay: 345600 +bdii::topbdii::slapdthreads: 64 +bdii::topbdii::ramsize: '2000M' +bdii::topbdii::template_slapd: 'bdii/bdii-top-slapd.conf.erb' + + +# +# Site-BDII modifications +# +bdii::sitebdii::ramsize: '500M' +bdii::sitebdii::template_glite: 'bdii/glite-info-site-defaults-site.erb' diff --git a/hiera.yaml b/hiera.yaml new file mode 100644 index 0000000..3f10ecf --- /dev/null +++ b/hiera.yaml @@ -0,0 +1,23 @@ +--- +version: 5 + +defaults: + datadir: 'data' + data_hash: 'yaml_data' + +hierarchy: + - name: 'Full Version' + path: '%{facts.os.name}-%{facts.os.release.full}.yaml' + + - name: 'Major Version' + path: '%{facts.os.name}-%{facts.os.release.major}.yaml' + + - name: 'Distribution Name' + path: '%{facts.os.name}.yaml' + + - name: 'Operating System Family' + path: '%{facts.os.family}-family.yaml' + + - name: 'common' + path: 'common.yaml' + diff --git a/lib/puppet/parser/functions/randompass.rb b/lib/puppet/parser/functions/randompass.rb index c711058..fe71c96 100644 --- a/lib/puppet/parser/functions/randompass.rb +++ b/lib/puppet/parser/functions/randompass.rb @@ -7,7 +7,10 @@ module Puppet::Parser::Functions $allowed = [] ('!'..'Z').each { |c| $allowed << c } ('a'..'z').each { |c| $allowed << c } + $allowed.delete('#') $allowed.delete(',') + $allowed.delete('"') + $allowed.delete('\'') value = '' $length.times { value << $allowed[rand($allowed.length)] } return value diff --git a/manifests/config.pp b/manifests/config.pp index 02191be..513ff71 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,51 +1,57 @@ class bdii::config ( - $log_level = $bdii::log_level, - $port = $bdii::port, - $user = $bdii::user, - $slapdconf = $bdii::slapdconf, - $delete_delay = $bdii::delete_delay, -) inherits bdii { + # daemon configuration + String $log_level = $::bdii::log_level, + Stdlib::Port $port = $::bdii::port, + String $user = $::bdii::user, + Stdlib::Absolutepath $slapdconf = $::bdii::slapdconf, + Boolean $selinux = $::bdii::selinux, + Boolean $firewall = $::bdii::firewall, + String $bdiipasswd = $::bdii::bdiipasswd, + Integer $deletedelay = $::bdii::deletedelay, + Integer $slapdthreads = $::bdii::slapdthreads, + Integer $slapdloglevel = $::bdii::slapdloglevel, + Optional[String] $ramsize = $::bdii::ramsize, + # templates + String $template_config = $::bdii::template_config, + String $template_slapd = $::bdii::template_slapd, + String $template_sysconfig = $::bdii::template_sysconfig, +) inherits ::bdii { - Class[bdii::install] -> Class[bdii::config] + file { $slapdconf: + content => template($template_slapd), + owner => 'root', + group => 'root', + mode => '0644', + notify => Class['bdii::service'], + } - file {'/etc/bdii/bdii.conf': - content => template('bdii/bdiiconf.erb'), - owner => 'root', - group => 'root', - mode => '0644', - notify => Class['bdii::service'], - } + file { '/etc/bdii/bdii.conf': + content => template($template_config), + owner => 'root', + group => 'root', + mode => '0644', + notify => Class['bdii::service'], + } - file { '/etc/bdii/gip': - ensure => 'directory', - owner => 'root', - group => 'root', - mode => '0755', - } + file { '/etc/bdii/gip': + ensure => 'directory', + owner => 'root', + group => 'root', + mode => '0755', + } - file { '/var/lib/bdii/db': - ensure => 'directory', - owner => 'ldap', - group => 'ldap', - mode => '0755', - } + file { '/var/lib/bdii/db': + ensure => 'directory', + owner => 'ldap', + group => 'ldap', + mode => '0755', + } - file {'/etc/sysconfig/bdii': - content => template('bdii/bdiisysconf.erb'), - owner => 'root', - group => 'root', - mode => '0644', - } - - file_line{ 'slapd_threads': - path => $slapdconf, - match => '^\s*threads', - line => "threads ${bdii::params::slapdthreads}", - } - - file_line{ 'slapd_loglevel': - path => $slapdconf, - match => '^\s*loglevel', - line => "loglevel ${bdii::params::slapdloglevel}", - } + file { '/etc/sysconfig/bdii': + content => template($template_sysconfig), + owner => 'root', + group => 'root', + mode => '0644', + notify => Class['bdii::service'], + } } diff --git a/manifests/init.pp b/manifests/init.pp index 81d961c..035c80f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,24 +1,32 @@ class bdii ( - $manage_firewall = true, - $log_level = $bdii::params::log_level, - $port = $bdii::params::port, - $user = $bdii::params::user, - $slapdconf = $bdii::params::slapdconf, - $delete_delay = $bdii::params::delete_delay, - $selinux = $bdii::params::selinux, -) inherits bdii::params { + # daemon configuration + String $log_level = $bdii::params::log_level, + Stdlib::Port $port = $bdii::params::port, + String $user = $bdii::params::user, + Stdlib::Absolutepath $slapdconf = $bdii::params::slapdconf, + Boolean $selinux = $bdii::params::selinux, + Boolean $firewall, + String $bdiipasswd = $bdii::params::bdiipasswd, + Integer $deletedelay = $bdii::params::deletedelay, + Integer $slapdthreads = $bdii::params::slapdthreads, + Integer $slapdloglevel = $bdii::params::slapdloglevel, + Optional[String] $ramsize, + # templates + String $template_config, + String $template_slapd, + String $template_sysconfig, +) inherits ::bdii::params { - case $::operatingsystem { - 'RedHat','SLC','SL','Scientific','CentOS': { - include ::bdii::install - include ::bdii::service - include ::bdii::config - if ($manage_firewall) { - include ::bdii::firewall - } - } - default: { - # There is some fedora configuration present but I can't actually get it to work. - } + contain ::bdii::install + contain ::bdii::service + if $firewall { + contain ::bdii::firewall + Class['::bdii::firewall'] -> Class['::bdii::config'] } + contain ::bdii::config + + Class['::bdii::install'] + -> Class['::bdii::config'] + ~> Class['::bdii::service'] + } diff --git a/manifests/install.pp b/manifests/install.pp index 84ca238..5f53d99 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,6 +1,6 @@ class bdii::install ( - $selinux = $bdii::params::selinux -) inherits bdii { + $selinux = $bdii::selinux, +) inherits ::bdii { package { 'bdii': ensure => present, diff --git a/manifests/params.pp b/manifests/params.pp index fe6163c..dd130d2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,32 +1,39 @@ +# This file is here only to keep compatibility with older versions +# of puppet BDII module. Don't use this file and don't use bdii::params::* +# in hiera configuration. See data/common.yaml for proper hieara +# configuration parameters name: +# * bdii::"name" for BDII class +# * bdii::sitebdii::"name" for Site-BDII class +# * bdii::topbdii::"name" for Top-BDII class class bdii::params { - $log_level = hiera('bdii::params::log_level','DEBUG') - $port = hiera('bdii::params::port','2170') - $user = hiera('bdii::params::user','ldap') - $slapdconf = hiera('bdii::params::slapdconf','/etc/bdii/bdii-slapd.conf') - $selinux = hiera('bdii::params::selinux',false) - $bdiipasswd = hiera('bdii::params::bdiipasswd',randompass()) - $bdiihost = hiera('bdii::params::bdiihost','somehost.example.com') - $delete_delay = hiera('bdii::params::deletedelay', '0') - $slapdthreads = hiera('bdii::params::slapdthreads', '16') - $slapdloglevel = hiera('bdii::params::slapdloglevel', '0') + $log_level = lookup('bdii::params::log_level', undef, undef, 'ERROR') + $port = lookup('bdii::params::port', undef, undef, 2170) + $user = lookup('bdii::params::user', undef, undef, 'ldap') + $slapdconf = lookup('bdii::params::slapdconf', undef, undef, '/etc/bdii/bdii-slapd.conf') + $selinux = lookup('bdii::params::selinux', undef, undef, false) + $bdiipasswd = lookup('bdii::params::bdiipasswd', undef, undef, randompass()) + $bdiihost = lookup('bdii::params::bdiihost', undef, undef, 'somehost.example.com') + $deletedelay = lookup('bdii::params::deletedelay', undef, undef, 0) + $slapdthreads = lookup('bdii::params::slapdthreads', undef, undef, 16) + $slapdloglevel = lookup('bdii::params::slapdloglevel', undef, undef, 0) # site specific stuff: - $siteurls = hiera('bdii::params::siteurls','# DUMMY ldap://localhost:2170/mds-vo-name=resource,o=grid') - $sitename = hiera('bdii::params::sitename','somesite') - $sitebdiihost = hiera('bdii::params::sitebdiihost','somehost.example.com') - $sitedesc = hiera('bdii::params::sitedesc','somesite descr') - $siteweb = hiera('bdii::params::siteweb','www.somesite.example.com') - $sitedistributed = hiera('bdii::params::sitedistributed','') - $siteloc = hiera('bdii::params::siteloc','') - $sitecountry = hiera('bdii::params::sitecountry','somecountry') - $sitelat = hiera('bdii::params::sitelat','') - $sitelong = hiera('bdii::params::sitelong','') - $siteemail = hiera('bdii::params::siteemail','') - $sitesecuritymail = hiera('bdii::params::sitesecuritymail','') - $sitesupportemail = hiera('bdii::params::sitesupportemail','') - $config = hiera('bdii::params::config','puppet') - $egeeroc = hiera('bdii::params::egeeroc','') - $egeeservice = hiera('bdii::params::egeeservice','prod') - $grid = hiera('bdii::params::grid','') - $wlcgtier = hiera('bdii::params::wlcgtier','') - $otherinfo = hiera('bdii::params::otherinfo',[]) #could be WLCG_PARENT=stuff + $siteurls = lookup('bdii::params::siteurls', undef, undef, '# DUMMY ldap://localhost:2170/mds-vo-name=resource,o=grid') + $sitename = lookup('bdii::params::sitename', undef, undef, 'somesite') + $sitebdiihost = lookup('bdii::params::sitebdiihost', undef, undef, 'somehost.example.com') + $sitedesc = lookup('bdii::params::sitedesc', undef, undef, 'somesite descr') + $siteweb = lookup('bdii::params::siteweb', undef, undef, 'www.somesite.example.com') + $sitedistributed = lookup('bdii::params::sitedistributed', undef, undef, '') + $siteloc = lookup('bdii::params::siteloc', undef, undef, '') + $sitecountry = lookup('bdii::params::sitecountry', undef, undef, 'somecountry') + $sitelat = lookup('bdii::params::sitelat', undef, undef, '') + $sitelong = lookup('bdii::params::sitelong', undef, undef, '') + $siteemail = lookup('bdii::params::siteemail', undef, undef, '') + $sitesecuritymail = lookup('bdii::params::sitesecuritymail', undef, undef, '') + $sitesupportemail = lookup('bdii::params::sitesupportemail', undef, undef, '') + $config = lookup('bdii::params::config', undef, undef, 'puppet') + $egeeroc = lookup('bdii::params::egeeroc', undef, undef, '') + $egeeservice = lookup('bdii::params::egeeservice', undef, undef, 'prod') + $grid = lookup('bdii::params::grid', undef, undef, '') + $wlcgtier = lookup('bdii::params::wlcgtier', undef, undef, '') + $otherinfo = lookup('bdii::params::otherinfo', undef, undef, []) #could be WLCG_PARENT=stuff } diff --git a/manifests/sambdii.pp b/manifests/sambdii.pp index 0620706..89dd168 100644 --- a/manifests/sambdii.pp +++ b/manifests/sambdii.pp @@ -1,18 +1,63 @@ class bdii::sambdii ( - $sitename = $bdii::params::sitename, - $sitebdiihost = $bdii::params::sitebdiihost, -)inherits bdii::params { + # daemon configuration + String $log_level = bdii::sambdii::params('log_level'), + Stdlib::Port $port = bdii::sambdii::params('port'), + String $user = bdii::sambdii::params('user'), + Stdlib::Absolutepath $slapdconf = bdii::sambdii::params('slapdconf'), + Boolean $selinux = bdii::sambdii::params('selinux'), + Boolean $firewall = bdii::sambdii::params('firewall'), + String $bdiipasswd = bdii::sambdii::params('bdiipasswd'), + Integer $deletedelay = bdii::sambdii::params('deletedelay'), + Integer $slapdthreads = bdii::sambdii::params('slapdthreads'), + Integer $slapdloglevel = bdii::sambdii::params('slapdloglevel'), + Optional[String] $ramsize = bdii::sambdii::params('ramsize'), + # site specific stuff + Stdlib::Host $bdiihost = bdii::sambdii::params('bdiihost'), + String $sitename = bdii::sambdii::params('sitename'), + # templates + String $template_config = bdii::sambdii::params('template_config'), + String $template_slapd = bdii::sambdii::params('template_slapd'), + String $template_sysconfig = bdii::sambdii::params('template_sysconfig'), + String $template_glite = bdii::sambdii::params('template_glite'), +) inherits ::bdii::params { + + class { '::bdii': + log_level => $log_level, + port => $port, + user => $user, + slapdconf => $slapdconf, + selinux => $selinux, + firewall => $firewall, + bdiipasswd => $bdiipasswd, + deletedelay => $deletedelay, + slapdthreads => $slapdthreads, + slapdloglevel => $slapdloglevel, + ramsize => $ramsize, + template_config => $template_config, + template_slapd => $template_slapd, + template_sysconfig => $template_sysconfig, + } Class['bdii::config'] -> Class['bdii::sambdii'] package { 'emi-bdii-top': - ensure => present, + ensure => present, } file {'/etc/bdii/gip/glite-info-site-defaults.conf': - content => template('bdii/glite-info-site-defaults.erb'), - owner => 'root', - group => 'root', - mode => '0644', + content => template($template_glite), + owner => 'root', + group => 'root', + mode => '0644', } } + + +# extract parameter from hiera configuration and prefer bdii::params:: +# to ensure compatibility with older version of puppet BDII module +function bdii::sambdii::params(String $name) { + lookup({ + 'name' => "bdii::${name}", + 'default_value' => getvar("bdii::params::${name}"), + }) +} diff --git a/manifests/sitebdii.pp b/manifests/sitebdii.pp index 893bfe3..8df9e92 100644 --- a/manifests/sitebdii.pp +++ b/manifests/sitebdii.pp @@ -1,50 +1,96 @@ -class bdii::sitebdii( - #this allows to override specific params not only relying on hiera, for sites which have subsite BDIIs, wishing to use hiera both for site and subsite - $siteurls = $bdii::params::siteurls, - $sitename = $bdii::params::sitename, - $sitebdiihost = $bdii::params::sitebdiihost, - $sitedesc = $bdii::params::sitedesc, - $siteweb = $bdii::params::siteweb, - $sitedistributed = $bdii::params::sitedistributed, - $siteloc = $bdii::params::siteloc, - $sitecountry = $bdii::params::sitecountry, - $sitelat = $bdii::params::sitelat, - $sitelong = $bdii::params::sitelong, - $siteemail = $bdii::params::siteemail, - $sitesecuritymail = $bdii::params::sitesecuritymail, - $sitesupportemail = $bdii::params::sitesupportemail, - $config = $bdii::params::config, - $egeeroc = $bdii::params::egeeroc, - $egeeservice = $bdii::params::egeeservice, - $grid = $bdii::params::grid, - $wlcgtier = $bdii::params::wlcgtier, - $otherinfo = $bdii::params::otherinfo, +class bdii::sitebdii ( + # daemon configuration + String $log_level = bdii::sitebdii::params('log_level'), + Stdlib::Port $port = bdii::sitebdii::params('port'), + String $user = bdii::sitebdii::params('user'), + Stdlib::Absolutepath $slapdconf = bdii::sitebdii::params('slapdconf'), + Boolean $selinux = bdii::sitebdii::params('selinux'), + Boolean $firewall = bdii::sitebdii::params('firewall'), + String $bdiipasswd = bdii::sitebdii::params('bdiipasswd'), + Integer $deletedelay = bdii::sitebdii::params('deletedelay'), + Integer $slapdthreads = bdii::sitebdii::params('slapdthreads'), + Integer $slapdloglevel = bdii::sitebdii::params('slapdloglevel'), + Optional[String] $ramsize = bdii::sitebdii::params('ramsize'), + # site specific stuff + Stdlib::Host $bdiihost = bdii::sitebdii::params('bdiihost'), + String $sitename = bdii::sitebdii::params('sitename'), + Array[String] $siteurls = bdii::sitebdii::params('siteurls'), + Stdlib::Host $sitebdiihost = bdii::sitebdii::params('sitebdiihost'), + String $sitedesc = bdii::sitebdii::params('sitedesc'), + String $siteweb = bdii::sitebdii::params('siteweb'), + String $sitedistributed = bdii::sitebdii::params('sitedistributed'), + String $siteloc = bdii::sitebdii::params('siteloc'), + String $sitecountry = bdii::sitebdii::params('sitecountry'), + String $sitelat = bdii::sitebdii::params('sitelat'), + String $sitelong = bdii::sitebdii::params('sitelong'), + String $siteemail = bdii::sitebdii::params('siteemail'), + String $sitesecuritymail = bdii::sitebdii::params('sitesecuritymail'), + String $sitesupportemail = bdii::sitebdii::params('sitesupportemail'), + String $config = bdii::sitebdii::params('config'), + String $egeeroc = bdii::sitebdii::params('egeeroc'), + String $egeeservice = bdii::sitebdii::params('egeeservice'), + Array[String] $grid = bdii::sitebdii::params('grid'), + Optional[String] $wlcgtier = bdii::sitebdii::params('wlcgtier'), + Array[String] $otherinfo = bdii::sitebdii::params('otherinfo'), + # templates + String $template_config = bdii::sitebdii::params('template_config'), + String $template_slapd = bdii::sitebdii::params('template_slapd'), + String $template_sysconfig = bdii::sitebdii::params('template_sysconfig'), + String $template_glite = bdii::sitebdii::params('template_glite'), + String $template_site = bdii::sitebdii::params('template_site'), + String $template_site_urls = bdii::sitebdii::params('template_site_urls'), +) inherits ::bdii::params { -) inherits bdii::params { + class { '::bdii': + log_level => $log_level, + port => $port, + user => $user, + slapdconf => $slapdconf, + selinux => $selinux, + firewall => $firewall, + bdiipasswd => $bdiipasswd, + deletedelay => $deletedelay, + slapdthreads => $slapdthreads, + slapdloglevel => $slapdloglevel, + ramsize => $ramsize, + template_config => $template_config, + template_slapd => $template_slapd, + template_sysconfig => $template_sysconfig, + } Class['bdii::config'] -> Class['bdii::sitebdii'] package { 'emi-bdii-site': - ensure => 'present', - } + ensure => 'present', + } file {'/etc/glite-info-static/site/site.cfg': - content => template('bdii/site.erb'), - owner => 'root', - group => 'root', - mode => '0644', + content => template($template_site), + owner => 'root', + group => 'root', + mode => '0644', } - file {'/etc/bdii/gip/glite-info-site-defaults.conf': - content => template('bdii/glite-info-site-defaults-site.erb'), - owner => 'root', - group => 'root', - mode => '0644', + file { '/etc/bdii/gip/glite-info-site-defaults.conf': + content => template($template_glite), + owner => 'root', + group => 'root', + mode => '0644', } file {'/etc/bdii/gip/site-urls.conf': - content => template('bdii/site_urls.erb'), - owner => 'root', - group => 'root', - mode => '0644', + content => template($template_site_urls), + owner => 'root', + group => 'root', + mode => '0644', } } + + +# extract parameter from hiera configuration and prefer bdii::params:: +# to ensure compatibility with older version of puppet BDII module +function bdii::sitebdii::params(String $name) { + lookup({ + 'name' => "bdii::${name}", + 'default_value' => getvar("bdii::params::${name}"), + }) +} diff --git a/manifests/topbdii.pp b/manifests/topbdii.pp index 7f1360e..c7647a3 100644 --- a/manifests/topbdii.pp +++ b/manifests/topbdii.pp @@ -1,20 +1,64 @@ class bdii::topbdii ( - $sitename = $bdii::params::sitename, - $sitebdiihost = $bdii::params::sitebdiihost, -) inherits bdii::params { + # daemon configuration + String $log_level = bdii::topbdii::params('log_level'), + Stdlib::Port $port = bdii::topbdii::params('port'), + String $user = bdii::topbdii::params('user'), + Stdlib::Absolutepath $slapdconf = bdii::topbdii::params('slapdconf'), + Boolean $selinux = bdii::topbdii::params('selinux'), + Boolean $firewall = bdii::topbdii::params('firewall'), + String $bdiipasswd = bdii::topbdii::params('bdiipasswd'), + Integer $deletedelay = bdii::topbdii::params('deletedelay'), + Integer $slapdthreads = bdii::topbdii::params('slapdthreads'), + Integer $slapdloglevel = bdii::topbdii::params('slapdloglevel'), + Optional[String] $ramsize = bdii::topbdii::params('ramsize'), + # site specific stuff + Stdlib::Host $bdiihost = bdii::topbdii::params('bdiihost'), + String $sitename = bdii::topbdii::params('sitename'), + # templates + String $template_config = bdii::topbdii::params('template_config'), + String $template_slapd = bdii::topbdii::params('template_slapd'), + String $template_sysconfig = bdii::topbdii::params('template_sysconfig'), + String $template_glite = bdii::topbdii::params('template_glite'), +) inherits ::bdii::params { - include ::bdii + class { '::bdii': + log_level => $log_level, + port => $port, + user => $user, + slapdconf => $slapdconf, + selinux => $selinux, + firewall => $firewall, + bdiipasswd => $bdiipasswd, + deletedelay => $deletedelay, + slapdthreads => $slapdthreads, + slapdloglevel => $slapdloglevel, + ramsize => $ramsize, + template_config => $template_config, + template_slapd => $template_slapd, + template_sysconfig => $template_sysconfig, + } Class['bdii::config'] -> Class['bdii::topbdii'] package { 'emi-bdii-top': - ensure => 'present', - } + ensure => 'present', + } file {'/etc/bdii/gip/glite-info-site-defaults.conf': - content => template('bdii/glite-info-site-defaults.erb'), - owner => 'root', - group => 'root', - mode => '0644', + content => template($template_glite), + owner => 'root', + group => 'root', + mode => '0644', + notify => Class['bdii::service'], } } + + +# extract parameter from hiera configuration and prefer bdii::params:: +# to ensure compatibility with older version of puppet BDII module +function bdii::topbdii::params(String $name) { + lookup({ + 'name' => "bdii::${name}", + 'default_value' => getvar("bdii::params::${name}"), + }) +} diff --git a/metadata.json b/metadata.json index 8e65ba7..c524e26 100644 --- a/metadata.json +++ b/metadata.json @@ -3,7 +3,7 @@ "name": "CERNOps-bdii", "author": "CERNOps", "project_page": "https://github.com/cernops/puppet-bdii", - "version": "1.2.2", + "version": "1.3.0", "source": "https://github.com/cernops/puppet-bdii", "license": "Apache-2.0", "dependencies": [ diff --git a/templates/bdii-slapd.erb b/templates/bdii-slapd.conf.erb similarity index 73% rename from templates/bdii-slapd.erb rename to templates/bdii-slapd.conf.erb index be25eb3..1a27c9d 100644 --- a/templates/bdii-slapd.erb +++ b/templates/bdii-slapd.conf.erb @@ -23,19 +23,17 @@ moduleload rwm moduleload back_relay ####################################################################### -# hdb database definitions +# GLUE 1.3 database definitions ####################################################################### database hdb -cachesize 300000 -dncachesize 600000 -idlcachesize 900000 +suffix "o=grid" +cachesize 30000 +checkpoint 1024 0 dbnosync -suffix "o=shadow" -checkpoint 1024 10 -rootdn "o=shadow" -rootpw secret -directory /var/run/bdii/db +rootdn "o=grid" +rootpw <%= @bdiipasswd %> +directory /var/lib/bdii/db/grid index GlueCEAccessControlBaseRule eq index GlueCESEBindCEUniqueID eq @@ -58,28 +56,37 @@ index GlueVOInfoAccessControlBaseRule eq index objectClass eq,pres ####################################################################### -# Relay DB to address performance issues +# Relay DB to address DIT changes requested by ARC ####################################################################### database relay -suffix "o=grid" +suffix "GLUE2GroupName=services,o=glue" +overlay rwm +suffixmassage "GLUE2GroupID=resource,o=glue" + +database relay +suffix "GLUE2GroupName=services,GLUE2DomainID=*,o=glue" +overlay rwm +suffixmassage "GLUE2GroupID=resource,GLUE2DomainID=*,o=glue" + +database relay +suffix "GLUE2GroupName=services,GLUE2DomainID=*,GLUE2GroupName=grid,o=glue" overlay rwm -suffixmassage "o=grid,o=shadow" +suffixmassage "GLUE2GroupID=resource,GLUE2DomainID=*,GLUE2GroupID=grid,o=glue" + ####################################################################### # GLUE 2.0 database definitions ####################################################################### database hdb -cachesize 10000 -dncachesize 20000 -idlcachesize 30000 -dbnosync suffix "o=glue" -checkpoint 1024 10 +cachesize 30000 +checkpoint 1024 0 +dbnosync rootdn "o=glue" -rootpw secret -directory /var/run/bdii/db/glue2 +rootpw <%= @bdiipasswd %> +directory /var/lib/bdii/db/glue index GLUE2GroupID eq index GLUE2ExtensionLocalID eq @@ -101,19 +108,18 @@ index GLUE2StorageServiceCapacityID eq index GLUE2StorageAccessProtocolID eq index GLUE2StorageShareSharingID eq index GLUE2StorageShareCapacityID eq +index GLUE2EndpointInterfaceName eq +index GLUE2PolicyRule eq +index objectClass eq,pres ####################################################################### # Stats database definitions ####################################################################### database hdb -cachesize 1000 -dncachesize 2000 -idlcachesize 3000 -dbnosync suffix "o=infosys" -checkpoint 1024 10 +cachesize 10 +checkpoint 1024 0 +dbnosync rootdn "o=infosys" -#rootpw <% 8.times{ print (65 + rand(25)).chr} %> rootpw <%= @bdiipasswd %> -directory /var/run/bdii/db/stats -loglevel 256 +directory /var/lib/bdii/db/stats diff --git a/templates/bdii-top-slapd.conf.erb b/templates/bdii-top-slapd.conf.erb new file mode 100644 index 0000000..9bf22cf --- /dev/null +++ b/templates/bdii-top-slapd.conf.erb @@ -0,0 +1,133 @@ +include /etc/openldap/schema/core.schema +include /etc/openldap/schema/cosine.schema +include /etc/openldap/schema/nis.schema +include /etc/bdii/BDII.schema +include /etc/ldap/schema/Glue-CORE.schema +include /etc/ldap/schema/Glue-MDS.schema +include /etc/ldap/schema/Glue-CE.schema +include /etc/ldap/schema/Glue-CESEBind.schema +include /etc/ldap/schema/Glue-SE.schema +include /etc/ldap/schema/GLUE20.schema + +allow bind_v2 + +pidfile /var/run/bdii/db/slapd.pid +argsfile /var/run/bdii/db/slapd.args +loglevel <%= @slapdloglevel %> +idletimeout 120 +sizelimit unlimited +timelimit 2400 +threads <%= @slapdthreads %> + +moduleload rwm +moduleload back_relay + +####################################################################### +# GLUE 1.3 database definitions +####################################################################### + +database hdb +cachesize 300000 +dbnosync +suffix "o=shadow" +checkpoint 1024 0 +rootdn "o=shadow" +rootpw <%= @bdiipasswd %> +directory /var/lib/bdii/db/grid + +index GlueCEAccessControlBaseRule eq +index GlueCESEBindCEUniqueID eq +index GlueCESEBindSEUniqueID eq +index GlueCEUniqueID eq +index GlueChunkKey eq +index GlueClusterUniqueID eq +index GlueSAAccessControlBaseRule eq +index GlueSALocalID eq +index GlueSEAccessProtocolType pres +index GlueSEUniqueID eq +index GlueServiceAccessControlRule eq +index GlueServiceAccessControlBaseRule eq +index GlueServiceType eq,sub +index GlueServiceEndpoint eq,sub +index GlueServiceURI eq,sub +index GlueServiceDataKey eq +index GlueSubClusterUniqueID eq +index GlueVOInfoAccessControlBaseRule eq +index objectClass eq,pres + +####################################################################### +# Relay DB to address performance issues +####################################################################### + +database relay +suffix "o=grid" +overlay rwm +suffixmassage "o=grid,o=shadow" + +####################################################################### +# Relay DB to address DIT changes requested by ARC +####################################################################### + +database relay +suffix "GLUE2GroupName=services,o=glue" +overlay rwm +suffixmassage "GLUE2GroupID=resource,o=glue" + +database relay +suffix "GLUE2GroupName=services,GLUE2DomainID=*,o=glue" +overlay rwm +suffixmassage "GLUE2GroupID=resource,GLUE2DomainID=*,o=glue" + +database relay +suffix "GLUE2GroupName=services,GLUE2DomainID=*,GLUE2GroupName=grid,o=glue" +overlay rwm +suffixmassage "GLUE2GroupID=resource,GLUE2DomainID=*,GLUE2GroupID=grid,o=glue" + +####################################################################### +# GLUE 2.0 database definitions +####################################################################### + +database hdb +cachesize 300000 +dbnosync +suffix "o=glue" +checkpoint 1024 0 +rootdn "o=glue" +rootpw <%= @bdiipasswd %> +directory /var/lib/bdii/db/glue + +index GLUE2GroupID eq +index GLUE2ExtensionLocalID eq +index GLUE2LocationID eq +index GLUE2ContactID eq +index GLUE2DomainID eq +index GLUE2ServiceID eq +index GLUE2EndpointID eq +index GLUE2ShareID eq +index GLUE2ManagerID eq +index GLUE2ResourceID eq +index GLUE2ActivityID eq +index GLUE2PolicyID eq +index GLUE2BenchmarkID eq +index GLUE2ApplicationEnvironmentID eq +index GLUE2ApplicationHandleID eq +index GLUE2ToStorageServiceID eq +index GLUE2StorageServiceCapacityID eq +index GLUE2StorageAccessProtocolID eq +index GLUE2StorageShareSharingID eq +index GLUE2StorageShareCapacityID eq +index GLUE2EndpointInterfaceName eq +index GLUE2PolicyRule eq +index objectClass eq,pres + +####################################################################### +# Stats database definitions +####################################################################### +database hdb +cachesize 10 +dbnosync +suffix "o=infosys" +checkpoint 1024 0 +rootdn "o=infosys" +rootpw <%= @bdiipasswd %> +directory /var/lib/bdii/db/stats diff --git a/templates/bdiiconf.erb b/templates/bdiiconf.erb index c71666a..c07512a 100644 --- a/templates/bdiiconf.erb +++ b/templates/bdiiconf.erb @@ -1,4 +1,5 @@ BDII_LOG_FILE=/var/log/bdii/bdii-update.log +BDII_PID_FILE=/var/run/bdii/bdii-update.pid BDII_LOG_LEVEL=<%= @log_level %> BDII_LDIF_DIR=/var/lib/bdii/gip/ldif BDII_PROVIDER_DIR=/var/lib/bdii/gip/provider @@ -7,6 +8,6 @@ BDII_PORT=<%= @port %> BDII_BREATHE_TIME=120 BDII_READ_TIMEOUT=300 BDII_ARCHIVE_SIZE=0 -BDII_DELETE_DELAY=<%= @delete_delay %> +BDII_DELETE_DELAY=<%= @deletedelay %> BDII_USER=<%= @user %> BDII_VAR_DIR=/var/lib/bdii diff --git a/templates/bdiisysconf.erb b/templates/bdiisysconf.erb index f0059c5..221dc48 100644 --- a/templates/bdiisysconf.erb +++ b/templates/bdiisysconf.erb @@ -1,4 +1,9 @@ SLAPD_CONF=<%= @slapdconf %> SLAPD=/usr/sbin/slapd +<% if @ramsize and @ramsize != '' -%> BDII_RAM_DISK=yes +BDII_RAM_SIZE=<%= @ramsize %> +<% else -%> +BDII_RAM_DISK=no +<% end -%> BDII_IPV6_SUPPORT=yes diff --git a/templates/site.erb b/templates/site.erb index 77854f9..fb3b104 100644 --- a/templates/site.erb +++ b/templates/site.erb @@ -37,9 +37,11 @@ OTHERINFO = EGEE_SERVICE=<%= @egeeservice %> <% @grid.each do |g| -%> OTHERINFO = GRID=<%= g %> <% end -%> +<% if @wlcgtier -%> OTHERINFO = WLCG_TIER=<%= @wlcgtier %> +<% end -%> #free other info <% @otherinfo.each do |o| -%> OTHERINFO = <%= o %> -<% end -%> \ No newline at end of file +<% end -%>