-
Notifications
You must be signed in to change notification settings - Fork 18
/
provision-infra-all-promtail.yml
93 lines (81 loc) · 2.36 KB
/
provision-infra-all-promtail.yml
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
- name: PROMTAIL
hosts: promtail
become: yes
tasks:
- name: PROMTAIL - Ensure build dependencies
apt:
name: unzip
state: present
- name : PROMTAIL - Set config
copy:
dest: /netsoc/promtail.yml
mode: 0777
content: |
server:
http_listen_port: 9080
grpc_listen_port: 0
log_level: "info"
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki.netsoc.co/loki/api/v1/push
basic_auth:
username: {{ loki.username }}
password: {{ loki.password }}
scrape_configs:
- job_name: syslog
static_configs:
- targets:
- localhost
labels:
job: "syslog-{{ inventory_hostname }}"
__path__: /var/log/syslog
- job_name: varlogs
static_configs:
- targets:
- localhost
labels:
job: "varlogs-{{ inventory_hostname }}"
__path__: /var/log/*.log
- job_name: ipalogs
static_configs:
- targets:
- localhost
labels:
job: "ipalogs-{{ inventory_hostname }}"
__path__: /netsoc/ipa/var/log/*
- name: PROMTAIL - Install
unarchive:
src: https://github.com/grafana/loki/releases/download/v2.0.0/promtail-linux-amd64.zip
dest: /usr/local/bin
remote_src: yes
- name: PROMTAIL - Install systemd service
copy:
dest: /etc/systemd/system/promtail.service
mode: 0777
content: |
[Unit]
Description=Promtail service
After=network.target
[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/promtail-linux-amd64 -config.file /netsoc/promtail.yml
[Install]
WantedBy=multi-user.target
- name: PROMTAIL - Enable and start service
systemd:
state: started
enabled: yes
daemon_reload: yes
name: promtail
- name: PROMTAIL - Restart service
systemd:
state: restarted
enabled: yes
name: promtail
vars_files:
- vars/secrets_mapping.yml
- vars/secrets.yml
- vars/network.yml