Files
ansible-config/test_vault_simple.py
Freazzzing 30d35bc401 Initial commit: Ansible configuration for monitoring stack
Contains:
- Production inventory (inventories/production/hosts)
- VictoriaMetrics installation (playbooks/monitoring/install_victoriametrics.yml)
- Vault setup and secrets management (playbooks/vault/)
- Base system configuration (playbooks/infrastructure/)
- Directory structure for monitoring components
2026-02-02 11:22:24 +00:00

32 lines
983 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
import subprocess
import json
import os
# Получаем переменные окружения
vault_addr = os.environ.get('VAULT_ADDR')
vault_token = os.environ.get('VAULT_TOKEN')
if not vault_addr or not vault_token:
print("Ошибка: Не установлены переменные VAULT_ADDR или VAULT_TOKEN")
exit(1)
# Проверяем через curl (простой способ)
cmd = [
'curl', '-s',
'-H', f'X-Vault-Token: {vault_token}',
f'{vault_addr}/v1/secret/data/Forgeo'
]
try:
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode == 0:
data = json.loads(result.stdout)
print("Успешное подключение к Vault!")
print(f"URL: {data['data']['data']['url']}")
print(f"User: {data['data']['data']['user']}")
else:
print(f"Ошибка curl: {result.stderr}")
except Exception as e:
print(f"Ошибка: {e}")