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
23 lines
641 B
Python
23 lines
641 B
Python
#!/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}")
|