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
This commit is contained in:
31
test_vault_simple.py
Normal file
31
test_vault_simple.py
Normal file
@ -0,0 +1,31 @@
|
||||
#!/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}")
|
||||
Reference in New Issue
Block a user