2019-04-24 14:40:05 -07:00
|
|
|
---
|
|
|
|
# This will install all the client parts needed for elastic to monitor client computers
|
|
|
|
|
|
|
|
- name: download metricbeat
|
|
|
|
win_get_url:
|
|
|
|
url: '{{ url_metricbeat }}'
|
|
|
|
dest: 'C:\temp\metricbeat-{{ elastic_version }}.zip'
|
|
|
|
force: no
|
|
|
|
|
|
|
|
- name: unzip heartbeat
|
|
|
|
win_unzip:
|
|
|
|
src: c:\temp\metricbeat-{{ elastic_version }}.zip
|
|
|
|
dest: C:\temp\metricbeat-{{ elastic_version }}\
|
|
|
|
creates: C:\temp\metricbeat-{{ elastic_version }}\
|
|
|
|
|
|
|
|
- name: Copy metricbeat-{{ elastic_version }} folder
|
|
|
|
win_command: powershell.exe copy-item -Path 'c:\temp\metricbeat-{{ elastic_version }}\metricbeat-{{ elastic_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
|
|
|
|
|
2019-04-24 15:53:43 -07:00
|
|
|
- name: Check if metricbeat service is installed
|
|
|
|
register: service_metricbeat
|
|
|
|
win_service:
|
|
|
|
name: metricbeat
|
|
|
|
|
2019-04-25 09:29:45 -07:00
|
|
|
#- debug: var=service_metricbeat
|
2019-04-24 15:53:43 -07:00
|
|
|
|
2019-04-24 14:40:05 -07:00
|
|
|
- name: Install Metricbeat service
|
|
|
|
win_command: powershell.exe -ExecutionPolicy ByPass -File install-service-metricbeat.ps1
|
|
|
|
args:
|
|
|
|
chdir: C:\program files\metricbeat\
|
2019-04-24 15:53:43 -07:00
|
|
|
when: service_metricbeat.exists == false
|
|
|
|
|
|
|
|
- name: check status of metricbeat service
|
|
|
|
register: service_metricbeat
|
|
|
|
win_service:
|
|
|
|
name: metricbeat
|
|
|
|
|
2019-04-25 09:29:45 -07:00
|
|
|
#- debug: var=service_metricbeat
|
2019-04-24 14:40:05 -07:00
|
|
|
|
2019-04-24 15:53:43 -07:00
|
|
|
- name: restart service
|
2019-04-24 14:40:05 -07:00
|
|
|
win_service:
|
|
|
|
name: metricbeat
|
2019-04-24 15:53:43 -07:00
|
|
|
state: restarted
|
|
|
|
when: service_metricbeat.state == 'started'
|
2019-04-24 14:40:05 -07:00
|
|
|
|
|
|
|
- name: start service
|
|
|
|
win_service:
|
|
|
|
name: metricbeat
|
|
|
|
state: started
|
2019-04-24 15:53:43 -07:00
|
|
|
when: service_metricbeat.state == 'stopped'
|