Initial Ansible automation for homelab infrastructure

This commit is contained in:
Adyrem
2026-05-13 16:17:04 +02:00
commit e9b6bf9e9a
24 changed files with 583 additions and 0 deletions
@@ -0,0 +1,14 @@
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://localhost:9090
isDefault: true
editable: true
- name: Loki
type: loki
access: proxy
url: http://localhost:3100
editable: true
@@ -0,0 +1,44 @@
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: info
common:
instance_addr: 127.0.0.1
path_prefix: /var/lib/loki
storage:
filesystem:
chunks_directory: /var/lib/loki/chunks
rules_directory: /var/lib/loki/rules
replication_factor: 1
ring:
kvstore:
store: inmemory
query_range:
results_cache:
cache:
embedded_cache:
enabled: true
max_size_mb: 100
limits_config:
metric_aggregation_enabled: true
schema_config:
configs:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
ruler:
alertmanager_url: http://localhost:9093
analytics:
reporting_enabled: false
@@ -0,0 +1,29 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: ['localhost:9093']
rule_files:
- /etc/prometheus/rules/*.yml
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
labels:
instance: monitoring
{% for job in prometheus_scrape_targets %}
- job_name: {{ job.job }}
static_configs:
{% for target in job.targets %}
- targets: ['{{ target.address }}']
labels:
instance: {{ target.host }}
{% endfor %}
{% endfor %}
@@ -0,0 +1,30 @@
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /var/lib/promtail/positions.yaml
clients:
- url: http://localhost:3100/loki/api/v1/push
scrape_configs:
- job_name: journal
journal:
max_age: 12h
labels:
job: systemd-journal
host: monitoring
relabel_configs:
- source_labels: [__journal__systemd_unit]
target_label: unit
- source_labels: [__journal__hostname]
target_label: hostname
- job_name: varlogs
static_configs:
- targets: [localhost]
labels:
job: varlogs
host: monitoring
__path__: /var/log/*.log