docs: rewrite README with structured overview and quick start guide
Replaces the minimal project description with a comprehensive README including a component overview table, quick start instructions, common Ansible operations, and links to detailed documentation. Aligns with Red Panda Approval™ standards.
This commit is contained in:
82
ansible/prometheus/deploy.yml
Normal file
82
ansible/prometheus/deploy.yml
Normal file
@@ -0,0 +1,82 @@
|
||||
---
|
||||
- name: Deploy Prometheus
|
||||
hosts: ubuntu
|
||||
become: true
|
||||
tasks:
|
||||
- name: Check if host has prometheus service
|
||||
ansible.builtin.set_fact:
|
||||
has_prometheus_service: "{{'prometheus' in services}}"
|
||||
|
||||
- name: Skip hosts without prometheus service
|
||||
ansible.builtin.meta: end_host
|
||||
when: not has_prometheus_service
|
||||
|
||||
- name: Install Prometheus
|
||||
ansible.builtin.apt:
|
||||
name: prometheus
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Fix Prometheus directory permissions
|
||||
ansible.builtin.file:
|
||||
path: /var/lib/prometheus
|
||||
owner: prometheus
|
||||
group: prometheus
|
||||
mode: '750'
|
||||
recurse: true
|
||||
|
||||
- name: Create textfile collector directory
|
||||
ansible.builtin.file:
|
||||
path: /var/lib/prometheus/node-exporter
|
||||
state: directory
|
||||
owner: prometheus
|
||||
group: prometheus
|
||||
mode: '750'
|
||||
|
||||
- name: Template prometheus.yml to Prospero
|
||||
ansible.builtin.template:
|
||||
src: prometheus.yml.j2
|
||||
dest: /etc/prometheus/prometheus.yml
|
||||
owner: prometheus
|
||||
group: prometheus
|
||||
mode: '640'
|
||||
notify: restart prometheus
|
||||
|
||||
- name: Template alert_rules.yml to Prospero
|
||||
ansible.builtin.template:
|
||||
src: alert_rules.yml.j2
|
||||
dest: /etc/prometheus/alert_rules.yml
|
||||
owner: prometheus
|
||||
group: prometheus
|
||||
mode: '640'
|
||||
notify: restart prometheus
|
||||
|
||||
- name: Create Prometheus systemd override directory
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/system/prometheus.service.d
|
||||
state: directory
|
||||
mode: '755'
|
||||
|
||||
- name: Enable remote write receiver
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/metrics2/ --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries --web.listen-address=0.0.0.0:9090 --web.external-url= --web.enable-remote-write-receiver
|
||||
dest: /etc/systemd/system/prometheus.service.d/override.conf
|
||||
mode: '644'
|
||||
notify: restart prometheus
|
||||
|
||||
- name: Start and enable Prometheus service
|
||||
ansible.builtin.systemd:
|
||||
name: prometheus
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
|
||||
handlers:
|
||||
- name: restart prometheus
|
||||
ansible.builtin.systemd:
|
||||
name: prometheus
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
Reference in New Issue
Block a user