Added Windows support for metricbeat

This commit is contained in:
James Tombleson 2019-04-30 21:43:04 -07:00
parent 76e0466edf
commit fde241d31b
4 changed files with 43 additions and 3 deletions

View File

@ -1,5 +1,3 @@
---
- name: Install Metricbeat

View File

@ -1,12 +1,18 @@
---
# defaults file for luther38.metricbeat
# Defines the kibana host we will send data to
kibana_host: 127.0.0.1
# Example: '["172.0.0.1:9200"]'
elasticsearch_hosts: '["172.0.0.1:9200"]'
# tells ansible to enable the service on startup
systemd_enable_service: true
# Tells ansible to restart the service after everything has been done
systemd_restart_service: true
# Defines the version of metricbeat to install.
# Currently used for Windows
version: 7.0.0

View File

@ -4,3 +4,7 @@
- name: Install Metricbeat on Ubuntu
when: ansible_distribution == 'Ubuntu'
include: ubuntu.yml
- name: Install Metricbeat on Windows
when: ansible_distribution == 'Windows'
include: windows.yml

View File

@ -0,0 +1,32 @@
# This will install metricbeat on a windows host.
---
- name: make temp folder
win_file:
path: c:\tmp\
state: directory
- name: download metricbeat
win_get_url:
url: '{{ url_metricbeat }}'
dest: 'C:\temp\metricbeat-{{ version }}.zip'
force: no
- name: unzip metricbeat
win_unzip:
src: c:\temp\metricbeat-{{ version }}.zip
dest: C:\temp\metricbeat-{{ version }}\
creates: C:\temp\metricbeat-{{ version }}\
- name: Copy metricbeat-{{ version }} folder
win_command: powershell.exe copy-item -Path 'c:\temp\metricbeat-{{ version }}\heartbeat-{{ version }}-windows-x86_64\' -Filter * -Recurse -Destination 'C:\Program Files\Metricbeat\'
args:
creates: C:\Program Files\Metricbeat\
- name: Update template
win_template:
src: metricbeat.j2
dest: C:\Program Files\Metricbeat\metricbeat.yml
- name: Install Metricbeat service
win_command: powershell.exe -ExecutionPolicy ByPass -File 'C:\Program Files\Metricbeat\install-service-metricbeat.ps1'