refactor(auth): remove Authentik SSO, restore basic auth and provision Node Exporter dashboard
ansible-core-mon / deploy (push) Successful in 25s
ansible-core-net / deploy (push) Failing after 25s
ansible-core-secrets / deploy (push) Successful in 12s
ansible-opnsense / deploy (push) Successful in 5s
ansible-rus-central / deploy (push) Successful in 37s
ansible-core-mon / deploy (push) Successful in 25s
ansible-core-net / deploy (push) Failing after 25s
ansible-core-secrets / deploy (push) Successful in 12s
ansible-opnsense / deploy (push) Successful in 5s
ansible-rus-central / deploy (push) Successful in 37s
This commit is contained in:
1 parent
94a143623b
commit
c0a9d7f0c8
16 files changed
+15726
-263
No files matched your search
@@ -1,10 +1,4 @@
|
||||
---
|
||||
- name: Проверить наличие секрета Grafana OAuth
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- grafana_oauth_client_secret is defined and grafana_oauth_client_secret | length > 0
|
||||
fail_msg: "Секрет GRAFANA_OAUTH_CLIENT_SECRET не передан!"
|
||||
|
||||
- name: Создать базовые каталоги мониторинга
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
@@ -22,6 +16,7 @@
|
||||
- { path: "{{ monitoring_dir }}/grafana_data", owner: "472", group: "472", mode: "0755" }
|
||||
- { path: "{{ monitoring_dir }}/grafana/provisioning", owner: "root", group: "root", mode: "0755" }
|
||||
- { path: "{{ monitoring_dir }}/grafana/provisioning/datasources", owner: "root", group: "root", mode: "0755" }
|
||||
- { path: "{{ monitoring_dir }}/grafana/provisioning/dashboards", owner: "root", group: "root", mode: "0755" }
|
||||
- { path: "{{ monitoring_dir }}/ntfy_data", owner: "root", group: "root", mode: "0777" }
|
||||
|
||||
- name: Установить конфигурацию Prometheus
|
||||
@@ -56,6 +51,22 @@
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Установить провайдер дашбордов Grafana
|
||||
ansible.builtin.template:
|
||||
src: grafana-dashboards.yml.j2
|
||||
dest: "{{ monitoring_dir }}/grafana/provisioning/dashboards/dashboards.yml"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Скопировать статические дашборды Grafana
|
||||
ansible.builtin.copy:
|
||||
src: dashboards/
|
||||
dest: "{{ monitoring_dir }}/grafana/provisioning/dashboards/"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Установить compose.yaml для стека мониторинга
|
||||
ansible.builtin.template:
|
||||
src: compose.yaml.j2
|
||||
@@ -69,6 +80,32 @@
|
||||
register: compose_up
|
||||
changed_when: "'Started' in compose_up.stderr or 'Created' in compose_up.stderr or 'Recreated' in compose_up.stderr or 'Pulled' in compose_up.stderr"
|
||||
|
||||
- name: Дождаться готовности Ntfy
|
||||
ansible.builtin.uri:
|
||||
url: "http://127.0.0.1:80/v1/health"
|
||||
status_code: 200
|
||||
register: ntfy_health
|
||||
retries: 15
|
||||
delay: 2
|
||||
until: ntfy_health.status == 200
|
||||
|
||||
- name: Создать или обновить пользователя администратора в Ntfy
|
||||
ansible.builtin.command: >
|
||||
docker exec -i -e NTFY_PASSWORD="{{ ntfy_admin_password }}"
|
||||
monitoring-ntfy ntfy user add --role=admin --ignore-exists "{{ ntfy_admin_user }}"
|
||||
register: ntfy_user_add
|
||||
changed_when: "'added' in ntfy_user_add.stdout or 'added' in ntfy_user_add.stderr"
|
||||
failed_when: false
|
||||
no_log: true
|
||||
|
||||
- name: Обновить пароль администратора в Ntfy
|
||||
ansible.builtin.command: >
|
||||
docker exec -i -e NTFY_PASSWORD="{{ ntfy_admin_password }}"
|
||||
monitoring-ntfy ntfy user change-pass "{{ ntfy_admin_user }}"
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
no_log: true
|
||||
|
||||
- name: Дождаться готовности Grafana
|
||||
ansible.builtin.uri:
|
||||
url: "http://127.0.0.1:3000/api/health"
|
||||
@@ -78,11 +115,16 @@
|
||||
delay: 2
|
||||
until: grafana_health.status == 200
|
||||
|
||||
- name: Обеспечить имя и email администратора в базе Grafana
|
||||
ansible.builtin.command: >
|
||||
python3 -c "import sqlite3; conn = sqlite3.connect('{{ monitoring_dir }}/grafana_data/grafana.db'); conn.execute('UPDATE user SET login=\"{{ grafana_admin_user }}\", email=\"{{ grafana_admin_email }}\" WHERE id=1'); conn.commit()"
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: Синхронизировать пароль администратора Grafana с Infisical
|
||||
ansible.builtin.command:
|
||||
cmd: docker exec -i monitoring-grafana grafana cli admin reset-admin-password --password-from-stdin
|
||||
cmd: docker exec -i monitoring-grafana grafana cli admin reset-admin-password --user-id 1 --password-from-stdin
|
||||
stdin: "{{ grafana_admin_password }}"
|
||||
no_log: true
|
||||
changed_when: false
|
||||
when: grafana_admin_password is defined and grafana_admin_password | length > 0
|
||||
|
||||
Reference in new issue
Block a user