2026-02-05 11:37:29 +01:00
# LoopAware Infrastructure CLI
2026-02-05 19:06:07 +01:00
A professional Python-based CLI for programmatically managing the LoopAware flat network (`10.32.0.0/16` ).
2026-02-05 11:37:29 +01:00
## Features
2026-02-05 19:06:07 +01:00
- **DNS/DHCP:** Manage `dnsmasq` reservations and records on `la-dnsmasq-01` .
- **Ingress:** Dynamic HAProxy routing for subdomains.
- **Router:** Manage OpenWrt firewall DNAT rules (TCP/UDP).
- **Proxmox:** Provision and manage LXC containers across physical nodes (`vmh-07` to `vmh-13` ).
- **Samba:** Automated User and Group management for Active Directory.
2026-02-05 11:37:29 +01:00
## Installation
```bash
cd external/dynamic-infra-tooling
pip install -e .
```
## Configuration
2026-02-05 19:06:07 +01:00
The CLI requires a `config.yaml` file. A template is provided in `config.yaml.example` .
2026-02-05 11:37:29 +01:00
```bash
cp config.yaml.example config.yaml
2026-02-05 19:06:07 +01:00
# Update the nodes, IPs, and SSH key paths
2026-02-05 11:37:29 +01:00
```
2026-02-05 19:06:07 +01:00
### Environment Variables
- `ROUTER_PASS` : Required for router operations (if SSH keys are not deployed).
- `INFRA_CONFIG` : Optional path to a custom config file.
2026-02-05 11:37:29 +01:00
2026-02-05 19:06:07 +01:00
## Usage Guide
2026-02-05 11:37:29 +01:00
2026-02-05 19:06:07 +01:00
### 1. Identity & Access (Samba)
2026-02-05 11:37:29 +01:00
```bash
2026-02-05 19:06:07 +01:00
# List all users
infra samba list-users
2026-02-05 11:37:29 +01:00
2026-02-05 19:06:07 +01:00
# Create a new user
infra samba add-user "jdoe" "SecurePass123!"
2026-02-05 11:37:29 +01:00
2026-02-05 19:06:07 +01:00
# Grant XMPP access
infra samba add-to-group "xmpp-users" "jdoe"
2026-02-05 11:37:29 +01:00
```
2026-02-05 19:06:07 +01:00
### 2. Compute (Proxmox)
```bash
# List containers on a specific node
infra proxmox list-lxcs --node la-vmh-12
# Create a new container
infra proxmox create-lxc 12150 local:vztmpl/debian-13-standard "new-app" "10.32.70.100/16" "10.32.0.1" --node la-vmh-12
```
2026-02-05 11:37:29 +01:00
2026-02-05 19:24:04 +01:00
### 3. Networking (IP, DNS & DHCP)
2026-02-05 19:29:22 +01:00
Assign a static identity to your new machine. The CLI helps you find free addresses in the dedicated agent pool (`10.32.70.0/16` through `10.32.80.0/16` ).
2026-02-05 19:24:04 +01:00
2026-02-05 11:37:29 +01:00
```bash
2026-02-05 19:24:04 +01:00
# Find the next available IP for your project
infra ip next-free
2026-02-05 19:06:07 +01:00
2026-02-05 19:24:04 +01:00
# List top 5 available IPs
infra ip list-free --count 5
# Register the machine in DHCP
infra dns add-host "aa:bb:cc:dd:ee:ff" "10.32.70.100" "new-app"
2026-02-05 11:37:29 +01:00
```
2026-02-05 19:06:07 +01:00
2026-02-05 19:17:54 +01:00
### 4. Cloudflare DDNS
The list of domains to update is managed dynamically on the server.
2026-02-05 19:06:07 +01:00
```bash
2026-02-05 19:17:54 +01:00
# Add a domain to the update list
infra cloudflare add-ddns "my-new-domain.com"
# List all domains being updated
infra cloudflare list-ddns
# Run the update (usually via cron)
infra cloudflare update-ddns
2026-02-05 19:06:07 +01:00
```
## Advanced Workflows for AI Agents
For detailed automation workflows, see [Workflow Documentation ](../../docs/guides/dynamic-infrastructure-workflow.md ).
## Development and Testing
Run the integration test suite:
```bash
export ROUTER_PASS="..."
pytest tests/test_cli.py -s
```