miniupdate is a Python tool for automated system update management across multiple hosts with Proxmox VE integration. It:
- SSHs to hosts from Ansible inventory files
- Detects OS and package managers automatically
- Checks for and applies system updates
- Creates Proxmox VM snapshots before updates
- Sends comprehensive email reports via SMTP
- config.py: TOML-based configuration management. Config files can be in current directory or
~/.miniupdate/ - inventory.py: Ansible inventory parser (YAML/INI formats) with support for external git repositories
- ssh_manager.py: SSH connection handling via paramiko
- os_detector.py: Multi-OS detection (Ubuntu, Debian, CentOS, RHEL, Fedora, openSUSE, Arch, Alpine, FreeBSD, macOS)
- package_managers.py: Package manager abstraction layer for apt, yum, dnf, zypper, pacman, apk, pkg, brew
- host_checker.py: Orchestrates update checking across hosts
- update_automator.py: Automated update workflow with snapshots and rollback
- proxmox_client.py: Proxmox VE API integration for VM snapshots
- email_sender.py: HTML/text email report generation and sending
- vm_mapping.py: Maps inventory hostnames to Proxmox VM IDs
- main.py: CLI interface using Click
- Check workflow: Read-only update checking and email reporting
- Update workflow: Automated updates with Proxmox snapshots, reboot handling, and rollback on failure
- Init workflow: Creates example configuration files
- Python Version: 3.7+ (see setup.py for compatibility matrix)
- Style: Follow PEP 8 conventions
- Docstrings: Use triple-quoted strings for functions and classes
- Type Hints: Use typing module annotations where beneficial
- Error Handling: Use try/except with informative error messages
Core dependencies (requirements.txt):
paramiko>=3.0.0- SSH connectionsPyYAML>=6.0- Ansible inventory parsingtoml>=0.10.2- Configuration filesclick>=8.0.0- CLI frameworkrequests>=2.25.0- HTTP requests for Proxmox API
- Use Python's
loggingmodule - Log to both console (stdout) and file (
miniupdate.log) - Default level: INFO, configurable via config
- Format:
%(asctime)s - %(name)s - %(levelname)s - %(message)s
[email]
smtp_server = "smtp.gmail.com"
smtp_port = 587
use_tls = true
username = "your-email@example.com"
password = "your-app-password"
from_email = "your-email@example.com"
to_email = ["admin@example.com"]
[inventory]
path = "inventory.yml" # Supports: relative paths, absolute paths, ~/home paths, $ENV_VAR expansion
format = "ansible"
[ssh]
timeout = 30
key_file = null
username = null
port = 22
[settings]
parallel_connections = 5
log_level = "INFO"
check_timeout = 120
[proxmox]
endpoint = "https://pve.example.com:8006"
username = "root@pam"
password = "your-proxmox-password"
verify_ssl = true
timeout = 30
vm_mapping_file = "vm_mapping.toml"
[updates]
apply_updates = true
reboot_after_updates = true
reboot_timeout = 300
ping_timeout = 120
ping_interval = 5
snapshot_name_prefix = "pre-update"
cleanup_snapshots = true
snapshot_retention_days = 7
opt_out_hosts = [] # Hosts to exclude from automated updatesSupports standard Ansible inventory with hosts and groups. Can be stored in external git repositories.
Maps inventory hostnames to Proxmox node/VM ID pairs:
[mapping]
"web-server-01" = { node = "pve1", vmid = 100 }Config class supports multiple path patterns:
- Relative paths (relative to config file location)
- Absolute paths (
/etc/ansible/inventory.yml) - Home directory expansion (
~/git/infrastructure/inventory.yml) - Environment variable expansion (
$ANSIBLE_INVENTORY_PATH/inventory.yml)
- Gracefully handle SSH connection failures
- Continue processing other hosts on individual failures
- Log errors but don't crash the entire process
- Include error details in email reports
- Use ThreadPoolExecutor for concurrent host operations
- Default: 5 parallel connections (configurable)
- Timeout-based termination for hung operations
# Create example configuration files
miniupdate init
# Check for updates (read-only)
miniupdate check [--dry-run] [-c config.toml] [-v]
# Apply automated updates with snapshots
miniupdate update [--dry-run] [-c config.toml] [-v]
# Test configuration
miniupdate test-config [-c config.toml]- No formal test suite currently exists
- Manual testing recommended:
- Create config files with
miniupdate init - Use
--dry-runflag for safe testing - Verify email reports are generated correctly
- Test SSH connectivity with
test-configcommand
- Create config files with
- Install in development mode:
pip install -e . - Create test configuration in a separate directory
- Use
--dry-runextensively during development - Check logs in
miniupdate.logfor debugging - Test email functionality separately before production use
- Security: Never commit actual config.toml with credentials
- Proxmox Integration: VM snapshots require valid Proxmox credentials and VM mapping
- SSH Keys: Prefer SSH key authentication over passwords
- Email: Use app-specific passwords for Gmail/modern SMTP servers
- Opt-out hosts: Hosts in
opt_out_hostslist are checked but never updated automatically - Unmapped hosts: Hosts without VM mapping and not in opt-out list will trigger warnings
- Add detection logic to
os_detector.py - Implement package manager interface in
package_managers.py - Test with actual system or VM
- Update README.md with new OS in features list
- Add to example config in
config.py:create_example_config() - Add property to Config class
- Update README.md configuration section
- Handle backward compatibility for existing configs
- Update templates in
email_sender.py - Maintain both HTML and plain text versions
- Test rendering with various update scenarios
- Ensure MIME multipart structure is preserved
- Use
proxmox_client.pyfor all API interactions - Handle API errors gracefully (connection, auth, operations)
- Verify snapshot operations before updating
- Implement proper cleanup for failed operations