Simplify installation handling
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
---
|
---
|
||||||
prometheus_version: 3.2.1
|
prometheus_version: 3.2.1
|
||||||
prometheus_dir: "/etc/prometheus"
|
|
||||||
prometheus_config_dir: "/etc/prometheus"
|
prometheus_config_dir: "/etc/prometheus"
|
||||||
prometheus_db_dir: "/var/lib/prometheus"
|
prometheus_db_dir: "/var/lib/prometheus"
|
||||||
|
|||||||
@@ -34,38 +34,30 @@
|
|||||||
group: "prometheus"
|
group: "prometheus"
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: "Install | Download the binary distribution"
|
- name: "Install | Fetch and unpack the distribution"
|
||||||
ansible.builtin.get_url:
|
|
||||||
url: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
|
||||||
dest: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
|
||||||
owner: "prometheus"
|
|
||||||
group: "prometheus"
|
|
||||||
mode: "0644"
|
|
||||||
|
|
||||||
- name: "Install | Unpack the distribution"
|
|
||||||
notify: "(Re)start Prometheus service"
|
notify: "(Re)start Prometheus service"
|
||||||
ansible.builtin.unarchive:
|
ansible.builtin.unarchive:
|
||||||
src: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
src: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
||||||
dest: "{{ prometheus_dir }}"
|
dest: "/tmp"
|
||||||
creates: "{{ prometheus_dir }}/prometheus-{{ prometheus_version }}.linux-amd64"
|
creates: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64"
|
||||||
remote_src: true
|
remote_src: true
|
||||||
|
|
||||||
- name: "Install | Clean up downloads"
|
- name: "Install | Put the binaries under the PATH"
|
||||||
ansible.builtin.file:
|
|
||||||
path: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: "Install | Move official prometheus and promtool binaries"
|
|
||||||
with_items:
|
with_items:
|
||||||
- prometheus
|
- prometheus
|
||||||
- promtool
|
- promtool
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ prometheus_dir }}/prometheus-{{ prometheus_version }}.linux-amd64/{{ item }}"
|
remote_src: true
|
||||||
dest: "/usr/local/bin/{{ item }}"
|
src: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64/{{ item }}"
|
||||||
mode: "0755"
|
dest: "/usr/bin/{{ item }}"
|
||||||
owner: "prometheus"
|
owner: "prometheus"
|
||||||
group: "prometheus"
|
group: "prometheus"
|
||||||
remote_src: true
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: "Install | Clean up the downloads"
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64"
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: "Install | Create a systemd service unit"
|
- name: "Install | Create a systemd service unit"
|
||||||
notify: "(Re)start Prometheus service"
|
notify: "(Re)start Prometheus service"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Documentation="https://prometheus.io/"
|
|||||||
User=prometheus
|
User=prometheus
|
||||||
Group=prometheus
|
Group=prometheus
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/local/bin/prometheus \
|
ExecStart=/usr/bin/prometheus \
|
||||||
--config.file {{ prometheus_config_dir }}/prometheus.yml \
|
--config.file {{ prometheus_config_dir }}/prometheus.yml \
|
||||||
--storage.tsdb.path {{ prometheus_db_dir }} \
|
--storage.tsdb.path {{ prometheus_db_dir }} \
|
||||||
--storage.tsdb.retention.time=30d
|
--storage.tsdb.retention.time=30d
|
||||||
|
|||||||
Reference in New Issue
Block a user