Merge pull request #75 from corvus-migratorius/minor-prometheus-updates

Minor Prometheus updates
This commit is contained in:
Alexander Gorelyshev
2025-12-28 21:13:35 +04:00
committed by GitHub
2 changed files with 20 additions and 23 deletions

View File

@@ -17,15 +17,12 @@ Target node:
Role Variables Role Variables
-------------- --------------
```
prometheus_version: 3.2.1 # prometheus version - `prometheus_version`: the desired Prometheus version
prometheus_dir: "/etc/prometheus" # where to install prometheus - `prometheus_config_source_dir`: where to find config files on the controller
prometheus_user: prometheus # user name - `prometheus_config_dir`: path for Prometheus configuration file on the target machine
prometheus_group: prometheus # groups name - `prometheus_db_dir`: location for the TSDB files
prometheus_config_dir: "/etc/prometheus/conf" # where to place prometheus config - `prometheus_alertrules_source_dir`: where to find alert rules on the controller
prometheus_db_dir: "/var/lib/prometheus" # where to store prometheus db
prometheus_config_source_dir: prometheus # path to config files on source
prometheus_alertrules_source_dir: prometheus/rules # path to rule files on source
``` ```
Dependencies Dependencies

View File

@@ -7,7 +7,19 @@
create_home: false create_home: false
state: present state: present
- name: "Install | Install the binary" - name: "Install | Create directories {{ item }}"
loop:
- "{{ prometheus_config_dir }}"
- "{{ prometheus_config_dir }}/rules"
- "{{ prometheus_db_dir }}"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "prometheus"
group: "prometheus"
mode: "0755"
- name: "Install | Install the binaries"
block: block:
- name: "Install | Check Prometheus version" - name: "Install | Check Prometheus version"
changed_when: false changed_when: false
@@ -22,18 +34,6 @@
fail_msg: "prometheus version {{ prometheus_version }} is not installed or not working correctly" fail_msg: "prometheus version {{ prometheus_version }} is not installed or not working correctly"
rescue: rescue:
- name: "Install | Create directories {{ item }}"
with_items:
- "{{ prometheus_config_dir }}"
- "{{ prometheus_config_dir }}/rules"
- "{{ prometheus_db_dir }}"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "prometheus"
group: "prometheus"
mode: "0755"
- name: "Install | Fetch and unpack the distribution" - name: "Install | Fetch and unpack the distribution"
notify: "(Re)start Prometheus service" notify: "(Re)start Prometheus service"
ansible.builtin.unarchive: ansible.builtin.unarchive:
@@ -43,7 +43,7 @@
remote_src: true remote_src: true
- name: "Install | Put the binaries under the PATH" - name: "Install | Put the binaries under the PATH"
with_items: loop:
- prometheus - prometheus
- promtool - promtool
ansible.builtin.copy: ansible.builtin.copy: