voxpupuli / puppet-winlogbeat

Apache License 2.0
2 stars 30 forks source link

puppet fails to install winlogbeat with service not available error #27

Open sasubillis opened 5 years ago

sasubillis commented 5 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

1) Stop the winlogbeat service if it is already installed 2) delete the service entry on cmd by 'sc delete winlogbeat' 3) Run the puppet to get winlogbeat installed on target node puppet agent -t

Below is the excerpt of puppet class

  class { '::winlogbeat':
    download_url         => $url,
    major_version        => $version,
    package_ensure       => $package,
    outputs              => {
      'logstash'      => {
        'hosts'       => $logstash_hosts,
        'loadbalance' => $load_balance,
      },
    },
    event_logs           => {
      'Application'  => {
      'ignore_older' => '1h',
      },
    },
  }

What are you seeing

Notice: /Stage[main]/Winlogbeat::Install/Archive[C:/Windows/Temp/winlogbeat-6.4.2-windows-x86_64.zip]/ensure: download archive from https://artifacts.elastic.co/downloads/beats/winlogbe
at/winlogbeat-6.4.2-windows-x86_64.zip to C:/Windows/Temp/winlogbeat-6.4.2-windows-x86_64.zip  without cleanup
Notice: /Stage[main]/Winlogbeat::Install/Exec[unzip winlogbeat-6.4.2-windows-x86_64]/returns: executed successfully
Notice: /Stage[main]/Winlogbeat::Install/File[C:/Windows/Temp/winlogbeat-6.4.2-windows-x86_64.zip]/ensure: removed
Notice: /Stage[main]/Winlogbeat::Install/Exec[rename winlogbeat-6.4.2-windows-x86_64]/returns: executed successfully
Notice: /Stage[main]/Winlogbeat::Install/Exec[mark winlogbeat-6.4.2-windows-x86_64]/returns: executed successfully
Info: /Stage[main]/Winlogbeat::Install/Exec[mark winlogbeat-6.4.2-windows-x86_64]: Scheduling refresh of Exec[install winlogbeat-6.4.2-windows-x86_64]
Notice: /Stage[main]/Winlogbeat::Install/Exec[install winlogbeat-6.4.2-windows-x86_64]: Triggered 'refresh' from 1 event
Notice: /Stage[main]/Winlogbeat::Config/File[winlogbeat.yml]/content:

Info: Computing checksum on file C:/Program Files/Winlogbeat/winlogbeat.yml
Info: /Stage[main]/Winlogbeat::Config/File[winlogbeat.yml]: Filebucketed C:/Program Files/Winlogbeat/winlogbeat.yml to puppet with sum 30476c559dfafdd93b3a43384cb52979
Notice: /Stage[main]/Winlogbeat::Config/File[winlogbeat.yml]/content: content changed '{md5}30476c559dfafdd93b3a43384cb52979' to '{md5}e87d9990a8bbf238c39d67bb5e419271'
Info: /Stage[main]/Winlogbeat::Config/File[winlogbeat.yml]: Scheduling refresh of Service[winlogbeat]
Error: Cannot enable winlogbeat, error was: Failed to open a handle to the service:  The specified service does not exist as an installed service.
Wrapped exception:
Failed to open a handle to the service:  The specified service does not exist as an installed service.
Error: /Stage[main]/Winlogbeat::Service/Service[winlogbeat]/ensure: change from 'stopped' to 'running' failed: Cannot enable winlogbeat, error was: Failed to open a handle to the servic
e:  The specified service does not exist as an installed service.
Notice: /Stage[main]/Winlogbeat::Service/Service[winlogbeat]: Triggered 'refresh' from 1 event
Info: Class[Winlogbeat::Service]: Unscheduling all events on Class[Winlogbeat::Service]
Notice: /Stage[main]/Winlogbeat/Anchor[winlogbeat::end]: Dependency Service[winlogbeat] has failures: true

What behaviour did you expect instead

Puppet should able to install winlogbeat without any failures.

Output log

Puppet run failing with service not avaialble Screen Shot 2019-03-26 at 1 01 19 PM

Any additional information you'd like to impart

If I add the service manually with the following command and run puppet , it is not failing. Powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -NoLogo -Command New-Service -name filebeat -displayName Filebeat -binaryPathName '\"C:\Program Files\Filebeat\Filebeat.exe\" -c \"C:\Program Files\Filebeat\filebeat.yml\" -path.home \"C:\Program Files\Filebeat\" -path.data \"C:\ProgramData\filebeat\" -path.logs \"C:\ProgramData\filebeat\logs\"'

sasubillis commented 5 years ago

the command to create the service entry manually is

Powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -NoLogo -Command New-Service -name winlogbeat -displayName Winlogbeat -binaryPathName '\"C:\Program Files\Winlogbeat\winlogbeat.exe\" -c \"C:\Program Files\Winlogbeat\winlogbeat.yml\" -path.home \"C:\Program Files\Winlogbeat\" -path.data \"C:\ProgramData\winlogbeat\" -path.logs \"C:\ProgramData\winlogbeat\logs\"'