Commit Graph

52 Commits

Author SHA1 Message Date
chrisfu
d2295f4c2b ansible: add K3s datastore export/import, improve iSCSI handling, and migrate merlin to MariaDB primary
- Added tasks and playbooks for K3s datastore export/import using MariaDB Tools role, with associated tests and defaults.
- Enhanced iSCSI role to support mkfs-once logic and safer re-initialization of block storage.
- Migrated iSCSI-backed Rancher data from retropie to merlin.prole.org.
- Updated k3s roles/playbooks to relax Rancher storage preflight checks, supporting PARTUUID-based mounts.
- Adjusted Samba AD NetBIOS name derivation to use uppercase short hostname by default.
- Incremented prole DB version to 104, updated generated prole.cfg, inventory, and recovery manifest templates.
2026-03-06 14:25:13 -08:00
chrisfu
cf6d79f505 ansible: fix netplan_static YAML, dashboard conky pkg, mariadb vault vars
- netplan_static: avoid Jinja whitespace/indent YAML breakage with trim_blocks; set /etc/netplan perms to 0600; add render+YAML-parse test

- dashboard: install concrete conky provider (conky-all) and add defaults test; wire role into site.yml; document dashboard service usage

- mariadb: add mariadb parent group for group_vars scope; add group defaults deriving datastore password from vault; add vault entry; add vars resolution test; remove host overrides

- misc: update port-forward mappings, generated prole.cfg, and bump prole-db version

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-05 23:02:42 -08:00
chrisfu
78a16f47e2 ansible: add merlin k3s host + USB-backed MariaDB bring-up
- Add merlin.prole.org (10.0.0.6) to inventory (k3s_hosts, mariadb_primary)

- Relax k3s preflight: /var/lib/rancher no longer requires iSCSI, only blocks SD-backed storage

- Add netplan static IP role (NetworkManager) and MariaDB primary/replica roles + site.yml ordering

- Add/upgrade USB prep tooling (prepare_mariadb_usb.sh + generated setup.sh + fstab-by-LABEL)

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-05 19:17:40 -08:00
chrisfu
a43aed7134 k3s: eliminate localhost registry + dedupe common-core
- Ensure k3s mode uses the k3s registry endpoint and avoid localhost/k3d image prefixes.

- Make ArgoCD repo-server cmp symlink creation idempotent.

- Normalize common-core provisioning to knoe-system and add repair-time dedupe of stray default-namespace installs.

- Add k3s MariaDB datastore/refresh playbooks and regression tests.
2026-03-05 14:31:33 -08:00
chrisfu
60820b2b7c Checkpoint: ArgoCD IO load distribution and K3s configuration updates
ArgoCD IO load distribution: Updated k8s/argocd/install.yaml to use hostPath volumes for application-controller (/prole/d001), redis (/prole/d002), and repo-server (/prole/d003). Updated Ansible configure task to create hostPath directories on myrddin.prole.org.

K3s configuration and testing: Added test playbooks for kubeconfig rewriting and argument validation. Updated K3s install, configure, and image import tasks. Configured required mounts and host-specific variables for myrddin.prole.org.

Miscellaneous: Updated conf/prole.cfg with K3S_TOKEN. Bumped prole-db version and updated recovery manifest templates. Minor UI adjustments in cluster screen.
Co-authored-by: Junie <junie@jetbrains.com>
2026-03-04 12:23:15 -08:00
chrisfu
9af1f5c5c6 refactor(k3s, cnpg): improve CNPG operator management and Ansible role robustness
* CNPG: Implement version pinning, automatic manifest URL derivation, and optional operator upgrades.

* CNPG: Add installation and management of the kubectl-cnpg plugin with architecture detection.

* k3s: Update etc/init_cloudnative_pg.sh to support configurable CNPG operator versions.

* Ansible: Enhance cgroups and k3s roles with improved check mode support and more robust variable defaults.

* Ansible: Improve kernel command-line path selection logic in the cgroups role.

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-03 23:20:34 -08:00
chrisfu
a40496f128 Implement real-time command executor for network scan: added run_streaming_cmd for unbuffered output, integrated with NetworkScreen UI, and added unit tests.
Co-authored-by: Junie <junie@jetbrains.com>
2026-02-28 17:58:58 -08:00
chrisfu
765aa0b926 Checkpoint: cluster env UI layout + k3s common services
- Tighten Cluster Environment screen layout; switch Service/Prod to kubectx context selection; keep namespace and key controls on one line; ensure Repair button remains reachable.

- Add UI layout regression test to render with large mock data and assert key widgets remain visible and console is scrollable.

- Make kubeconfig generation deterministic under tests by avoiding overwriting cert-based kubeconfigs; write token sidecar kubeconfig when needed.

- Update common-services init scripts and add k3s/Helm deployment bits (svc-check, Kong/CertMgr tasks).
2026-02-27 14:35:14 -08:00
chrisfu
26cac12759 feat(k3s): automate kubeconfig setup and deploy svc.prole.org check site
- Refactor k3s/kube_config.sh to fetch remote kubeconfig and configure local context.

- Add Ansible task svc_check.yml to deploy a status site via Kong and cert-manager.

- Include svc_check.yml in k3s role's main tasks.
2026-02-26 19:04:22 -08:00
chrisfu
6e2d3e9011 refactor: modernize installer and monitoring setup
- Monitoring: Migrated from manual Grafana/Prometheus manifests to kube-prometheus-stack based setup in etc/init_monitoring.sh. Removed old manifest files from deploy/ and k8s/.
- Installer Core: Refactored installer with new modules for actions, environment handling, and UI screens. Enhanced Milestone logic to support advanced configuration (ArgoCD, Registry namespaces, Kerberos flags, etc.).
- Service & Init Scripts: Updated multiple initialization scripts (init_*.sh) for better integration with OpenBao, Kerberos, and the new monitoring stack. Added new scripts for Nginx Ingress, Ollama parsing, and K3D route fixes.
- Infrastructure: Enhanced Samba AD DC Ansible role with realm derivation, provisioning guidance, and group management. Updated K3s role tasks.
- Configuration: Refined default settings in conf/ to align with the new deployment architecture.
- App & Tools: Updated prole-app Swift code and prole.sh for improved environment variable handling and installation flow.
2026-02-19 21:07:39 -08:00
chrisfu
57a7f12e7d k3s: Fix CloudNative-PG installation and improve Retropie networking
- Fixed YAML syntax and Python version parsing in CNPG operator tasks.
- Added automated detection of active network interface (eth0 vs wlan0) for Retropie and Pi nodes to ensure correct K3s configuration.
- Implemented persistent node taints for retropie.prole.org to exclude CloudNative-PG workloads.
- Added a rollout restart mechanism for cnpg-controller-manager to recover from scheduling on tainted or unstable nodes.
- Removed redundant kubectl-cnpg dependency from the Python installer as it is now managed by Ansible.
- Improved prole.sh to force color output for Ansible playbooks.
- Updated prole.cfg with active K3s token and CNPG version information.
2026-02-17 17:32:47 -08:00
chrisfu
f706c6ad9e k3s: Fix networking-related hangs on Retropie by using async network restart
- Split monolithic networking task into safer, discrete tasks

- Corrected connman blacklist: removed lo and wildcards, added cleanup logic

- Implemented async connman restart with wait_for_connection to prevent SSH hangs

- Improved routing fix with better checks and observability
2026-02-17 00:18:55 -08:00
chrisfu
fcf0c0ef0d k3s: Fix image pull failures on Retropie by blacklisting CNI interfaces in connman
- Prevent connmand from flapping routes by ignoring veth* and cni0 interfaces

- Ensure wlan0 maintains routing priority over eth0 on Retropie and Pi nodes

- Increase image pull retries and delay to improve resilience against transient network instability
2026-02-16 23:58:21 -08:00
chrisfu
ec8a4e98af k3s: Fix installation hangs, CA mismatches, and arm64 networking
- Implement proactive CA hash verification and automated repair for mismatches

- Ensure agents prioritize discovered server tokens over stale vault values

- Fix K3s service hangs with explicit stop and killall before reinstall

- Add Retropie/Pi networking fixes (WiFi power save, wlan0 priority)

- Pin pre-staged images to stable, architecture-aware versions (arm64)

- Remove obsolete init-port-forwards and prole.cfg sync tasks

- Update k8s manifests and installer core logic with new tests
2026-02-16 23:30:27 -08:00
chrisfu
3d29ab70f2 feat(k3s): enhance k3s install and factory reset reliability. Implement dynamic token discovery, serialized cluster setup with 'serial: 1', readiness checks, and image pre-staging for more robust cluster bootstrapping. 2026-02-16 15:04:04 -08:00
chrisfu
23cf4ac33d Configure K3s for retropie and add Traefik Ingress. Updated K3s templates for node-ip/flannel-iface, configured retropie host vars, enabled Traefik, added Ingress resources for Grafana, Prole, Kong, and Supabase, and set Postgres to LoadBalancer. 2026-02-16 04:28:40 -08:00
chrisfu
cad49cc0a6 Summary of recent repairs and infrastructure updates
Repairs and improvements:
- iSCSI: Added cleanup tasks to remove stale mounts and fstab entries. Improved robustness of iSCSI target management and added 'iscsi_absent_mounts' support.
- K3s:
    - Updated service start logic to accept 'activating' state, preventing premature failure during slow startups.
    - Improved service stop logic to safely handle missing or not-found services.
    - Ensured 'prole-installer' ServiceAccount and ClusterRoleBinding exist for K8s administration.
    - Added leader election and etcd tuning arguments (forgiving leases) to config.yaml.j2.
    - Removed deprecated 'prole-port-forwards' systemd service.
- Installer & Scripts:
    - Updated legacy_tk.py to support K3s mode, secret resolution for passwords, and better environment management (including ~/.prole/env.sh for service mode).
    - Updated init_ansible.sh to support PROLE_VAULT_PASS_FILE and ANSIBLE_VAULT_PASSWORD_FILE.
    - Improved directory and kubeconfig path resolution in prole_cfg.sh to support fallback to ~/.prole.
    - Enhanced Grafana password resolution in init_monitoring.sh.
    - Added automatic application of iSCSI StorageClass and PersistentVolumes in init_openbao.sh.
- General: Switched conf/prole.cfg to k3s deployment mode and updated vault_k3s.yml token.

New Ansible Tasks and Playbooks:
- infrastructure/playbooks/iscsi_cleanup.yml: Automates logout and removal of stale iSCSI node records.
- infrastructure/playbooks/prole_logs_migrate.yml: Orchestrates /prole/logs migration to iSCSI storage.
- infrastructure/playbooks/tmp_bao_dir.yml: Ensures host-level storage directories for OpenBao.
- infrastructure/playbooks/tmp_mount.yml: Utility to verify and enforce host-level mounts.
- infrastructure/playbooks/k3s_sync.yml: Added tasks to start K3s after sync and update local kubeconfig on the controller.
- Added 'Unmount stale iSCSI mounts' and 'Remove stale iSCSI fstab entries' to the iscsi role.
- Added 'Ensure prole-installer service account exists' to the k3s role.
2026-02-15 17:51:57 -08:00
chrisfu
f2c9012cce Refactor installation and initialization logic, and expand test coverage
- install.py: Major update including configuration variable expansion, improved k3s/k3d handling, and enhanced installation logic.

- etc/ scripts: Significant refactoring of initialization scripts (Kerberos, Port Forwards, Garage Store, etc.).

- Port Forwards: Transitioned from XML to port-mappings.conf for managing kubectl port-forwards.

- Status Reporting: Improved status checking for common services.

- Infrastructure: Updated Ansible inventory and rsyslog role configurations.

- Tests: Added a comprehensive suite of tests for 'etc' initialization scripts in prole/tests/etc/.

- Documentation: Added prole-db-documentation-mcp-architecture.md.

- General: Updated Dockerfiles and various helper scripts.
2026-02-13 21:36:39 -08:00
chrisfu
e228dd9243 checkpoint: installer refinements, k3s drift protection, and infra updates
- Installer: Updated k3s deployment logic and configuration generation.

- k3s Role: Implemented token drift protection to verify Vault secrets against live node tokens.

- DNS: Enhanced samba_reverse_dns role to support multiple reverse zones.

- Service Init: Updated initialization scripts and status reporting.

- Infrastructure: Added prole management role and k3s diagnostic playbook.

- Configuration: Updated prole.cfg and added vaulted group variables.
2026-02-12 02:30:44 -08:00
chrisfu
96f594fd3c Refactor initialization scripts and add new service components
- Consolidated and split initialization scripts in etc/:
    - Removed init_prole-db.sh and init_authority.sh.
    - Added init_kdc.sh for in-cluster MIT Kerberos KDC (prole-authority).
    - Added init_ollama.sh for Ollama AI service integration.
    - Added init_service_layer.sh for high-level service orchestration.
    - Added init_k3s_registry.sh for private registry management.
- Major updates to install.py:
    - Support for new Ollama and KDC configuration.
    - Improved prole.cfg rendering and namespace handling.
    - Updated unattended install flags.
- Infrastructure and Deployment:
    - Updated K3s Ansible role with private registry support (registries.yaml template).
    - Added prole-authority Dockerfile.
    - Updated OpenBao Kerberos ConfigMap and other K8s manifests.
- Configuration:
    - Updated prole.cfg with new sections for Ollama and Monitoring.
    - Refined environment variable exports in env.sh and prole_cfg.sh.
2026-02-11 13:09:31 -08:00
chrisfu
f47c18fef7 feat(infrastructure): enhance k3s automation and OpenTofu integration
- Infrastructure:
    - Updated k3s Ansible role with mountpoint preflight checks and better permission management.
    - Automated deployment of prole configuration and port-forwarding scripts to cluster hosts.
    - Added systemd service for managing port forwards on k3s nodes.
    - Added prole-installer service account token automation.
- K8s Manifests:
    - Renamed and added Persistent Volumes in iscsi-pvs.yaml (including OpenBao support).
    - Updated StatefulSets for garage and openbao.
    - Migrated prole-db to CloudNativePG-based configuration.
    - Added comprehensive OpenTofu manifests for cluster deployment.
- Configuration:
    - Added cluster-specific configurations (k3d, k3s-hosts).
    - Added PostgreSQL configuration templates.
    - Updated .gitignore to track the conf/ directory.
- Tools:
    - Updated install.py and port-forwarding scripts.
    - Added render_manifest.py for manifest generation.
2026-02-07 22:53:18 -08:00
chrisfu
63e6f18b5b Enhance cgroup management: normalize, clean up backslashes, and optimize cmdline processing logic. Add memory controller check. 2026-02-06 12:19:42 -08:00
chrisfu
6b6e5e2aec nodeSelector and storage updates across k8s manifests
- Added `nodeSelector` for multiple Kubernetes resources to ensure scheduling on `myrddin.prole.org`.
- Modified `storage` requests and set `storageClassName` in `garage-statefulset.yaml`.
- Enhanced `install.py` for dynamic environment configuration and kubeconfig handling.
- Improved cgroup management tasks in Ansible with conflict resolution and parameter updates.
- Simplified vault token update process in playbooks and updated encryption checks.
2026-02-06 01:17:54 -08:00
chrisfu
5ae0c0bcb9 k3s_sync task 2026-02-05 22:26:17 -08:00
chrisfu
da2f6600ba feat: infrastructure and installer updates for k3s, OpenTofu, and prole-db
- Add k3s start/stop Ansible playbooks and roles.

- Implement OpenTofu initialization scripts and k8s manifests.

- Update ncurses installer with OpenTofu support and improved k3s integration.

- Add mode support (--mode) to etc/ initialization scripts.

- Update prole-db with recovery, barman objectstore, and SSH OpenBao support.

- Refine k8s manifests for OpenBao and prole-db.
2026-02-05 21:27:18 -08:00
chrisfu
519235558a add ansible role samba_dns. master group_vars/all/dns.yml\nfixed role iscsi 2026-01-29 16:58:30 -08:00
chrisfu
d7b6a72ece Refactor cgroups task for cleaner syntax using a ternary filter 2026-01-28 15:27:12 -08:00
chrisfu
826f28ccdb Add cgroups prerequisite role for k3s 2026-01-28 15:17:26 -08:00
chrisfu
d7c4778b51 Add preflight checks for cgroup kernel params in k3s setup
- Ensure cgroup kernel parameters are present before k3s installation.
- Introduce playbook changes to integrate cgroup prerequisites role.
2026-01-28 14:38:36 -08:00
chrisfu
2e4d785de3 Refactor k3s version installation logic to use a ternary filter for cleaner syntax in main.yml. 2026-01-28 13:43:46 -08:00
chrisfu
887c485c32 Add playbooks for k3s reset and deletion with vault token removal. Include k3s cleanup tasks role. 2026-01-28 13:34:37 -08:00
chrisfu
23624eb692 ansibles roles k3s, local_user 2026-01-28 13:05:28 -08:00
chrisfu
b4cea8c6f5 add samba_ad_dc role 2026-01-28 12:41:06 -08:00
chrisfu
453ccfd015 Add k3s kubeconfig user configuration and iSCSI target defaults 2026-01-27 21:46:56 -08:00
chrisfu
37156086aa ansible stable 2026-01-26 18:56:17 -08:00
chrisfu
035d63090c Fix Ansible YAML parsing errors and standardize host_vars. Removed invalid '---' document separators from host_vars files, merged redundant myrddin config, and renamed host_vars to use .yml extension. Verified with successful ansible-playbook --syntax-check. 2026-01-25 23:36:25 -08:00
chrisfu
5cb2dbdc57 fix k3s role 2026-01-25 06:00:38 -08:00
chrisfu
7c25d731ce /var/log/pihole SAN mounted 2026-01-25 05:33:40 -08:00
chrisfu
b250d17a93 added iscsi role, ensure /var/lib/rancher storage is mounted before k3s 2026-01-25 01:26:07 -08:00
chrisfu
05f1058204 Refactor rsyslog template path and introduce noswap role:
- Modified `10-server.conf.j2` to use `%HOSTNAME%/%programname%.log` for log file paths.
- Added `noswap` role with tasks for swap management: disabling swap, removing swap entries, managing dphys-swapfile, and zramswap services.
- Included handlers for reloading systemd after changes.
2026-01-24 01:32:01 -08:00
chrisfu
63384fa309 fix missing file 2026-01-24 00:54:24 -08:00
chrisfu
829d8d14fd k3s should not initialize and start yet, install, ensure stopped. k3s storage next before init 2026-01-24 00:35:11 -08:00
chrisfu
59cc9f7edf Update K3s and Samba DNS configurations
- Change K3s service to be stopped and disabled by default.
- Adjust PTR records in the inventory to ensure correct FQDN mappings.
- Refactor Samba DNS task to use include_tasks for PTR records.
2026-01-23 20:33:17 -08:00
chrisfu
dfed907938 Fix k3s_node_ip detection on hosts without wired IP: Added fallback to default IPv4 address if none of the specified wired interfaces have an IP address. 2026-01-21 20:39:10 -08:00
chrisfu
e69b5f2008 ansible: replace no_swap role with swap role and enhance K3s setup
- Removed the `no_swap` role and replaced it with the new `swap` role for managing swap configurations.
- Updated the K3s role to dynamically detect the first available wired interface IP and validate it.
- Enhanced K3s installation by adding support for disabling SELinux RPM.
- Adjusted inventory and `site.yml` to align with the updated roles.
- Added `.vault_pass` to `.gitignore`.
- Updated Ansible configuration with result format compatibility for different versions.
2026-01-21 16:16:14 -08:00
chrisfu
bee7c09d89 infrastructure: rsyslogd use fqdn directory names 2026-01-21 16:00:53 -08:00
chrisfu
f4d96211d8 ansible: add K3s role files 2026-01-21 10:27:27 -08:00
chrisfu
5b76fc9b6e pihole ansible management fixes 2026-01-19 01:41:45 -08:00
chrisfu
9cfac76b4c ansible managed rsyslog 2026-01-18 22:49:49 -08:00
chrisfu
d55459b83f ansible managed piholes 2026-01-18 22:01:23 -08:00