2021-05-29 11:45:35 +00:00
|
|
|
---
|
2021-05-29 20:48:56 +00:00
|
|
|
- name: Set current prometheus version
|
|
|
|
set_fact:
|
|
|
|
prometheus_current_version: "{{ (ansible_local.prometheus | default (dict(version='0.0.0')))['version'] }}"
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: Current version is '{{ prometheus_current_version }}'
|
|
|
|
|
2021-05-29 11:45:35 +00:00
|
|
|
- block:
|
|
|
|
- name: Create group '{{ prometheus_group }}'
|
|
|
|
group:
|
|
|
|
name: "{{ prometheus_group }}"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create user '{{ prometheus_user }}'
|
|
|
|
user:
|
|
|
|
comment: Prometheus
|
|
|
|
name: "{{ prometheus_user }}"
|
|
|
|
home: "{{ prometheus_user_home }}"
|
|
|
|
group: "{{ prometheus_group }}"
|
|
|
|
groups: "{{ prometheus_extra_groups | join(',') }}"
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
package:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
loop:
|
|
|
|
- "{{ prometheus_packages }}"
|
2021-05-29 20:48:56 +00:00
|
|
|
|
|
|
|
- name: Setup local facts
|
|
|
|
file:
|
|
|
|
path: /etc/ansible/facts.d
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
2021-05-29 11:45:35 +00:00
|
|
|
become: True
|
|
|
|
become_user: root
|