-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwin11.yaml
27 lines (27 loc) · 1.02 KB
/
win11.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
- name: Install Windows Exporter
hosts: 10.10.5.184
become: yes
tasks:
- name: Download Windows Exporter
win_get_url:
url: https://github.com/prometheus-community/windows_exporter/releases/download/v0.18.1/windows_exporter-0.18.1-amd64.exe
dest: C:\Prometheus\windows_exporter.exe
register: download_result
- name: Ensure Prometheus Directory Exists
win_file:
path: C:\Prometheus
state: directory
- name: Create Windows Exporter Service
win_shell: >
New-Service -Name "Windows-Exporter" -BinaryPathName
"C:\Prometheus\windows_exporter.exe
--collectors.enabled="cpu,logon,logical_disk,mem,net,os,system,thermal_zone""
-DisplayName "Prometheus Windows Exporter" -Description "Prometheus
Windows Exporter Service" -StartupType Automatic
when: download_result.changed
- name: Start Windows Exporter Service
win_service:
name: Windows-Exporter
state: started
when: download_result.changed