-
Notifications
You must be signed in to change notification settings - Fork 96
/
grafana.yml
134 lines (130 loc) · 4.12 KB
/
grafana.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
- name: Grafana
hosts: grafana
vars_files:
- secret_group_vars/all.yml
pre_tasks:
#- name: Put SELinux in permissive mode, logging actions that would be blocked.
# # Putting SELinux in permissive mode should not be necessary. But if
# # certs fail, then do it. It is supposed to be properly handled by
# # the `galaxyproject.nginx` role, but the permission change is likely
# # only applied if a change is detected since it can't figure out if
# # the rule is there or not.
# # TODO: make the nginx task check if the rule is in place, rather than a change in path.
# become: true
# ansible.posix.selinux:
# policy: targeted
# state: permissive
- name: Install Dependencies
become: true
ansible.builtin.package:
name: ["python3-virtualenv", "python3-docker", "python3-pip"]
- name: Install docker compose python (no rpm available)
ansible.builtin.pip:
name: docker-compose
version: 1.29.2
- name: Ensure git is installed. (hxr.monitor-ssl)
become: true
ansible.builtin.package:
name:
- git
- name: Create data dir
ansible.builtin.file:
state: directory
path: /data
become: true
- name: Create FS
community.general.filesystem:
fstype: xfs
dev: /dev/vdb
become: true
- name: Mount data volume
ansible.posix.mount:
path: /data
src: /dev/vdb
fstype: xfs
state: mounted
become: true
collections:
- devsec.hardening
- grafana.grafana
roles:
## Starting configuration of the operating system
- role: usegalaxy_eu.firewall
become: true
- role: geerlingguy.repo-epel # Install EPEL repository
become: true
- role: usegalaxy_eu.handy.os_setup
become: true
vars:
hostname: "{{ grafana_domain }}"
enable_hostname: true
enable_powertools: true # geerlingguy.repo-epel role doesn't enable PowerTools repository
- role: usegalaxy-eu.autoupdates # keep all of our packages up to date
become: true
vars:
hostname: "{{ grafana_domain }}"
- influxdata.chrony # Keep our time in sync.
## Monitoring
- dj-wasabi.telegraf
- role: hxr.monitor-ssl
become: true
- role: hxr.monitor-email
become: true
## Grafana
- role: galaxyproject.nginx
become: true
vars:
hostname: "{{ grafana_domain }}"
- grafana
- role: pgs
become: true
- role: geerlingguy.docker
become: true
vars:
docker_install_compose: true
docker_users:
- "{{ ansible_ssh_user }}"
post_tasks:
- name: Open nginx ports
become: true
ansible.posix.firewalld:
port: "{{ item }}"
permanent: true
state: enabled
with_items:
- 80/tcp
- 443/tcp
- name: Add on-call backend
when: grafana_on_call
block:
- name: Create dir
ansible.builtin.file:
path: "{{ grafana_on_call_path }}"
state: directory
owner: "{{ ansible_ssh_user }}"
group: "{{ ansible_ssh_user }}"
mode: "0755"
become: true
- name: Get docker compose
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/grafana/oncall/49d20f1a7e40669e901db95443603138e1a1cde4/docker-compose.yml
dest: "{{ grafana_on_call_path }}/docker-compose.yml"
owner: "{{ ansible_ssh_user }}"
group: "{{ ansible_ssh_user }}"
mode: "0600"
- name: Create env
ansible.builtin.copy:
content: |
DOMAIN=https://{{ grafana_on_call_domain }}
SECRET_KEY={{ grafana_on_call_secret }}
COMPOSE_PROFILES=''
dest: "{{ grafana_on_call_path }}/.env"
owner: "{{ ansible_ssh_user }}"
group: "{{ ansible_ssh_user }}"
mode: "0600"
no_log: true
- name: Start OnCall
community.docker.docker_compose_v2:
project_src: "{{ grafana_on_call_path }}"
project_name: oncall