Files
ansible-config/playbooks/infrastructure/install-prometheus.yml
Freazzzing 8212b75ac9 feat: Add Prometheus installation role and playbook
- Created Prometheus role with automated installation
- Version: 2.48.1
- Configured remote_write to VictoriaMetrics (192.168.0.104:8428)
- Added scrape configs for monitoring infrastructure
- Created systemd service configuration
- Successfully tested on 192.168.0.105
2026-02-03 02:26:22 +00:00

47 lines
1.3 KiB
YAML

---
- name: Install and Configure Prometheus
hosts: 192.168.0.105 # Prometheus container
become: yes
gather_facts: yes
pre_tasks:
- name: Update apt cache
apt:
update_cache: yes
cache_valid_time: 3600
- name: Install required packages
apt:
name:
- curl
- wget
- ca-certificates
state: present
roles:
- role: ../../roles/prometheus
post_tasks:
- name: Verify Prometheus is accessible from target host
uri:
url: "http://localhost:9090/metrics"
status_code: 200
- name: Check VictoriaMetrics connectivity from Prometheus
uri:
url: "http://192.168.0.104:8428/health"
status_code: 200
- name: Display access information
debug:
msg:
- "========================================="
- "Prometheus installed successfully!"
- "========================================="
- "Web UI: http://{{ ansible_host }}:9090"
- "Metrics: http://{{ ansible_host }}:9090/metrics"
- "Targets: http://{{ ansible_host }}:9090/targets"
- "Configuration: /etc/prometheus/prometheus.yml"
- "Data directory: /var/lib/prometheus"
- "========================================="