Restore the task naming convention
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: "Copy config file"
|
- name: "Configure| Copy Prometheus configuration files"
|
||||||
notify: "(Re)start Prometheus service"
|
notify: "(Re)start Prometheus service"
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
with_fileglob:
|
with_fileglob:
|
||||||
- "{{ prometheus_config_source_dir }}/*.yml"
|
- "{{ prometheus_config_source_dir }}/*.yml"
|
||||||
|
|
||||||
- name: "Copy alert rules"
|
- name: "Configure | Copy alert rules"
|
||||||
notify: "(Re)start Prometheus service"
|
notify: "(Re)start Prometheus service"
|
||||||
when: prometheus_alertrules_source_dir is defined
|
when: prometheus_alertrules_source_dir is defined
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: "Create Prometheus system group"
|
- name: "Install | Create Prometheus system group"
|
||||||
ansible.builtin.group:
|
ansible.builtin.group:
|
||||||
name: "{{ prometheus_group }}"
|
name: "{{ prometheus_group }}"
|
||||||
system: true
|
system: true
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "Create Prometheus system user"
|
- name: "Install | Create Prometheus system user"
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ prometheus_user }}"
|
name: "{{ prometheus_user }}"
|
||||||
group: "{{ prometheus_group }}"
|
group: "{{ prometheus_group }}"
|
||||||
@@ -14,22 +14,22 @@
|
|||||||
create_home: false
|
create_home: false
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "Install prometheus from binary"
|
- name: "Install | Install the binary"
|
||||||
block:
|
block:
|
||||||
- name: "Check Prometheus version"
|
- name: "Install | Check Prometheus version"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "prometheus --version"
|
cmd: "prometheus --version"
|
||||||
register: prometheus_ver
|
register: prometheus_ver
|
||||||
|
|
||||||
- name: "Assert version correctness"
|
- name: "Install | Assert version correctness"
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: "prometheus_ver.stdout is regex('{{ prometheus_version }}')"
|
that: "prometheus_ver.stdout is regex('{{ prometheus_version }}')"
|
||||||
success_msg: "prometheus version {{ prometheus_version }} is installed and working"
|
success_msg: "prometheus version {{ prometheus_version }} is installed and working"
|
||||||
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: "Create prometheus directories {{ item }}"
|
- name: "Install | Create directories {{ item }}"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
- "{{ prometheus_dir }}"
|
- "{{ prometheus_dir }}"
|
||||||
- "{{ prometheus_db_dir }}"
|
- "{{ prometheus_db_dir }}"
|
||||||
|
|
||||||
- name: "Download Prometheus binary"
|
- name: "Install | Download the binary distribution"
|
||||||
ansible.builtin.get_url:
|
ansible.builtin.get_url:
|
||||||
url: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
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"
|
dest: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
group: "{{ prometheus_group }}"
|
group: "{{ prometheus_group }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
- name: "Unpack Prometheus binaries"
|
- 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: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
||||||
@@ -57,12 +57,12 @@
|
|||||||
creates: "{{ prometheus_dir }}/prometheus-{{ prometheus_version }}.linux-amd64"
|
creates: "{{ prometheus_dir }}/prometheus-{{ prometheus_version }}.linux-amd64"
|
||||||
remote_src: true
|
remote_src: true
|
||||||
|
|
||||||
- name: "Cleanup downloaded file"
|
- name: "Install | Clean up downloads"
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
path: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: "Move official prometheus and promtool binaries"
|
- name: "Install | Move official prometheus and promtool binaries"
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ prometheus_dir }}/prometheus-{{ prometheus_version }}.linux-amd64/{{ item }}"
|
src: "{{ prometheus_dir }}/prometheus-{{ prometheus_version }}.linux-amd64/{{ item }}"
|
||||||
dest: "/usr/local/bin/{{ item }}"
|
dest: "/usr/local/bin/{{ item }}"
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
- prometheus
|
- prometheus
|
||||||
- promtool
|
- promtool
|
||||||
|
|
||||||
- name: "Create systemd service unit"
|
- name: "Install | Create a systemd service unit"
|
||||||
notify: "(Re)start Prometheus service"
|
notify: "(Re)start Prometheus service"
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: prometheus.service.j2
|
src: prometheus.service.j2
|
||||||
|
|||||||
Reference in New Issue
Block a user