Skip to content

Commit

Permalink
feat: loki
Browse files Browse the repository at this point in the history
  • Loading branch information
janikvonrotz committed Jan 29, 2025
1 parent 0dc63aa commit e7498fe
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions plays/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
tags: prometheus
- role: promtail
tags: promtail
- role: loki
tags: loki
- role: grafana
tags: grafana
- role: restic_server
Expand Down
2 changes: 1 addition & 1 deletion roles/loki/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Configure the role.

```yml
# https://hub.docker.com/r/grafana/loki/
loki_image: grafana/loki:2.3.0
loki_image: grafana/loki
loki_hostname: loki01
loki_description: log index for grafana # default: Loki
loki_nginx_data_dir: /usr/share/nginx/proxies # default: "{{ nginx_data_dir }}/proxies"
Expand Down
2 changes: 1 addition & 1 deletion roles/mysqld_exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Configure the role.

```yml
# https://hub.docker.com/r/prom/mysqld-exporter/
mysqld_exporter_image: prom/mysqld-exporter:v0.15.1
mysqld_exporter_image: prom/mysqld-exporter:v0.16.0
mysqld_exporter_hostname: myexport01
mysqld_exporter_description: Database metric for mysql01 # default: "MySQL Exporter {{ mysqld_exporter_server }}"
mysqld_exporter_data_dir: /usr/share/myexport # default: "/usr/share/{{ mysqld_exporter_hostname }}"
Expand Down
11 changes: 11 additions & 0 deletions roles/prometheus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,14 @@ Select multiple inventories when deploying.
```bash
ansible-playbook -i inventories/odoo -i inventories/nextcloud -i inventories/setup plays/setup.yml -l prometheus -t prometheus
```

### Clear Prometheus data

Remove container and volume.

```bash
docker rm -f prom01
docker volume rm prom01
```

Then redeploy.
8 changes: 5 additions & 3 deletions task
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function help() {
echo "|$(printf '%*s' $((cmd_width + 2)) '' | tr ' ' '-')|$(printf '%*s' $((opt_width + 2)) '' | tr ' ' '-')|$(printf '%*s' $((desc_width + 2)) '' | tr ' ' '-')|"
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "generate-vault-password" "[vault_id] [password]" "Generate a password file for Ansible vault."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "convert-vault-file" "[vault_id] [path]" "Re-encrypt vault file as single strings."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "encrypt-string" "[vault_id] [key:value]" "Generate encrypted string with Ansible Vault."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "encrypt-string" "[vault_id] [key:value] -q" "Generate encrypted string with Ansible Vault."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "install" "" "Install Ansible and dependencies with uv."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "install-exo" "" "Install Exoscale CLI."
printf "| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n" "upgrade" "" "Upgrade Ansible and dependencies with uv."
Expand Down Expand Up @@ -63,8 +63,10 @@ function encrypt-string() {
STRING_KEY=$(echo "$2" | cut -d ':' -f 1)
STRING_VALUE=$(echo "$2" | cut -d ':' -f 2 | sed 's/^ *//')

echo "Found key: $STRING_KEY"
echo "Encrypting value: $STRING_VALUE"
if [ "$3" != "-q" ]; then
echo "Found key: $STRING_KEY"
echo "Encrypting value: $STRING_VALUE"
fi
ansible-vault encrypt_string --encrypt-vault-id="$1" --name "$STRING_KEY" "$STRING_VALUE"
}

Expand Down

0 comments on commit e7498fe

Please sign in to comment.