diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d006f1..78c8e54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ cookbook-rb-proxy CHANGELOG =============== +## 3.0.0 + + - Miguel Negrón + - [9a6edd4] Merge pull request #54 from redBorder/improvement/#18961_service_list_without_chef + ## 2.1.0 - Miguel Negrón diff --git a/resources/attributes/default.rb b/resources/attributes/default.rb index d323e01..f3444de 100644 --- a/resources/attributes/default.rb +++ b/resources/attributes/default.rb @@ -24,56 +24,50 @@ # memory default['redborder']['memory_services'] = {} -default['redborder']['memory_services']['kafka'] = { 'count': 150, 'memory': 0, 'max_limit': 524288 } -default['redborder']['memory_services']['zookeeper'] = { 'count': 20, 'memory': 0 } -default['redborder']['memory_services']['chef-client'] = { 'count': 10, 'memory': 0 } -default['redborder']['memory_services']['http2k'] = { 'count': 10, 'memory': 0 } default['redborder']['memory_services']['chef-server'] = { 'count': 10, 'memory': 0 } -default['redborder']['memory_services']['snmp'] = { 'count': 5, 'memory': 0, 'max_limit': 10000 } -default['redborder']['memory_services']['redborder-monitor'] = { 'count': 5, 'memory': 0, 'max_limit': 20000 } default['redborder']['memory_services']['f2k'] = { 'count': 40, 'memory': 0 } -default['redborder']['memory_services']['redborder-nmsp'] = { 'count': 10, 'memory': 0 } -default['redborder']['memory_services']['n2klocd'] = { 'count': 10, 'memory': 0 } +default['redborder']['memory_services']['http2k'] = { 'count': 10, 'memory': 0 } default['redborder']['memory_services']['k2http'] = { 'count': 10, 'memory': 0 } - -# exclude mem services, setting memory to 0 for each. -default['redborder']['excluded_memory_services'] = ['chef-client'] +default['redborder']['memory_services']['kafka'] = { 'count': 150, 'memory': 0, 'max_limit': 524288 } +default['redborder']['memory_services']['n2klocd'] = { 'count': 10, 'memory': 0 } +default['redborder']['memory_services']['redborder-monitor'] = { 'count': 5, 'memory': 0, 'max_limit': 20000 } +default['redborder']['memory_services']['redborder-nmsp'] = { 'count': 10, 'memory': 0 } +default['redborder']['memory_services']['snmp'] = { 'count': 5, 'memory': 0, 'max_limit': 10000 } +default['redborder']['memory_services']['zookeeper'] = { 'count': 20, 'memory': 0 } default['redborder']['services'] = {} default['redborder']['services']['chef-client'] = true -default['redborder']['services']['kafka'] = true -default['redborder']['services']['zookeeper'] = true -default['redborder']['services']['rb-monitor'] = true -default['redborder']['services']['redborder-monitor'] = true -default['redborder']['services']['redborder-scanner'] = true -default['redborder']['services']['snmp'] = true +default['redborder']['services']['chrony'] = true default['redborder']['services']['f2k'] = true +default['redborder']['services']['k2http'] = true +default['redborder']['services']['kafka'] = true default['redborder']['services']['logstash'] = false -default['redborder']['services']['pmacct'] = true -default['redborder']['services']['rsyslog'] = true -default['redborder']['services']['redborder-nmsp'] = true -default['redborder']['services']['redborder-ale'] = false default['redborder']['services']['n2klocd'] = true +default['redborder']['services']['pmacct'] = true default['redborder']['services']['radiusd'] = false -default['redborder']['services']['k2http'] = true +default['redborder']['services']['redborder-ale'] = false default['redborder']['services']['redborder-exporter'] = true -default['redborder']['services']['clamav'] = true -default['redborder']['services']['chrony'] = true +default['redborder']['services']['redborder-monitor'] = true +default['redborder']['services']['redborder-nmsp'] = true +default['redborder']['services']['redborder-scanner'] = true +default['redborder']['services']['rsyslog'] = true +default['redborder']['services']['snmp'] = true +default['redborder']['services']['zookeeper'] = true default['redborder']['systemdservices']['chef-client'] = ['chef-client'] -default['redborder']['systemdservices']['kafka'] = ['kafka'] -default['redborder']['systemdservices']['zookeeper'] = ['zookeeper'] -default['redborder']['systemdservices']['redborder-monitor'] = ['redborder-monitor'] -default['redborder']['systemdservices']['redborder-scanner'] = ['redborder-scanner'] -default['redborder']['systemdservices']['snmp'] = ['snmpd'] +default['redborder']['systemdservices']['chrony'] = ['chronyd'] default['redborder']['systemdservices']['f2k'] = ['f2k'] +default['redborder']['systemdservices']['k2http'] = ['k2http'] +default['redborder']['systemdservices']['kafka'] = ['kafka'] default['redborder']['systemdservices']['logstash'] = ['logstash'] -default['redborder']['systemdservices']['pmacct'] = ['sfacctd'] -default['redborder']['systemdservices']['rsyslog'] = ['rsyslog'] -default['redborder']['systemdservices']['redborder-nmsp'] = ['redborder-nmsp'] -default['redborder']['systemdservices']['redborder-ale'] = ['redborder-ale'] default['redborder']['systemdservices']['n2klocd'] = ['n2klocd'] +default['redborder']['systemdservices']['pmacct'] = ['sfacctd'] default['redborder']['systemdservices']['radiusd'] = ['radiusd'] -default['redborder']['systemdservices']['k2http'] = ['k2http'] +default['redborder']['systemdservices']['redborder-ale'] = ['redborder-ale'] default['redborder']['systemdservices']['redborder-exporter'] = ['rb-exporter'] -default['redborder']['systemdservices']['chrony'] = ['chronyd'] +default['redborder']['systemdservices']['redborder-monitor'] = ['redborder-monitor'] +default['redborder']['systemdservices']['redborder-nmsp'] = ['redborder-nmsp'] +default['redborder']['systemdservices']['redborder-scanner'] = ['redborder-scanner'] +default['redborder']['systemdservices']['rsyslog'] = ['rsyslog'] +default['redborder']['systemdservices']['snmp'] = ['snmpd'] +default['redborder']['systemdservices']['zookeeper'] = ['zookeeper'] diff --git a/resources/libraries/memory_services.rb b/resources/libraries/memory_services.rb index 82d69a9..4a33032 100644 --- a/resources/libraries/memory_services.rb +++ b/resources/libraries/memory_services.rb @@ -9,9 +9,7 @@ def memory_services(sysmem_total, excluded_services = []) node['redborder']['memory_services'].each do |name, mem_s| if node['redborder']['services'][name] && !excluded_services.include?(name) - unless node['redborder']['excluded_memory_services'].include?(name) - memory_services_size += mem_s['count'] - end + memory_services_size += mem_s['count'] end memory_services_size_total += mem_s['count'] @@ -24,8 +22,6 @@ def memory_services(sysmem_total, excluded_services = []) node['redborder']['memory_services'].each do |name, mem_s| next unless node['redborder']['services'][name] && !excluded_services.include?(name) - next unless !node['redborder']['excluded_memory_services'].include?(name) - # service count memory assigned * system memory / assigned services memory size memory_serv[name] = (mem_s['count'] * sysmem_total / memory_services_size).round diff --git a/resources/metadata.rb b/resources/metadata.rb index ab94abf..0041b34 100644 --- a/resources/metadata.rb +++ b/resources/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'git@redborder.com' license 'AGPL-3.0' description 'Installs/Configures redborder proxy' -version '2.1.0' +version '3.0.0' depends 'rb-common' depends 'rb-selinux' diff --git a/resources/recipes/configure.rb b/resources/recipes/configure.rb index 2994db6..403696c 100644 --- a/resources/recipes/configure.rb +++ b/resources/recipes/configure.rb @@ -184,7 +184,7 @@ end rb_clamav_config 'Configure ClamAV' do - action(proxy_services['clamav'] ? :add : :remove) + action :add end rb_chrony_config 'Configure Chrony' do diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index e0e23d1..5850181 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -80,3 +80,15 @@ retries 2 variables(hosts_entries: hosts_entries) end + +# Build service list for rbcli +services = node['redborder']['services'] || [] +systemd_services = node['redborder']['systemdservices'] || [] +service_enablement = {} + +systemd_services.each do |service_name, systemd_name| + service_enablement[systemd_name.first] = services[service_name] +end + +Chef::Log.info('Saving services enablement into /etc/redborder/services.json') +File.write('/etc/redborder/services.json', JSON.pretty_generate(service_enablement))