Skip to content

Commit

Permalink
Create configs for monitoring server (not ready yet, see TODO etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
janlelis committed Sep 10, 2023
1 parent 3230f2b commit 92a76b6
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 48 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ Please note: Replace <ENVIRONMENT> with either **production** or **staging** in

Requirements: jmespath (deployer host), unzip (target host)

### Grafana
Adjust inventory and config variables in `environments/monitoring/group_vars/monitoring/main.yml` before prodceeding.

- `ansible-galaxy install cloudalchemy.grafana`
- `ansible-playbook -i environments/monitoring/inventory.yml playbooks/install_grafana.yml`

### Prometheus
### Prometheus + Grafana + Alert Manager

- `ansible-galaxy install cloudalchemy.grafana`
- `ansible-galaxy install cloudalchemy.prometheus`
- `ansible-playbook -i environments/monitoring/inventory.yml playbooks/install_prometheus.yml`
- `ansible-galaxy install cloudalchemy.alertmanager`
- `ansible-playbook -i environments/monitoring/inventory.yml playbooks/install_monitoring.yml`
53 changes: 53 additions & 0 deletions environments/monitoring/group_vars/monitoring/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
domains:
prometheus: prometheus.palava.tv
grafana: grafana.palava.tv
alertmanager: alerts.palava.tv

### PROMETHEUS ###

prometheus_version: latest
prometheus_web_listen_address: "127.0.0.1:9090"
# TODO use
prometheus_web_external_url: "https://{{ domains.prometheus }}"
prometheus_storage_retention: 30d
prometheus_scrape_jobs:
- job_name: "signal-tower"
metrics_path: /metrics
basic_auth:
username: "TODO"
password: "TODOTODOTODO"
params:
module: [http_2xx]
static_configs:
- targets:
- machine.palava.tv

### GRAFANA ###

grafana_version: latest
grafana_address: 127.0.0.1
grafana_port: 7000
grafana_url: "https://{{ domains.grafana }}"
grafana_security:
admin_user: TODO
admin_password: "TODO"
grafana_datasources:
- name: prometheus
type: prometheus
url: "http://{{ prometheus_web_listen_address }}"
basicAuth: false
basicAuthUser: "TODO"
basicAuthPassword: "TODO"

### ALERTMANAGER ###

alertmanager_version: 0.23.0
alertmanager_web_listen_address: 127.0.0.1:9093
alertmanager_web_external_url: "https://{{ domains.alertmanager }}"
#alertmanager_receivers: TODO
alertmanager_route:
group_by: ["alertname", "cluster", "service"]
group_wait: 30s
group_interval: 5m
repeat_interval: 3h
receiver: slack
3 changes: 3 additions & 0 deletions environments/monitoring/inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
monitoring:
hosts:
128.140.124.42: null
23 changes: 0 additions & 23 deletions environments/production/group_vars/all/main.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
---

palava_signaltower_install_dir: /srv/signaltower-production
palava_signaltower_log_dir: /var/log/signaltower-production
palava_environment: production
# Used to configure the TURN server (turn role) to enable TURN in the signaltower role
# palava_signaltower_turn_secret: SOME_SECRET_KEY

palava_signaltower_autostart: yes

# Prometheus vars
prometheus_version: 2.22.0
prometheus_web_listen_address: '127.0.0.1:9090'
prometheus_scrape_jobs:
- job_name: 'signal-tower'
metrics_path: /metrics
params:
module: [http_2xx]
static_configs:
- targets:
- localhost:4233
# Grafana vars
grafana_security:
admin_user: admin
admin_password: "admin"
grafana_datasources:
- name: prometheus
type: prometheus
access: proxy
url: 'http://{{ prometheus_web_listen_address }}'
basicAuth: false
2 changes: 0 additions & 2 deletions environments/production/inventory.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---

all:
hosts:
157.90.226.126: null
1 change: 0 additions & 1 deletion environments/staging/group_vars/all/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

palava_signaltower_install_dir: /srv/signaltower-staging
palava_signaltower_log_dir: /var/log/signaltower-staging
palava_environment: staging
Expand Down
2 changes: 0 additions & 2 deletions environments/staging/inventory.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---

all:
hosts:
157.90.226.126: null
7 changes: 0 additions & 7 deletions playbooks/install_grafana.yml

This file was deleted.

11 changes: 11 additions & 0 deletions playbooks/install_monitoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- hosts: monitoring
strategy: debug
remote_user: root
become: yes
roles:
- include_role:
name: common
tasks_from: monitoring.yml
- cloudalchemy.prometheus
- cloudalchemy.grafana
- cloudalchemy.alertmanager
7 changes: 0 additions & 7 deletions playbooks/install_prometheus.yml

This file was deleted.

4 changes: 4 additions & 0 deletions roles/common/tasks/monitoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- include: upgrade.yml
- include: packages-monitoring.yml
- include: ssh.yml
18 changes: 18 additions & 0 deletions roles/common/tasks/packages-monitoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- name: Install common packages (monitoring)
apt:
name:
- apt-transport-https
- apache2-utils
- fail2ban
- nginx
- unattended-upgrades
- vim
state: present

- name: Make sure some packages are not installed
apt:
name:
- apache2
- cups
- telnet
state: absent

0 comments on commit 92a76b6

Please sign in to comment.