infra/roles/monitoring-server/tasks/main.yml

108 lines
2.2 KiB
YAML

---
- name: install certs
copy:
src: "/usr/local/etc/letsencrypt/live/{{ item }}"
dest: "/usr/local/etc/certs/"
owner: root
group: root
mode: 0755
tags:
- letsencrypt
- letsencrypt-certs
- grafana
- influxdb
notify: reload nginx
vars:
prediff_cmd: echo
with_items:
- "{{ grafana_url }}"
- "{{ influxdb_url }}"
- name: add apt key for influxdb, grafana
apt_key:
url: "{{ item }}"
state: present
with_items:
- https://repos.influxdata.com/influxdb.key
- https://packages.grafana.com/gpg.key
tags:
- packages
- influxdb
- grafana
- name: add repo for influxdb, grafana
apt_repository:
repo: "deb {{ item }}"
state: present
update_cache: true
with_items:
- https://repos.influxdata.com/{{ ansible_lsb.id | lower }} {{ ansible_lsb.codename }} stable
- https://packages.grafana.com/oss/deb stable main
tags:
- packages
- grafana
- influxdb
- name: install influxdb, grafana
apt:
name:
- influxdb
- grafana
state: latest
tags:
- packages
- grafana
- influxdb
notify:
- restart influxdb
- restart grafana
- name: enable influxdb, grafana
service:
name: "{{ item }}"
enabled: true
with_items:
- influxdb
- grafana-server
tags:
- packages
- influxfb
- grafana
notify:
- restart influxdb
- restart grafana
- name: create dir for influxdb systemd override file
file:
path: /etc/systemd/system/influxdb.service.d
state: directory
tags:
- influxdb-systemd
- name: template influxdb systemd override file to set longer startup timeout
template:
src: influxdb-override.conf.j2
dest: /etc/systemd/system/influxdb.service.d/override.conf
tags:
- influxdb-systemd
notify: daemon-reload
- name: sleep longer before doing healthcheck in startup script from package
lineinfile:
path: /usr/lib/influxdb/scripts/influxd-systemd-start.sh
state: present
regexp: '^.*sleep 1$'
line: ' sleep 10'
tags:
- influxdb-systemd
- import_tasks: influxdb.yml
tags:
#- monitoring-server
- influxdb
- import_tasks: grafana.yml
tags:
- grafana