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:
22
test_vault.py
Normal file
22
test_vault.py
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
import hvac
|
||||
import os
|
||||
|
||||
# Подключение к Vault
|
||||
client = hvac.Client(
|
||||
url=os.environ.get('VAULT_ADDR'),
|
||||
token=os.environ.get('VAULT_TOKEN')
|
||||
)
|
||||
|
||||
# Проверка подключения
|
||||
print(f"Vault is authenticated: {client.is_authenticated()}")
|
||||
print(f"Vault seal status: {client.sys.is_sealed()}")
|
||||
|
||||
# Чтение секрета
|
||||
try:
|
||||
secret = client.secrets.kv.v2.read_secret_version(path='Forgeo')
|
||||
print("\nSecret data:")
|
||||
print(f"URL: {secret['data']['data']['url']}")
|
||||
print(f"User: {secret['data']['data']['user']}")
|
||||
except Exception as e:
|
||||
print(f"Error reading secret: {e}")
|
||||
Reference in New Issue
Block a user