Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configurable $config_director_dirs with purge option #43

Merged
merged 1 commit into from
Dec 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ rvm:
cache: bundler
script: bundle exec rake test
env:
- PUPPET_GEM_VERSION="~> 3.4.0"
- PUPPET_GEM_VERSION="~> 3.6.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 3.8.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 3.8.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes
- PUPPET_GEM_VERSION="~> 4.0.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 4.4.0" STRICT_VARIABLES=yes
- PUPPET_GEM_VERSION="~> 4.6.0" STRICT_VARIABLES=yes
Expand All @@ -31,28 +27,10 @@ matrix:
env: PUPPET_GEM_VERSION="~> 4.6.0" STRICT_VARIABLES=yes
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 5.0.1" STRICT_VARIABLES=yes
- rvm: 2.1
env: PUPPET_GEM_VERSION="~> 3.4.0"
# eclude all puppet 3.x 5.x for ruby 2.3
- rvm: 2.3
env: PUPPET_GEM_VERSION="~> 3.4.0"
- rvm: 2.3
env: PUPPET_GEM_VERSION="~> 3.6.0" STRICT_VARIABLES=yes
- rvm: 2.3
env: PUPPET_GEM_VERSION="~> 3.8.0" STRICT_VARIABLES=yes
- rvm: 2.3
env: PUPPET_GEM_VERSION="~> 3.8.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes
- rvm: 2.3
env: PUPPET_GEM_VERSION="~> 5.0.1" STRICT_VARIABLES=yes
# eclude all puppet 3.x 4.x for ruby 2.4
- rvm: 2.4
env: PUPPET_GEM_VERSION="~> 3.4.0"
- rvm: 2.4
env: PUPPET_GEM_VERSION="~> 3.6.0" STRICT_VARIABLES=yes
- rvm: 2.4
env: PUPPET_GEM_VERSION="~> 3.8.0" STRICT_VARIABLES=yes
- rvm: 2.4
env: PUPPET_GEM_VERSION="~> 3.8.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes
- rvm: 2.4
env: PUPPET_GEM_VERSION="~> 4.0.0" STRICT_VARIABLES=yes
- rvm: 2.4
Expand Down
56 changes: 26 additions & 30 deletions manifests/director.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
# This class will be automatically included when a resource is defined.
# It is not intended to be used directly by external resources like node definitions or other modules.
class bareos::director(
$manage_service = $::bareos::manage_service,
$manage_package = $::bareos::manage_package,
$manage_database = $::bareos::manage_database,
$package_name = $::bareos::director_package_name,
$package_ensure = $::bareos::package_ensure,
$service_name = $::bareos::director_service_name,
$service_ensure = $::bareos::service_ensure,
$service_enable = $::bareos::service_enable,
$config_dir = "${::bareos::config_dir}/bareos-dir.d"
$manage_service = $::bareos::manage_service,
$manage_package = $::bareos::manage_package,
$manage_database = $::bareos::manage_database,
$package_name = $::bareos::director_package_name,
$package_ensure = $::bareos::package_ensure,
$service_name = $::bareos::director_service_name,
$service_ensure = $::bareos::service_ensure,
$service_enable = $::bareos::service_enable,
$config_dir = "${::bareos::config_dir}/bareos-dir.d",
Array[String] $managed_dirs = $::bareos::director_managed_dirs,
) inherits ::bareos {
include ::bareos::director::director

Expand All @@ -32,28 +33,8 @@
}
}

# directories
$config_director_dirs = [
$config_dir,
"${config_dir}/catalog",
"${config_dir}/client",
"${config_dir}/console",
"${config_dir}/counter",
"${config_dir}/director",
"${config_dir}/fileset",
"${config_dir}/job",
"${config_dir}/jobdefs",
"${config_dir}/messages",
"${config_dir}/pool",
"${config_dir}/profile",
"${config_dir}/schedule",
"${config_dir}/storage",
]

file { $config_director_dirs:
file { $config_dir:
ensure => directory,
purge => true,
recurse => true,
force => true,
mode => $::bareos::file_dir_mode,
owner => $::bareos::file_owner,
Expand All @@ -63,6 +44,21 @@
tag => ['bareos', 'bareos_director'],
}

$managed_dirs.each |$managed_dir| {
file { "${config_dir}/${managed_dir}":
ensure => directory,
purge => true,
recurse => true,
force => true,
require => Package[$package_name],
mode => $::bareos::file_dir_mode,
owner => $::bareos::file_owner,
group => $::bareos::file_group,
notify => Service[$service_name],
tag => ['bareos', 'bareos_director'],
}
}

if $manage_database {
File <| tag == 'bareos_director' |> -> exec { 'bareos director init catalog':
command => '/usr/lib/bareos/scripts/create_bareos_database && /usr/lib/bareos/scripts/make_bareos_tables && /usr/lib/bareos/scripts/grant_bareos_privileges',
Expand Down
17 changes: 9 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
$monitor_package_name = $::bareos::params::monitor_package_name,
$director_package_name = $::bareos::params::director_package_name,
$director_service_name = $::bareos::params::director_service_name,
$director_managed_dirs = $::bareos::params::director_managed_dirs,
$client_package_name = $::bareos::params::client_package_name,
$client_service_name = $::bareos::params::client_service_name,
$storage_package_name = $::bareos::params::storage_package_name,
Expand Down Expand Up @@ -66,13 +67,13 @@
}

file { $config_dir:
ensure => directory,
purge => true,
recurse => true,
force => true,
mode => $::bareos::file_dir_mode,
owner => $::bareos::file_owner,
group => $::bareos::file_group,
tag => ['bareos', 'bareos_core'],
ensure => directory,
purge => true,
recurse => true,
recurselimit => 1,
mode => $::bareos::file_dir_mode,
owner => $::bareos::file_owner,
group => $::bareos::file_group,
tag => ['bareos', 'bareos_core'],
}
}
14 changes: 14 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@
'bareos-database-tools',
]
$director_service_name = 'bareos-dir'
$director_managed_dirs = [ 'catalog',
'client',
'console',
'counter',
'director',
'fileset',
'job',
'jobdefs',
'messages',
'pool',
'profile',
'schedule',
'storage',
]

# filedaemon/client
$client_package_name = ['bareos-filedaemon', 'bareos-filedaemon-python-plugin']
Expand Down