libraries/logstash_service_systemd.rb
# DRY: generate service resource for the further reuse
generate service resource for the further reuse
generate service resource for the further reuse
def service_resource
        find_resource(:systemd_unit, "#{new_resource.instance_name}.service") do
          content(
            'Unit' => {
              'Description' => "Logstash #{new_resource.instance_name} service",
              'After' => 'network.target',
              'Documentation' => 'https://www.elastic.co/products/logstash'
            },
            'Service' => {
              'User' => new_resource.user,
              'Group' => new_resource.group,
              'ExecStart' => "#{new_resource.daemon_path} #{new_resource.logstash_args}",
              'EnvironmentFile' => "/etc/default/#{new_resource.instance_name}",
              'Restart' => 'always',
              'RestartSec' => '1 min',
              'LimitNICE' => 19,
              'LimitNOFILE' => new_resource.logstash_max_file_descriptors
            },
            'Install' => {
              'WantedBy' => 'multi-user.target'
            }
          )
          triggers_reload true
          action :nothing
        end
      end
def service_resource find_resource ( :systemd_unit , "#{new_resource.instance_name}.service" ) do content ( 'Unit' => { 'Description' => "Logstash #{new_resource.instance_name} service" , 'After' => 'network.target' , 'Documentation' => 'https://www.elastic.co/products/logstash' } , 'Service' => { 'User' => new_resource . user , 'Group' => new_resource . group , 'ExecStart' => "#{new_resource.daemon_path} #{new_resource.logstash_args}" , 'EnvironmentFile' => "/etc/default/#{new_resource.instance_name}" , 'Restart' => 'always' , 'RestartSec' => '1 min' , 'LimitNICE' => 19 , 'LimitNOFILE' => new_resource . logstash_max_file_descriptors } , 'Install' => { 'WantedBy' => 'multi-user.target' } ) triggers_reload true action :nothing end end
DRY: generate service resource for the further reuse
DRY : generate service resource for the further reuse