-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# nginx-proxy | ||
__Tags - `grafana`__ | ||
|
||
Deploys grafana | ||
|
||
### Usage | ||
```yaml | ||
- alesharik.baseinfra.grafana | ||
``` | ||
```yaml | ||
grafana: | ||
host: mon.example.com | ||
admin_password: password | ||
``` | ||
### Vars | ||
```yaml | ||
grafana: | ||
image: grafana/grafana-oss | ||
version: 11.1.0 | ||
``` | ||
### Effects | ||
- creates and manages `{{ dir.ansible }}/grafana` | ||
- creates `{{ dir.data }}/grafana` | ||
- deploys docker compose project `grafana` | ||
|
||
#### Docker networks | ||
- connect to `nginx-proxy` | ||
|
||
### Networking | ||
- exposes 80 port through `nginx-proxy` with host specified in config | ||
- connects to network `nginx-proxy` | ||
|
||
### Handlers | ||
- `restart grafana` - restarts registry | ||
|
||
### Dependencies | ||
- `bootstrap` | ||
- `docker` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
grafana: | ||
image: grafana/grafana-oss | ||
version: 11.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: restart grafana | ||
community.docker.docker_compose_v2: | ||
project_src: "{{ dir.ansible }}/grafana" | ||
state: restarted | ||
tags: grafana |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
dependencies: | ||
- role: alesharik.baseinfra.bootstrap | ||
- role: alesharik.baseinfra.docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
- name: Create compose dir | ||
ansible.builtin.file: | ||
path: "{{ dir.ansible }}/grafana" | ||
state: directory | ||
mode: 0755 | ||
tags: grafana | ||
- name: Create data dir | ||
ansible.builtin.file: | ||
path: "{{ dir.data }}/grafana" | ||
state: directory | ||
mode: 0755 | ||
owner: '472' | ||
tags: grafana | ||
|
||
- name: Move compose files | ||
ansible.builtin.template: | ||
src: docker-compose.yml | ||
dest: "{{ dir.ansible }}/grafana/docker-compose.yml" | ||
mode: 0755 | ||
tags: grafana | ||
notify: | ||
- restart grafana | ||
- name: Move admin password | ||
ansible.builtin.template: | ||
src: admin_password.txt | ||
dest: "{{ dir.ansible }}/grafana/admin_password.txt" | ||
mode: 0755 | ||
tags: grafana | ||
notify: | ||
- restart grafana | ||
|
||
- name: Start grafana | ||
tags: grafana | ||
community.docker.docker_compose_v2: | ||
project_src: "{{ dir.ansible }}/grafana" | ||
state: present | ||
|
||
- name: Make sure handlers are flushed immediately | ||
ansible.builtin.meta: flush_handlers | ||
tags: grafana |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ grafana.admin_password }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: '3.9' | ||
networks: | ||
proxy: | ||
external: | ||
name: nginx-proxy | ||
services: | ||
grafana: | ||
image: "{{ grafana.image }}:{{ grafana.version }}" | ||
restart: always | ||
environment: | ||
VIRTUAL_HOST: "{{ grafana.host }}" | ||
VIRTUAL_PORT: 3000 | ||
LETSENCRYPT_HOST: "{{ grafana.host }}" | ||
GF_SECURITY_ADMIN_PASSWORD__FILE: "/run/secrets/admin_password" | ||
volumes: | ||
- "{{ dir.data }}/grafana:/var/lib/grafana" | ||
secrets: | ||
- admin_password | ||
networks: | ||
- proxy | ||
secrets: | ||
admin_password: | ||
file: admin_password.txt |