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
This commit is contained in:
46
playbooks/infrastructure/install-prometheus.yml
Normal file
46
playbooks/infrastructure/install-prometheus.yml
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
- 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"
|
||||
- "========================================="
|
||||
Reference in New Issue
Block a user