- Added main script (main.py) for syncing IPs between NSX managers. - Implemented logging setup and YAML configuration loading. - Created NSXClient for interacting with NSX Policy API. - Developed SyncEngine for comparing and syncing IPs. - Added interactive group selection feature. - Implemented data export functionality for JSON and CSV formats. - Created requirements.txt for dependencies. - Added __init__.py for package versioning. - Included error handling and validation for configuration.
55 lines
2.4 KiB
YAML
55 lines
2.4 KiB
YAML
# NSX Security Group IP Sync – Example Configuration
|
||
# Copy this file to config.yaml and fill in your values.
|
||
# Passwords can be supplied via environment variables using ${VAR_NAME} syntax.
|
||
# CLI flags always take precedence over values in this file.
|
||
|
||
# ---------------------------------------------------------------------------
|
||
# Source NSX Manager (source of truth)
|
||
# ---------------------------------------------------------------------------
|
||
source:
|
||
host: nsx-source.example.com # Hostname or IP of the source NSX manager
|
||
username: admin
|
||
password: "${NSX_SOURCE_PASSWORD}" # Or paste password directly (not recommended)
|
||
verify_ssl: true # Set to false for self-signed certificates
|
||
domain: default # Policy domain – almost always 'default'
|
||
|
||
# ---------------------------------------------------------------------------
|
||
# Target NSX Manager (will be updated to match source)
|
||
# ---------------------------------------------------------------------------
|
||
target:
|
||
host: nsx-target.example.com
|
||
username: admin
|
||
password: "${NSX_TARGET_PASSWORD}"
|
||
verify_ssl: true
|
||
domain: default
|
||
|
||
# ---------------------------------------------------------------------------
|
||
# Security Groups to sync (display_name or group ID)
|
||
# These must exist on both source and target managers.
|
||
# The script will add/remove static IP entries on the TARGET to match the
|
||
# computed effective IP membership on the SOURCE.
|
||
# ---------------------------------------------------------------------------
|
||
groups:
|
||
- Security-Group-A
|
||
- Security-Group-B
|
||
- win-svr-web-group
|
||
- win-svr-app-group
|
||
|
||
# ---------------------------------------------------------------------------
|
||
# Behaviour options (all overridable with CLI flags)
|
||
# ---------------------------------------------------------------------------
|
||
options:
|
||
whatif: false # true = show changes without applying them (--whatif)
|
||
silent: false # true = suppress console output, useful for automation
|
||
debug: false # true = verbose API request/response logging
|
||
log_file: logs/sync.log # Set to null/empty to disable file logging
|
||
workers: 4 # Concurrent API threads (source+target fetched in parallel)
|
||
|
||
# Export: generate JSON/CSV snapshots of source, target, and diff
|
||
# Values: json | csv | both | null (disabled)
|
||
export: null
|
||
export_dir: exports
|
||
|
||
# interactive: launch group selection TUI on startup (nice-to-have, low priority)
|
||
interactive: false
|