2017-12-05 05:58:34 +01:00
|
|
|
---
|
|
|
|
# Install Prometheus alertmanager.
|
|
|
|
|
|
|
|
- name: set internal variables, part 1
|
|
|
|
set_fact:
|
|
|
|
alertmanager_signature: "alertmanager-{{ alertmanager_version }}.linux-amd64"
|
|
|
|
|
|
|
|
- name: set internal variables, part 2
|
|
|
|
set_fact:
|
|
|
|
alertmanager_daemon_dir: "{{ prometheus_install_path }}/{{ alertmanager_signature }}"
|
|
|
|
|
|
|
|
- name: set download url
|
|
|
|
set_fact:
|
|
|
|
alertmanager_tarball_url: "https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version }}/{{ alertmanager_signature }}.tar.gz"
|
|
|
|
|
|
|
|
- name: download and uncompress alertmanager tarball
|
|
|
|
unarchive:
|
|
|
|
src: "{{ alertmanager_tarball_url }}"
|
|
|
|
dest: "{{ prometheus_install_path }}"
|
|
|
|
copy: no
|
|
|
|
owner: "{{ prometheus_user }}"
|
|
|
|
group: "{{ prometheus_group }}"
|
|
|
|
mode: "go-w"
|
|
|
|
creates: "{{ alertmanager_daemon_dir }}"
|
|
|
|
|
|
|
|
- name: create alertmanager /usr/local/bin links
|
|
|
|
file:
|
|
|
|
src: "{{ alertmanager_daemon_dir }}/{{ item }}"
|
|
|
|
dest: "/usr/local/bin/{{ item }}"
|
|
|
|
state: link
|
|
|
|
with_items:
|
|
|
|
- "alertmanager"
|
|
|
|
- "amtool"
|
|
|
|
|
|
|
|
- name: mkdir for alertmanager data (silences.json for now)
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: "{{ prometheus_user }}"
|
|
|
|
group: "{{ prometheus_group }}"
|
|
|
|
mode: "u=rwx,g=rx,o="
|
|
|
|
with_items:
|
|
|
|
- "{{ alertmanager_db_path }}"
|
|
|
|
|
2018-03-02 07:18:19 +01:00
|
|
|
- name: copy alertmanager systemd config
|
2017-12-05 05:58:34 +01:00
|
|
|
template:
|
|
|
|
src: "alertmanager.service.j2"
|
|
|
|
dest: "/lib/systemd/system/alertmanager.service"
|
|
|
|
|
|
|
|
- name: install alertmanager config file
|
|
|
|
copy:
|
|
|
|
src: "alertmanager.yml"
|
|
|
|
dest: "{{ prometheus_config_path }}/alertmanager.yml"
|
|
|
|
notify:
|
|
|
|
- reload alertmanager
|
|
|
|
|
|
|
|
- name: enable alertmanager service
|
2018-03-02 07:18:19 +01:00
|
|
|
service:
|
2017-12-05 05:58:34 +01:00
|
|
|
name: alertmanager
|
|
|
|
enabled: yes
|
|
|
|
state: started
|