1
0
Fork 0
mirror of https://gitlab.com/s3lph/ansible-collection-prometheus synced 2024-11-22 09:41:01 +01:00
ansible-collection-prometheus/roles/prometheus/tasks/install.yml

62 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2020-11-13 10:36:46 +01:00
---
- name: install prometheus
apt:
name: prometheus
state: present
update_cache: yes
- name: start and enable prometheus
systemd:
name: prometheus.service
state: started
enabled: yes
- name: download blackbox exporter
get_url:
url: "https://github.com/prometheus/blackbox_exporter/releases/download/v{{ prometheus_blackbox_exporter_version }}/blackbox_exporter-{{ prometheus_blackbox_exporter_version }}.linux-amd64.tar.gz" # noqa 204
dest: "/root/blackbox_exporter-{{ prometheus_blackbox_exporter_version }}.tar.gz"
- name: unpack blackbox exporter
unarchive:
src: "/root/blackbox_exporter-{{ prometheus_blackbox_exporter_version }}.tar.gz"
dest: "/root"
remote_src: yes
- name: install blackbox exporter
copy:
src: "/root/blackbox_exporter-{{ prometheus_blackbox_exporter_version }}.linux-amd64/blackbox_exporter"
dest: /usr/local/bin/prometheus-blackbox-exporter
remote_src: yes
owner: root
group: root
mode: 0755
- name: install blackbox exporter defaults file
template:
src: etc-defaults-blackbox
dest: /etc/default/prometheus-blackbox-exporter
owner: root
group: root
mode: 0644
- name: install blackbox exporter service
template:
src: prometheus-blackbox-exporter-local.service
dest: /etc/systemd/system/prometheus-blackbox-exporter-local.service
owner: root
group: root
mode: 0644
- name: stop and diable native blackbox exporter
systemd:
name: prometheus-blackbox-exporter.service
state: stopped
enabled: no
- name: start and enable blackbox exporter
systemd:
name: prometheus-blackbox-exporter-local.service
state: started
enabled: yes