feat: initial installation role for prometheus

This commit is contained in:
2026-05-24 17:13:40 +02:00
commit 28ea6ef2af
6 changed files with 190 additions and 0 deletions

39
README.md Normal file
View File

@@ -0,0 +1,39 @@
# ansible-role-prometheus
Installs Prometheus from GitHub releases on Linux. Architecture is auto-detected.
The role is idempotent: it only downloads and extracts when the version changes.
The service user and group must be created beforehand.
Prometheus configuration (`prometheus.yml`) is out of scope for this role.
## Requirements
- Ansible >= 2.14
## Role Variables
| Variable | Default | Description |
|---|---|---|
| `prometheus_version` | `""` | Version to install (empty = latest) |
| `prometheus_user` | `prometheus` | User to run Prometheus |
| `prometheus_group` | `prometheus` | Group to run Prometheus |
| `prometheus_install_dir` | `/opt/prometheus` | Binary and assets directory |
| `prometheus_data_dir` | `/var/lib/prometheus` | TSDB storage directory |
| `prometheus_config_dir` | `/etc/prometheus` | Configuration directory |
| `prometheus_service_enabled` | `true` | Enable service at boot |
| `prometheus_service_state` | `started` | Service state after installation |
## Example Playbook
```yaml
- hosts: monitoring_servers
roles:
- role: ansible-role-prometheus
vars:
prometheus_user: prometheus
prometheus_group: prometheus
```
## License
MIT