diff --git a/attributes/default.rb b/attributes/default.rb index 6de0c53..67bcf14 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -25,6 +25,8 @@ default['nexus3']['properties_variables']['nexus-context-path'] = '/' default['nexus3']['properties_variables']['nexus.scripts.allowCreation'] = 'true' +default['nexus3']['logback_variables'] = {} + default['nexus3']['nofile_limit'] = 65_536 # Nexus JVM tunning diff --git a/resources/default.rb b/resources/default.rb index 60a6b8c..0ce2ccd 100644 --- a/resources/default.rb +++ b/resources/default.rb @@ -18,8 +18,9 @@ property :vmoptions_variables, Hash, default: lazy { node['nexus3']['vmoptions_variables'] } property :outbound_proxy, [Hash, NilClass], sensitive: true, default: lazy { node['nexus3']['outbound_proxy'] } property :plugins, Hash, default: lazy { node['nexus3']['plugins'] } +property :logback_variables, Hash, default: lazy { node['nexus3']['logback_variables'] } -action :install do +action :install do # rubocop:disable Metrics/BlockLength install_dir = ::File.join(new_resource.path, "nexus-#{new_resource.version}") group new_resource.nexus3_group do @@ -108,6 +109,18 @@ notifies :run, "ruby_block[#{blocker}]", :delayed end + template ::File.join(new_resource.data, 'etc', 'logback', 'logback.xml') do + source new_resource.logback_variables['source'] + cookbook new_resource.logback_variables['cookbook'] + mode '0644' + owner new_resource.nexus3_user + group new_resource.nexus3_group + variables(config: new_resource.logback_variables['config']) + notifies :restart, "nexus3_service[#{new_resource.service_name}]", :delayed + notifies :run, "ruby_block[#{blocker}]", :delayed + not_if { new_resource.logback_variables.empty? } + end + # Install plugins new_resource.plugins.each do |name, config| plugin_file_path = ::File.join(install_dir, 'deploy', "#{config['name'] || name}-bundle.kar")