Compare commits

..

7 Commits

Author SHA1 Message Date
Fabio Scotto di Santolo
d8ba674df7 Add lazygit on wsl 2026-05-28 15:05:25 +02:00
Fabio Scotto di Santolo
7327bab7f2 Change merge and diff tool for git on workstation 2026-05-28 14:54:07 +02:00
Fabio Scotto di Santolo
e6467017d9 sway: inhibit screensaver during video playback in mpv and browser
Start xdg-desktop-portal-wlr and xdg-desktop-portal-gtk explicitly so
Firefox can route ScreenSaver.Inhibit DBus calls through the portal chain
to the Wayland idle inhibitor. Add stop-screensaver=yes to mpv.conf for
native Wayland idle inhibition during mpv playback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 18:41:39 +02:00
Fabio Scotto di Santolo
5d45955cec install sshfs on Void Linux 2026-05-24 18:10:26 +02:00
Fabio Scotto di Santolo
c34e9dccb9 desktop: swap fonts to NotoSans NF and UbuntuSansMono Nerd Font 2026-05-23 22:24:07 +02:00
Fabio Scotto di Santolo
27e6541357 sway: add foot terminal config (Liberation Mono 14, black background)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 19:37:18 +02:00
Fabio Scotto di Santolo
f4b9b35c4e Add task for installing IBM Bob Shell 2026-05-23 11:35:44 +02:00
612 changed files with 7230 additions and 191386 deletions

View File

@@ -0,0 +1,19 @@
{
"permissions": {
"allow": [
"Bash(xargs ls -la)",
"Bash(command -v pacman)",
"Bash(command -v paclist)",
"Bash(command -v pacinfo)",
"Bash(git -C /home/fscotto/AnsiblePlaybook add ansible/inventory/group_vars/arch.yml ansible/roles/services_systemd/tasks/main.yml)",
"Bash(git -C /home/fscotto/AnsiblePlaybook commit -m ' *)",
"Bash(git -C /home/fscotto/AnsiblePlaybook diff --stat)",
"Bash(git -C /home/fscotto/AnsiblePlaybook status --short)",
"Bash(git -C /home/fscotto/AnsiblePlaybook log --oneline --all -- ansible/inventory/host_vars/nymph.yml ansible/roles/profile_desktop_host/tasks/nymph.yml 'dotfiles/nymph/*')",
"Bash(git *)",
"Bash(wlogout --help)",
"Bash(xbps-query *)",
"Bash(xbps-install --dry-run gtklock)"
]
}
}

2
.gitignore vendored
View File

@@ -1,2 +0,0 @@
# DuckDNS runtime files contain a rendered Vault token and must stay on the host.
/dotfiles/server/duckdns/

591
AGENTS.md
View File

@@ -1,39 +1,27 @@
# AGENTS.md
Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora IoT, WSL, a Rocky Linux 9 server, and an Atlas NAS.
Ansible-driven personal infrastructure repo for Void desktops, Linux workstations, Windows+WSL, and an Ubuntu server.
## Source Of Truth
- Main orchestration: `ansible/site.yml`
- Inventory and layering inputs: `ansible/inventory/hosts.yml`, `ansible/inventory/group_vars/*.yml`, `ansible/inventory/host_vars/*.yml`
- Dotfiles live under `dotfiles/`
- AI agent instructions (bootstrap, dispatcher, knowledge, rules, patterns) are centralized in `dotfiles/common/.config/ai/` and shared between OpenCode, Codex, Gemini CLI, and Cline.
- OpenCode loads its entrypoint configuration from `dotfiles/common/.config/opencode/opencode.json`; Codex global instructions deploy from `dotfiles/common/.codex/AGENTS.md`; Cline deploys both the cross-tool `dotfiles/common/.agents/AGENTS.md` pointer (to `~/.agents/AGENTS.md`) and the always-on global rule `dotfiles/common/.cline/rules/ai-context.md` (to `~/.cline/rules/`), which auto-binds the deployed `bootstrap.md`, dispatcher, safety directives, and distilled ChatGPT knowledge.
- AI agent instructions (bootstrap, rules, knowledge) are centralized in `dotfiles/common/.config/ai/` and shared between OpenCode, Codex, and Gemini CLI.
- OpenCode loads its entrypoint configuration from `dotfiles/common/.config/opencode/opencode.json`.
- Codex config is rendered from `dotfiles/common/.codex/config.toml.j2` so `model_instructions_file` points to the deployed `~/.config/ai/bootstrap.md`.
- ChatGPT conversation memory is stored in `dotfiles/common/.config/ai/memory/chatgpt/` and regenerated incrementally by `scripts/chatgpt_export_to_memory.py` from an official ChatGPT data export.
## Topology
- Current personal desktop: `ikaros = platform_fedora + role_personal_workstation + graphical_desktop + desktop_gnome`
- Current laptop: `nymph = platform_fedora + graphical_desktop + desktop_gnome`
- Void desktop profile is also the base for other future/reference hosts via `platform_void + graphical_desktop`
- Workstation: `deadalus` is Windows + Fedora WSL.
- Rocky server: `prometheus` belongs to `rocky_server`.
- NAS: `atlas` (Rocky Linux 9, reached through SSH)
- Always-on LAN node: `aegis` (Fedora IoT on Raspberry Pi 4, reached through SSH)
- Void desktops: `ikaros`, `nymph`
- Native Linux workstations: `deadalus-ubuntu`, `deadalus-fedora`
- Windows host + WSL dev: `deadalus-win`, `deadalus-wsl`
- Ubuntu server: `prometheus`
- Hosts intentionally belong to multiple groups; trust `ansible/site.yml` over hostname assumptions.
- Inventory axes are independent: `platform_*`, `role_*`, and `desktop_*`. Legacy `void` and `desktop` remain compatibility parents.
## Working Rules
- Preserve layering `all -> platform -> role -> desktop -> host`.
- Preserve layering `all -> OS -> profile -> host`.
- Keep `ansible/site.yml` small; orchestration belongs there, implementation belongs in roles.
- Prefer minimal, targeted edits. Preserve idempotency and existing ordering.
- Keep completed one-time cleanup operations out of the playbook. Execute them directly
with explicit authorization; retain only the ongoing desired-state configuration and
historical documentation, not permanent cleanup flags or tasks.
- Use trunk-based development: `main` is the single long-lived branch. Land small,
validated changes quickly, either as direct commits or via short-lived branches merged
as soon as validation passes. Do not maintain `release/`, `support/`, or other
long-lived branch lines: tag releases from the trunk and fix production issues on it.
- Desktop and WSL hosts use `ansible_connection: local`; remote infrastructure hosts use SSH.
- Most hosts use `ansible_connection: local`; Windows host is the exception.
- Treat `secrets/` as sensitive. Never print secret values.
- Tmux plugins are bootstrapped by TPM on the host; the repo only keeps tmux config and custom helper scripts.
- Read the relevant role tasks, templates, vars, and deployed dotfiles before editing.
@@ -46,574 +34,67 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
- `ansible-lint ansible/roles`
- `yamllint ansible/`
- Host-focused dry runs:
- Fedora desktop work: `ansible-playbook ansible/site.yml --limit ikaros --check --diff`
- Fedora laptop work: `ansible-playbook ansible/site.yml --limit nymph --check --diff`
- WSL workstation dev: `ansible-playbook ansible/site.yml --limit deadalus --check --diff`
- Void desktop work: `ansible-playbook ansible/site.yml --limit ikaros --check --diff` or `--limit nymph --check --diff`
- Ubuntu workstation: `ansible-playbook ansible/site.yml --limit deadalus-ubuntu --check --diff`
- Fedora workstation: `ansible-playbook ansible/site.yml --limit deadalus-fedora --check --diff`
- WSL dev: `ansible-playbook ansible/site.yml --limit deadalus-wsl --check --diff`
- Server: `ansible-playbook ansible/site.yml --limit prometheus --check --diff`
- Rocky server after activation: `ansible-playbook ansible/site.yml --limit <host> --check --diff`
- Atlas NAS: `ansible-playbook ansible/site.yml --limit atlas --check --diff`
- Aegis IoT: `ansible-playbook ansible/site.yml --limit aegis --check --diff`
- Aegis NFS client layer: `ansible-playbook ansible/site.yml --limit aegis --tags nfs --list-tasks`
- Aegis host DNS: `ansible-playbook ansible/site.yml --limit aegis --tags dns --check --diff`
- Focused checks:
- Emacs is disabled by default; temporary Emacs check: `ansible-playbook ansible/site.yml --limit <host> --tags emacs --check --diff -e emacs_enabled=true`
- AI coding agents: `ansible-playbook ansible/site.yml --limit <host> --tags ai_agents --check --diff`
- AI desktop apps lifecycle: `ansible-playbook ansible/site.yml --limit ikaros --tags chatgpt,opencode_desktop,cline_desktop --check --diff`
- Emacs dotfiles only: `ansible-playbook ansible/site.yml --limit ikaros --tags emacs --check --diff` or `--limit nymph --tags emacs --check --diff`
- Mail bootstrap: `sh -n scripts/bootstrap_mail.sh` and `shellcheck scripts/bootstrap_mail.sh`
- Thunderbird iCloud profile: `ansible-playbook ansible/site.yml --limit ikaros --tags thunderbird --check --diff`
- Server NPM Quadlet: `systemctl status prometheus-npm.service`; the Compose fallback is retired.
- Explicit Prometheus legacy cleanup (destructive only without check mode):
`ansible-playbook ansible/site.yml --limit prometheus --tags server_legacy_cleanup --check --diff -e server_legacy_cleanup=true`
- Atlas media stack:
`ansible-playbook ansible/site.yml --limit atlas --tags storage,sharing,containers --check --diff`
- Atlas rootless Gitea staging (does not start Gitea):
`ansible-playbook ansible/site.yml --limit atlas --tags gitea --check --diff`
- Atlas canonical Gitea domain (restarts only Gitea on a real configuration change):
`ansible-playbook ansible/site.yml --limit atlas --tags gitea_public_domain --check --diff`
- Atlas Nextcloud/ONLYOFFICE steady state:
`ansible-playbook ansible/site.yml --limit atlas --tags nextcloud --check --diff`
- Atlas recurring consistent Nextcloud backup preparation:
`ansible-playbook ansible/site.yml --limit atlas --tags nextcloud_backup,monitoring --check --diff`
- Atlas iCloudPD storage and boot-started Quadlet:
`ansible-playbook ansible/site.yml --limit atlas --tags icloudpd --check --diff`
- Ongoing Gitea proxy configuration:
`ansible-playbook ansible/site.yml --limit prometheus --tags gitea_cutover,prometheus_backup --check --diff -e server_gitea_on_atlas=true`
and `ansible-playbook ansible/site.yml --limit atlas --tags gitea --check --diff`
- Atlas daily Navidrome music copy:
`ansible-playbook ansible/site.yml --limit atlas --tags music_sync --check --diff`
- Atlas network/share hardening:
`ansible-playbook ansible/site.yml --limit atlas --tags hardening,sharing --check --diff`
- Atlas ZFS snapshot retention and scrub timers:
`ansible-playbook ansible/site.yml --limit atlas --tags snapshots,scrub --check --diff`
- Atlas encrypted Borg backup:
`ansible-playbook ansible/site.yml --limit atlas --tags packages,borg --check --diff`
- Atlas Borg progress logging only:
`ansible-playbook ansible/site.yml --limit atlas --tags borg_logging --check --diff`
- Atlas manual offline USB backup and 45Drives Alerts reminder:
`ansible-playbook ansible/site.yml --limit atlas --tags usb_backup,usb_reminder --check --diff`
- Atlas pool, disk, capacity, temperature, and job monitoring:
`ansible-playbook ansible/site.yml --limit atlas --tags monitoring --check --diff`
- Atlas explicit post-restore SELinux relabeling:
`ansible-playbook ansible/site.yml --limit atlas --tags restorecon --check -e '{"atlas_restorecon_paths":["/zpool/archive"]}'`
- Prometheus/Aegis WireGuard gateway:
`ansible-playbook ansible/site.yml --limit prometheus,aegis --tags wireguard --check --diff`
- Prometheus NPM Quadlet steady state (does not perform a cutover):
`ansible-playbook ansible/site.yml --limit prometheus --tags npm_quadlet --check --diff`
- Windows bootstrap parse: `pwsh -NoProfile -Command "[void][System.Management.Automation.Language.Parser]::ParseFile('scripts/bootstrap_windows_workstation.ps1', [ref]$null, [ref]$null)"`
- Server compose render: `docker compose -f /opt/docker/server/docker-compose.yml config`
## Conventions
- Use FQCN Ansible modules.
- Prefer declarative modules over `command`/`shell`; when `shell` is required, make idempotency and failure behavior explicit.
- Start YAML files with `---`, use 2-space indentation, and keep file modes quoted like `"0644"`.
- Keep booleans as booleans and structured vars as YAML lists/maps.
- Group similar tasks into list variables (typically in `group_vars`) and apply them
with a single task looping over the list, rather than one near-identical task per item.
- Put host-specific overrides in `host_vars`, not shared `group_vars`.
- Use `no_log: true` for secret-bearing task inputs or outputs.
## Desktop Notes
- `desktop_profile` names independently selectable desktop groups such as `desktop_gnome`, `desktop_sway`, and `desktop_niri`. Keep platform-specific session bootstrap in platform-specific roles.
- `desktop_environment` is fixed to `minimal` for Void desktops. `profile_desktop_common` owns shared Void bootstrap; `profile_desktop_sway` and `profile_desktop_niri` manage the enabled sessions, while `profile_desktop_gnome` copies shared desktop dotfiles for Fedora/GNOME without managing GNOME settings. `desktop_sessions_enabled` and `desktop_default_session` apply to the minimal mode.
- Emacs has one authoring-oriented `.emacs.d`, deployed by `dotfiles_common` when `emacs_enabled` is true. Fedora/GNOME desktops and workstation profiles enable it; keep platform dependencies in package group vars rather than branching in Emacs Lisp.
- `profile_desktop_common` owns the shared desktop bootstrap; `profile_desktop_i3` (X11) and `profile_desktop_sway` (Wayland/SwayFX) install their respective session in parallel and are both wired into the `void` play in `ansible/site.yml`. `desktop_sessions_enabled` and `desktop_default_session` in host vars decide which sessions are exposed in `emptty` and which is preselected.
- `.emacs.d` is deployed by a dedicated `profile_desktop_common` task tagged `emacs`.
- NTFS filesystem support is provided by `ntfs-3g` in `ansible/inventory/group_vars/void.yml`.
- Void user services are managed by `turnstile` and live under `dotfiles/desktop/.config/service/`.
- `ssh-agent` keeps the stable socket `~/.local/state/ssh-agent/socket`.
- Critical session entrypoints:
- `dotfiles/desktop/.xinitrc` (i3 / X11)
- `dotfiles/desktop/.config/sway/config` plus `host.conf` and `session-env` deployed via `host_sway_dotfiles` (sway / Wayland)
- `dotfiles/desktop/.config/niri/config.kdl` and `session-env` deployed via `desktop_niri_dotfiles` (Niri / Wayland)
- Void Niri lives in `profile_desktop_niri`, gated on `'niri' in desktop_sessions_enabled`; it installs the `emptty` `niri.desktop` session, the `/usr/local/bin/start-niri` launcher, and the xdg-desktop-portal config, mirroring `profile_desktop_sway`.
- Fedora GNOME (`desktop_gnome`) assumes GNOME comes from the Fedora Workstation base install; Ansible deploys shared desktop dotfiles and git/GPG config for `ikaros` and `nymph`, not GNOME settings.
- `profile_desktop_gnome` first discovers configured Thunderbird accounts in both `~/.thunderbird` and `~/.config/thunderbird` and selects an existing profile without changing its account settings. Only if no account exists does it seed a new iCloud IMAP/SMTP profile with CalDAV and CardDAV through a non-overwriting `user.js`. Registry changes preserve other profiles and create backups; Thunderbird must be closed. The bootstrap address comes from `vault_icloud_email` and the app-specific password is never stored by Ansible.
- Do not switch or restart the display manager during a playbook run from an active graphical session.
- `nymph` is the Fedora/GNOME laptop target; keep GNOME settings unmanaged for now and add host-specific tuning only after real use.
- Do not auto-restart `emptty` during playbook runs on active Void desktop hosts; restart it manually from another TTY/SSH session if needed.
- `nymph` is a Void laptop with NVIDIA Optimus, running both i3 (X11) and sway (Wayland); host-specific tasks in `profile_desktop_host/tasks/nymph.yml` handle GRUB NVIDIA cmdline params, `prime-run` wrapper, and the WirePlumber camera priority config. Multi-monitor on X11 is driven by `autorandr`; on sway it is driven by `kanshi` (config deployed via `host_sway_dotfiles`).
## Void Package And Dotfile Bucket Rules
`platform_void` is the reusable Void platform selection. The legacy `void` group remains a compatibility parent so existing `group_vars/void.yml` and `when: "'void' in group_names"` checks keep working during the transition.
The Void desktop package lists in `ansible/inventory/group_vars/void.yml` are kept disjoint by role:
The four Void desktop package lists in `ansible/inventory/group_vars/void.yml` are kept disjoint by role:
- `void_packages_base` — system runtime only (init/services, kernel, audio core, networking, filesystem, firewall, hardware daemons, runit logging).
- `desktop_common_packages` — GUI infrastructure shared by the minimal desktop mode.
- `desktop_minimal_packages` — applications, integration components, and the `emptty` display manager.
- `desktop_sway_packages` — binaries specific to the Sway session.
`profile_packages` remains the shared package bucket for Void and Fedora profiles. Rocky uses
`rocky_profile_packages` so RPM-specific names do not leak back into the other platforms; do not move
desktop-specific Void entries through either bucket.
The dotfile vars follow the same split: `desktop_common_dotfiles` carries mode-independent content and `desktop_minimal_dotfiles` carries Thunar, Udiskie, and MIME defaults. `desktop_void_dotfiles` remains reserved for files that need the Void runtime.
- `desktop_common_packages` — WM-agnostic GUI infra (GTK theme, polkit, keyring, NM-applet, blueman, audio GUI, file manager backend + GVFS, portal, flatpak, printing/scanning).
- `desktop_i3_packages` / `desktop_sway_packages` — binaries specific to each session. Cross-WM packages used by both (`dunst`, `rofi`, `alacritty`) are intentionally duplicated in the two lists.
`profile_packages` in the same file is cross-distro and is overridden by `group_vars/server.yml` and the workstation group vars; do not move desktop-specific Void entries through it.
The dotfile vars follow the same split: `desktop_common_dotfiles` (in `group_vars/desktop.yml`) carries WM-agnostic GUI config and user scripts (Thunar, mimeapps, GTK theme setup, Udiskie, fontconfig, WirePlumber, mpv, …); `desktop_void_dotfiles` (in `group_vars/void.yml`) is reserved for files that need Void runtime (turnstile services, bash runit/dbus/ssh-agent fragments, `update-turnstile-env`).
## Workstation Notes
- `deadalus` is modeled as Windows + Fedora WSL and is the sole workstation target.
- Fedora WSL belongs to `platform_fedora`, `workstation_dev_fedora`, and the shared WSL layer. It must not receive Flatpak or Snap runtimes.
- Windows applications are installed manually and are not managed from the WSL profile.
## Rocky Server Notes
- DuckDNS support is removed from the server profile, not feature-gated. No updater tasks,
templates or enablement variables remain. Prometheus uses its static IP and `fscotto.co`;
the local updater, log and cron job were already retired. External DuckDNS account/name
and existing encrypted token are outside this removal and remain untouched.
- `rocky_server` is a child of both `platform_rocky` and `server`; `prometheus` is its active target.
- The target must already provide `server_username` with local sudo access before the profile runs.
- The Rocky profile installs Podman and podman-compose. Prometheus explicitly retires the legacy
Compose unit, files and final-export helper with `server_legacy_stack_retired: true`.
Its approved opt-in cleanup removed old application data on 2026-10-03; normal runs do not
delete data or recreate the retired files. On Prometheus, Nginx Proxy Manager is now the rootful
`prometheus-npm.service` Quadlet with a pinned image digest and the existing `/opt/npm/data` and
`/opt/npm/letsencrypt` bind mounts. The rootful `server_web` bridge remains `10.89.0.0/24`.
Gitea runs on Atlas; PostgreSQL and Navidrome are absent from the desired Prometheus stack.
Normal runs do not delete legacy data, update DNS, or perform an implicit cutover;
destructive cleanup requires its explicit tag and opt-in extra-var.
- Firewalld enables SSH, Cockpit (`9090/tcp`), HTTP and HTTPS. Nginx Proxy Manager publishes `80/tcp` and
`443/tcp`; bind its administration interface only to `127.0.0.1:81` and use `npm-tunnel` from Ikaros or Nymph.
Nextcloud remains disabled; do not provision `/srv/nextcloud` directories.
- The completed Ubuntu-to-Rocky data migration script and its operational instructions
have been removed; current provisioning does not provide that one-time migration path.
- Completed Gitea owner-migration, migration-restore and final-export tasks, helpers and flags
are removed. Current Gitea marker/ownership checks, recurring backups and proxy configuration
remain intact. `server_gitea_proxy_enabled` controls ongoing proxy management only.
- Atlas-only OpenZFS, NFS, Samba, and Syncthing stay selected through Atlas host variables and must not
leak into `rocky_server`. Cockpit plus its Navigator and Podman extensions are selected explicitly for
Prometheus through its host variables.
## Atlas NAS Notes
- `atlas` is a remote Rocky Linux 9 NAS. Keep its connection, LAN, pool and mountpoint values in
`host_vars/atlas.yml`. Bootstrap it once with `-e atlas_connection_username=<existing-admin>`;
subsequent runs use the dedicated Atlas account.
- The pool is normally pre-existing. A one-time bootstrap may create it only when `atlas_create_pool=true`
is explicitly supplied and `atlas_zpool_disks` contains exactly four real `/dev/disk/by-id/...` paths.
Never partition, force, destroy, roll back, or modify the vdev layout of an existing pool.
- `atlas_manage_storage`, `atlas_manage_sharing`, and `atlas_manage_firewall` are enabled in Atlas host vars as
the declared steady state; set one false only for a deliberate suspension. `atlas_manage_media_stack` remains false
until the future rootful Immich stack has its required Vault inputs and target validation.
- Atlas requires `vault_atlas_admin_password_hash` for Cockpit and, while sharing is enabled,
`vault_atlas_samba_password`. The future rootful media stack also requires
`vault_atlas_immich_db_password`. Never print these values.
- Atlas creates the complete declared hierarchy only under the verified existing or explicitly bootstrapped pool: `archive`,
`services`, `services/data`, `services/data/navidrome`, `services/data/syncthing`, `media`, `media/music`,
`media/photobook`, `backup`, `backup/hosts`, and `backup/hosts/prometheus`. `backup` has a `500G`
reservation covering its descendants. `archive` is the SMB-shared raw-data namespace; container state is never beneath it.
- The `immich` system account is fixed to UID/GID `1100`, has no login shell or `wheel` membership, and receives only
the `video` and `render` supplementary groups. Immich's rootful Quadlets run as `1100:1100`; Server and ML receive
`/dev/dri`, while the Photobook external library is read-only at `/external/photobook`.
- Atlas applies persistent kernel network hardening: redirects and source routes are rejected, martians logged, reverse-path filtering remains loose for WireGuard, and IPv4 forwarding is disabled. SSH permits only the declared administrator using public-key authentication; root login, passwords, agent and remote forwarding
are disabled, while local forwarding remains available for private administrative tunnels. Photobook is exported only to the configured Aegis IP with all access squashed to UID/GID
`1100`. Targeted SELinux is enforced persistently; a required reboot is reported but never initiated automatically. The primary LAN interface is assigned explicitly to the managed firewalld zone, and firewall rules are applied before NFS or SMB are started; their service state and TCP listeners are then verified. SMB3 exposes `Archive` to Vault-backed authorized accounts on mandatory encrypted, signed SMB3 over TCP/445 only and admits the configured LAN without host-specific exclusions.
- Atlas NPM and Immich share a rootful Podman network. NPM publishes HTTP/HTTPS, but its administration port remains
bound to `127.0.0.1:81`; do not expose it directly to the LAN or Internet.
- `profile_backend_phase1` temporarily runs rootless Navidrome and Syncthing on Atlas until Uranus replaces
them. It binds only to Atlas' LAN IP, never `wg0`; Navidrome and the Syncthing GUI admit only Aegis as
the source-NAT gateway, while native Syncthing ports admit the configured LAN. It initializes fresh
state only and never migrates or deletes source application data. The enabled rootless
`atlas-music-sync.timer` copies `/zpool/archive/Music` to `/zpool/media/music` daily at 00:45
Europe/Rome without deleting destination files; it requires both datasets to be mounted.
- `wireguard_overlay` manages `wg0` between Prometheus (`10.0.0.1`) and Aegis (`10.0.0.2`). It persists private
keys only on their respective hosts, exchanges only derived public keys through Ansible, and verifies a real peer
handshake. Prometheus opens `51820/udp`; Aegis is the LAN gateway. Its persistent IPv4 forwarding, narrowly scoped
WireGuard-to-LAN firewalld policy, and source masquerading permit Prometheus to reach LAN services without a static
route on the router. Prometheus includes `192.168.178.0/24` in Aegis' peer `AllowedIPs`; add the Uranus VIP there
when it is assigned. After a firewalld reload, restore Prometheus' rootful Podman networking with
`podman network reload --all` so the existing proxy stack retains container DNS.
- Atlas qBittorrent is selected by `atlas_manage_qbittorrent` and managed with the
`qbittorrent` tag as the admin-owned rootless `atlas-qbittorrent.service` Quadlet.
Its Web UI is `http://192.168.178.55:8090` on the LAN and prepared for the manual
NPM HTTPS domain `torrent.fscotto.co`, trusting only Aegis for forwarded client
addresses. DNS and NPM configuration stay manual. Configuration lives in
`services/data/qbittorrent`, and only `Archive/Downloads` is writable as payload
storage. It uses the home Internet connection, not WireGuard or a VPN; no router
forwarding or published torrent peer port is configured. See `docs/atlas-qbittorrent.md`.
- Atlas HTTP downloads use the admin-owned rootless `atlas-aria2.service` and
`atlas-ariang.service` Quadlets, gated by `atlas_manage_aria2` and the `aria2` tag.
AriaNg binds the LAN at `http://192.168.178.55:8091`; direct RPC is LAN-only on TCP/6800
and requires a private target-generated token. State lives in `services/data/aria2`,
with payloads in `Archive/Downloads`; do not expose RPC through the existing
qBittorrent `torrent.fscotto.co` endpoint. Public `downloads.fscotto.co` uses
a manual NPM Access List for both UI and `/jsonrpc`. The `aria2_gateway` tag
manages an admin user service on TCP/8092, accessible only through Aegis,
injecting the private token for JSON-RPC POST clients; keep this route
authenticated and never expose the gateway directly. See `docs/atlas-aria2.md`.
- Atlas Nextcloud backup preparation (`atlas-nextcloud-backup.service`) is an ordered
requirement of the nightly `atlas-borg-backup.service` and the operator-started
`atlas-usb-backup.service`. A structurally complete bundle younger than
`atlas_nextcloud_backup_reuse_max_seconds` (20 h, asserted below 24 h so the nightly
Borg cycle always refreshes it) is reused without pausing the applications: a manual
USB run therefore reaches its LUKS prompt within seconds, while preparation failure
still blocks the dependent job. Force one fresh preparation with
`systemctl set-environment ATLAS_NEXTCLOUD_BACKUP_FORCE=1` before the start and unset
the variable afterwards. Deployed and validated on 2026-11-15: a dependency start reused
a verified bundle 14 h old and skipped preparation in 14 ms, and an operator-started
USB run reached its LUKS prompt in under a second; the FORCE path has not been exercised
in production yet. See `docs/atlas-nextcloud.md`.
## Atlas NAS TODO
Completed validation: the existing RAIDZ2 pool and datasets, SELinux, LAN firewall, SSH, Cockpit with
the selected 45Drives plugins, encrypted SMB3 `Archive`, the Aegis-only NFSv4 `photobook` export, and the
Prometheus--Aegis WireGuard gateway are operational. The gateway handshake, forwarding, source masquerading,
and TCP reachability to Atlas were verified. Temporary Navidrome and Syncthing are available through their
manual NPM Proxy Hosts; Syncthing uses `/data/Org` backed by the SMB-shared Archive dataset. Aegis has also
validated NFSv4.2 read, write, delete, and `all_squash` mapping to UID/GID `1100` end-to-end. The ZFS
snapshot timers are active; a recursive hourly snapshot and scheduled retention prune completed
successfully. The first monthly scrub completed successfully on 2026-10-04;
the actual service result and pool scan were independently verified.
### Priority 1 - Data protection
- [x] Deploy Ansible-managed recursive ZFS snapshots with 24 hourly, 30 daily, 8 weekly, and 12 monthly
generations, plus a monthly scrub on the first Sunday at 03:00. The timers and first hourly snapshot were
verified on Atlas. Cockpit Scheduler is for visibility or manual operations only, and snapshot
rollback is never automated.
- [x] Verify the first monthly ZFS scrub from its actual service result. On 2026-10-04
it completed at 05:02 CEST after 2:02:04, repairing 0 B with zero errors;
the service exited successfully and the pool reported no known data errors.
- [x] Activate and validate the encrypted offsite Borg backup to the Hetzner Storage Box. Atlas uses the
dedicated SSH identity, pinned ED25519 host key, Vault-backed `repokey` encryption, and a locked
non-login `borg` account with no sudo or supplementary groups. The initial snapshot-consistent backup,
Borg repository check, and temporary-directory restore completed successfully; the restored `Archive`
tree matched the live data, and temporary snapshots and mounts were removed. The exported recovery key
was copied offline. Daily backup retries and logging, 30 daily, 8 weekly and 12 monthly archives,
compaction, and monthly repository checks are enabled. Runs report a ZFS-based estimated percentage.
On 2026-09-30 a successful incremental run also removed the stale 2026-09-29 snapshot and its own
temporary snapshot after exit; the earlier `RuntimeDirectory` cleanup failure is resolved.
- [x] Populate `/zpool/archive` with the currently available data so offsite and offline backup tests run
against a representative load.
- [x] Evaluate Borg against the populated pool. The 2026-09-29 archive took 1 h 32 min for 2.18 TB
original / 2.04 TB compressed data, with 13.49 GB deduplicated size; retention and compaction
succeeded. On 2026-09-30 a subsequent incremental archive completed in about 22 seconds with
successful cleanup. The monitor reported 37% Storage Box quota used. These are observed runs, not
a guarantee of future duration or compression ratio.
- [x] Add the UUID-bound offline USB backup with versioned rsync, locking, capacity checks, verification,
safe unmounting and a tested restore procedure; never trigger it for an arbitrary USB disk. The
LUKS/ext4 identities were read-only verified; the manual service and 45Drives Alerts reminder timer were
deployed on Atlas. Interactive LUKS unlock is part of the manual service; only the reminder is
scheduled for the first Saturday of each month at 10:00 Europe/Rome via the existing 45Drives
notifier. A manual test produced an Alerts notification, not an email. The first USB attempt failed
on a `security.selinux` xattr and was interrupted; the xattr filter is deployed and the temporary
recursive snapshot and open LUKS mapper were cleaned up. A later run reported checksum verification
and published the USB version, but failed while removing host-namespace ZFS snapshot mounts. Those
exact mounts and snapshots were cleaned up. An `ExecStopPost` helper now removes only the named
temporary snapshot after the backup process exits. A new full run checksum-verified and published a
USB version; the service ended successfully, the mapper closed, no temporary USB snapshot remained,
and the pool was healthy. On 2026-09-25 an independent, read-only USB restore test copied one file from
the published `atlas/latest` version into `/var/tmp` and matched contents, owner, mode, size, mtime and
POSIX ACL. The temporary copy and mount were removed, the mapper closed, and the pool remained healthy.
- [x] Test restores independently from a ZFS snapshot, Borg, and the offline USB backup before relying on
any backup path. The earlier Borg temporary-directory restore passed. On 2026-09-25 a separate,
read-only ZFS snapshot test restored one file to `/var/tmp`, confirmed matching contents, ownership,
mode, mtime and ACL, then removed its temporary copy and on-demand mount. This is a file-level smoke
test, not full dataset recovery. An independent USB file restore passed on 2026-09-25 with matching
content and metadata; the later scaled OS-rebuild rehearsal is documented under Priority 2.
- [x] Add monitoring and alerting for pool health, scrub/resilver, SMART data, temperatures, free space,
snapshot/local-backup growth, Hetzner Storage Box quota, and failed maintenance or backup timers.
The half-hourly Atlas health monitor and systemd final-failure hooks are deployed. A live probe
found no issues; the service and timer succeeded, and a labelled 45Drives Alerts test notification
was submitted. Alerts are deduplicated; email delivery is not claimed. The Storage Box quota probe
runs `df -m` over the dedicated pinned-key SSH identity and does not open the Borg repository.
The failed-job hook was corrected to pass the literal systemd unit name; its expansion was verified
on Atlas, but a new real failure notification has not been deliberately triggered.
### Priority 2 - NAS operability and recovery
- [x] Document and test disaster recovery in `docs/atlas-recovery.md`: the operator confirmed Vault
and Borg recovery material is available offline; provisional targets are RPO 24h/RTO 72h. On
2026-09-30 an isolated small Rocky VM was rebuilt with the Atlas Ansible roles, imported its
preserved RAIDZ2 pool without force/rewind, and restored a file from the preserved snapshot;
the second Ansible run was idempotent. Earlier independent production ZFS, USB, and Borg file
restore tests remain separate evidence. A production-size full restore, unclean import, and
measured 24h/72h compliance are not claimed.
- [x] Define a controlled Rocky kernel/OpenZFS update and reboot procedure in
`docs/atlas-updates.md`. The first real change-window execution is not yet
validated; the procedure never reboots automatically or upgrades pool features.
- [x] Add the Atlas-initiated least-privilege Prometheus backup pull: Prometheus exposes only prepared
read-only dumps through a dedicated account and Atlas retains the private SSH key, pinned host key,
atomic pull, verification, retention and systemd service/timer. The dedicated key/account and unit
files are deployed; live read-only SSH, shell denial, and write denial were verified. On 2026-09-30
a manual export, Atlas pull, checksum verification, and temporary restore passed; both SQLite
databases passed integrity checks and a restored Git repository passed `git fsck`. Both daily
timers are enabled for 02:00/03:00 Europe/Rome. On 2026-10-01 their first scheduled export and
pull succeeded: Atlas verified the payload checksum and published `20261001T000001Z` as `latest`.
- [x] Decide whether a common SMB/NFS namespace is required: no. `Archive` (SMB) and `photobook` (NFS)
remain intentionally distinct; `docs/atlas-sharing-decision.md` records the decision. No ACL or export
change is authorized by this decision.
### Priority 3 - Service expansion
- [x] Populate `/zpool/media/music` and validate Navidrome. On 2026-09-30, 21,158 files
(93,937,810,350 regular-file bytes) were copied from `/zpool/archive/Music` using a temporary
ZFS snapshot; a checksum-based rsync dry run found no differences or extra files. Navidrome saw
all files through its read-only mount, completed a scan, indexed 18,168 tracks, and responded
over HTTP. Some imported playlists still reference obsolete Windows paths. The source was left
intact and the temporary snapshot was removed.
- [x] Schedule a daily, non-deleting copy from `Archive/Music` to the separate Navidrome music
dataset. The rootless `atlas-music-sync.timer` is enabled for 00:45 Europe/Rome; a manual
idempotent service run succeeded on 2026-10-01. The first scheduled run triggered at
00:45 CEST on 2026-10-02 and exited successfully (`Result=success`, status 0); the next
run is scheduled for 2026-10-03 00:45 CEST.
- [x] Design the staged Prometheus-to-Atlas Gitea migration in `docs/atlas-gitea-migration.md`.
The approved topology keeps NPM on Prometheus and moves HTTPS and public SSH (TCP/2222) together;
Gitea runs as an `admin`-owned rootless user Quadlet on Atlas with an internal `gitea` user.
The rootful-to-rootless data-layout
conversion passed an isolated restore rehearsal. The later partial cutover is tracked below.
- [x] Prepare the dedicated Atlas Gitea dataset, non-login UID/GID 1101 with a separate rootless Podman
sub-ID range, and disabled user Quadlet. On 2026-10-01 the targeted Ansible run and a second idempotent
run passed; the generated unit was inactive, with no staging HTTP/SSH listener. POSIX ACLs on only the
service-namespace parents grant this account traversal without access to sibling datasets.
- [x] Perform an isolated rootless restore rehearsal from the verified Prometheus backup. On 2026-10-01
the SHA-256-checked selective extraction and path/SSH conversion succeeded; SQLite `quick_check`
passed, all 33 repositories passed `git fsck`, and source/target public SSH host-key fingerprints
matched. The pinned rootless image answered HTTP and listened on internal SSH/2222 with
`--network none`; the temporary container was removed and the Quadlet stayed inactive. A second
restore run made no changes. This is a rehearsal copy, not the final consistent cutover copy.
- [x] Verify ZFS and Borg coverage of the staged Gitea dataset. On 2026-10-01 the managed recursive
hourly snapshot `atlas-auto-hourly-20261001T193401Z` included it, and the managed incremental
Borg archive `atlas-20261001T193420Z` included its database. A private one-file restore from
each independently matched the staged database and passed SQLite `quick_check`; temporary files
and snapshot mounts were removed, the Borg service ended successfully, and the pool was healthy.
- [x] Include the new Gitea dataset in a UUID-bound offline USB version and test a file restore
before accepting production writes. The operator's 2026-10-01 manual run published version
`20261001T201220Z-254397` successfully on 2026-10-02. Its Gitea database was restored to a
temporary directory from a read-only mount: contents, owner, group, mode, size, mtime and POSIX
ACL matched, and SQLite `quick_check` passed. Temporary files and mounts were removed, LUKS
was closed, and the pool remained healthy. A redundant run was stopped during verification;
its temporary snapshot was cleaned up and the service's resulting failed state was reset.
- [x] Install a separate opt-in final Gitea export helper on Prometheus. Its 2026-10-01 targeted
deployment and `bash -n` passed while Gitea and NPM stayed running. It refuses an active export
timer, stops only Gitea, verifies SQLite, publishes a checksum-verified Gitea-only version for
Atlas' existing pull, and leaves the source stopped on success. It was invoked on 2026-10-02
after the export timer was stopped; version `20261002T071525Z` was pulled and verified on Atlas.
- [x] Prepare the Atlas final-restore gate without replacing the rehearsal: it accepts only a
checksum-verified `gitea-cutover` export, refuses a running target, stages and validates the new
layout before replacing the marked rehearsal, and rolls back a failed swap. Synthetic success
and rollback tests passed on 2026-10-01. On 2026-10-02 the final gate replaced the rehearsal;
SQLite `quick_check`, all 33 repository `git fsck` checks, checksum and SSH host-key comparison passed.
- [x] Start the rootless Atlas Gitea Quadlet and move the primary HTTPS route. On 2026-10-02 Atlas
answered HTTP 200 through the Aegis gateway. NPM stayed on Prometheus; its variable upstream
required a managed Nginx `server_proxy.conf` override because runtime DNS ignores Compose
`extra_hosts`. The primary public HTTPS page and API returned 200, and `git ls-remote` succeeded
for a representative repository after NPM restart; the Navidrome and Syncthing Proxy Hosts also
responded. The source
Gitea container was removed from the desired Compose stack without deleting its data; the
Prometheus backup export timer resumed for NPM only. A post-cutover recursive ZFS snapshot and
encrypted Borg archive `atlas-20261002T073044Z` completed successfully.
- [x] Move the live Gitea Quadlet and dataset from the legacy host `gitea` account to `admin`
after a disposable snapshot-copy test of the pinned derived image. On 2026-10-02 the explicit
outage run stopped only legacy Gitea, made safety snapshot
`zpool/services/data/gitea@gitea-owner-migration-20261002T100104`, changed dataset ownership,
and validated loopback staging (HTTP 200, internal `gitea` UID/GID 1000, SQLite `quick_check`)
before promoting the `admin` Quadlet. Production LAN and public HTTPS returned 200; Navidrome
and Syncthing remained active, the pool was healthy, and the normal Gitea run changed nothing.
The old host account and data on Prometheus remain preserved; the old Atlas Quadlet and its
parent-dataset traverse ACL were removed. A subsequent normal run changed nothing.
- [x] Validate public Gitea SSH/2222 and an authenticated read from Ikaros. After the VPS
firewall was opened on 2026-10-02, TCP/2222 connected, the public ED25519 host-key
fingerprint matched Atlas, Gitea authenticated `fscotto` using the `ikaros` key, and
`git ls-remote` returned HEAD for `fscotto/infra.git` over public SSH.
- [x] Validate authenticated SSH pull and push. On 2026-10-02 the operator reported both
operations working through the public SSH endpoint; the earlier agent-run `git ls-remote`
remains the independent read-only check. The agent did not perform a test push.
- [x] Validate Gitea login and write via HTTPS. On 2026-10-03 the operator confirmed
authenticated web login and Git clone/pull/push through the public HTTPS endpoint. Do not
restart the stale source Gitea after Atlas has accepted writes.
- [x] Design and deploy the empty temporary Atlas Nextcloud/ONLYOFFICE stack on 2026-10-03.
The operator explicitly authorized empty internal service startup before the first scrub;
this does not close the scrub or protection checks. Four rootless Quadlets, separate
component datasets, pinned images/apps, Vault secrets, standard fabio/chiara users, a
separate application admin and the Famiglia folder are deployed. Cron and internal Office
connection checks succeeded; repeat deployment changed nothing. See `docs/atlas-nextcloud.md`.
- [x] Complete the authorized empty-stack public cutover on 2026-10-03 after operator
DNS/NPM configuration. Both hostnames passed TLS and HTTPS redirects; authenticated
web login, WebDAV, private-file isolation, Famiglia cross-user create/read/update/delete and
CalDAV/CardDAV discovery passed. The Office connector and public health/API asset passed.
Temporary test files were removed; no iCloud data was imported.
- [x] Test a manual consistent Nextcloud backup and isolated restore on 2026-10-04.
Paused application writers and cron, copied app/config/custom apps/themes and files,
dumped PostgreSQL, restored database roles and verified authenticated DAV contents,
account recovery and Famiglia permissions. Test containers had no external network,
published ports or live data mounts; they and the temporary restore copy were removed.
See `docs/atlas-nextcloud-recovery-test.md`; this is not recurring Borg/USB recovery evidence.
- [x] Integrate consistent Nextcloud bundles with recurring Borg and operator-started USB
backups, two-version local retention, interruption recovery and failure monitoring.
On 2026-10-04 Borg archive `atlas-20261004T095255Z` succeeded; its new bundle was
extracted from Hetzner and restored in isolation with checksums, accounts, Famiglia
permissions and authenticated DAV verified. No production database was replaced.
- [x] Validate a new USB version and restore its consistent Nextcloud bundle. On
2026-10-04 USB version `20261004T101101Z-3420114` completed successfully; bundle
`20261004T100959Z-3415600` was read-only extracted, checksum-verified and restored
in isolation. Accounts, Famiglia permissions and authenticated DAV passed. The
test copy/containers were removed, LUKS closed and the pool remained healthy.
- [ ] Complete Nextcloud desktop/mobile editing and synchronization acceptance before family import.
iCloud migration and future Uranus transfer remain separate operations, not playbook flags.
- [x] Move Gitea canonical HTTPS and SSH hostname to `git.fscotto.co` on
2026-10-03 through Ansible. Only Gitea restarted; second run changed nothing.
HTTPS and authenticated SSH reads returned the same repository HEAD.
The new NPM hostnames passed TLS/HTTP checks; old DuckDNS Proxy Hosts were
observed disabled. Details are in `docs/domain-fscotto-co.md`.
- [x] Confirm login on the new Gitea hostname and update remaining client remotes/integrations.
The operator confirmed completion on 2026-10-03; the agent did not perform a test push.
- [x] Remove obsolete DuckDNS NPM Proxy Hosts, unused certificates and the old upstream override.
The operator confirmed completion on 2026-10-03; no new agent runtime check was performed.
- [x] Review and remove completed one-time procedures from the playbook.
The operator confirmed completion on 2026-10-03.
- [x] Retire Prometheus' local DuckDNS updater on 2026-10-03 through Ansible:
the five-minute cron entry and private updater/log directory were removed.
Provisioning support was subsequently removed entirely; repeat cleanup changed nothing. HTTPS services, private NPM
administration and the export timer stayed healthy. The external name and Vault token
remain untouched for possible future use on a local host.
- [ ] Keep `atlas_manage_media_stack` disabled until the future Immich deployment has validated `/dev/dri`,
container paths, and the required Vault database secret.
### Priority 4 - Optional workflows
- [x] Deploy the declared Atlas iCloudPD state dataset and inactive rootless `admin` Quadlet.
Photos belong under `/zpool/archive/Pictures/iCloudPD`; private config/MFA state belongs in
`zpool/services/data/icloudpd`. Photobook remains reserved for Immich. Ansible now renders
`icloudpd.conf` with the Apple ID from the existing Vault key, but does not store the password
or manage MFA. Automatic startup was approved on 2026-10-03; the Quadlet now
uses `WantedBy=default.target` and Ansible keeps the service running.
The isolated no-network layout test is documented in
`docs/atlas-icloudpd-migration.md`. On 2026-10-02 Atlas deployment and a second idempotent run
passed; no app config existed at deployment. A manual first start on 2026-10-02 generated
`icloudpd.conf`; an Ansible run then replaced it with a private mode-0600 Vault-backed template
and an idempotent second run. The image later expanded the config, so Ansible now seeds it
only when absent and maintains the declared fields. Its launcher requires `traceroute`; the
rootless Quadlet grants only `NET_RAW`, tested in isolation and after restart. The service
was subsequently initialized interactively; initial ingestion is tracked below.
- [x] Retire Aegis iCloudPD completely. The operator authorized deleting its Quadlet,
`/var/lib/icloudpd` data, and MFA state despite an unaudited container overlay. After two
interactive-sudo runs on 2026-10-02, the unit is `not-found`/`inactive`, the Quadlet and state
directory are absent, and AdGuard remains active. The temporary retirement tasks have since
been removed from the Aegis role; it no longer manages iCloudPD.
- [x] Validate Atlas iCloudPD authentication and initial ingestion. On 2026-10-03 the active
rootless service logged `All photos and videos have been downloaded` at 02:16 and reported
completion for the user. The destination held 11,658 files (86,020,430,015 bytes); the preceding 24h
logs showed download activity without authentication failures or errors. A later read-only check
found the service still active. This confirms the initial download, not the next daily cycle.
- [x] Declare HEIC decoding for Fedora graphical desktops without converting the originals on Atlas.
The Fedora role installs RPM Fusion Free with a pinned signing-key fingerprint and
`libheif-freeworld` on Ikaros and Nymph. The package was confirmed installed on Ikaros on
2026-10-03; Nymph deployment and an actual image-opening test were not observed.
- [ ] Validate Atlas iCloudPD filesystem/SELinux/SMB access, the next daily sync, ZFS/Borg/USB
backup inclusion, and isolated restore of photos and private state. A recursive hourly snapshot
of `zpool/archive` exists after ingestion, but no iCloudPD-specific backup version or restore
has been verified. The first monthly scrub remains a separate open data-protection check.
## Prometheus NPM Quadlet cutover
- [x] Stage a rootful NPM Quadlet using the exact running image and the existing data/certificate
mounts, bridge subnet, public HTTP/HTTPS ports, and loopback-only administration port.
The generated service depends on `server-web-network.service` and is wanted by `multi-user.target`.
- [x] Take and verify the stopped-source export before switching owners. Version
`20261003T091009Z` was pulled to Atlas and its NPM SQLite database checked in isolation.
- [x] Cut over NPM to `prometheus-npm.service` on 2026-10-03. The legacy Compose unit is inactive
and disabled; the Quadlet is active with zero recorded restarts. Public Gitea and Syncthing
HTTPS returned 200 with valid TLS, while public TCP/81 remained unreachable.
- [x] Validate the post-cutover backup path. The export and Atlas pull published
`20261003T091633Z`; checksum, SQLite `quick_check`, ten proxy hosts, six certificate records,
both Quadlet files were present, and the complete Let's Encrypt tree (70 regular files plus
12 symlinks) matched the live data. A targeted normal Ansible run changed nothing. Details and rollback
boundaries are in `docs/prometheus-npm-quadlet.md`.
- [x] Remove only unused Gitea, Navidrome and PostgreSQL images with opt-in
Ansible tasks on 2026-10-03. Second run changed nothing; NPM stayed active
with zero restarts, HTTP/HTTPS passed, backup timer and SSH proxy stayed active.
This image-only step preserved data and fallback; the later approved deletion is tracked below. Validation:
`ansible-playbook ansible/site.yml --limit prometheus --tags server_image_cleanup --check --diff -e server_legacy_image_cleanup=true`
- [x] Complete explicitly approved old-data and Compose fallback removal on 2026-10-03.
Backup paths and mount dependencies were reconciled before deletion; repeat cleanup changed
nothing. The normal Compose/template/helper check did not recreate retired files.
A separately approved manual export/pull published `20261003T112906Z`; checksum and isolated
SQLite restore passed with ten proxy hosts and both Quadlet definitions. NPM, primary HTTPS,
WireGuard, SSH proxy and backup timer remained healthy; existing backup archives were preserved.
- [x] Retire the unused secondary Gitea hostname `git.ov-ad3410.infomaniak.ch`
on 2026-10-03. Its NPM Proxy Host was already soft-deleted and had no
associated certificate. Its Ansible domain and runtime override were removed;
nginx -t and reload passed without restarting NPM. Primary HTTPS returned 200
with valid TLS. At that step only `git.fscotto.duckdns.org` remained declared;
the subsequent domain transition and operator-confirmed cleanup are tracked above.
- [ ] Observe the first scheduled export and Atlas pull after the cutover; the manual end-to-end
cycle passed, but the next unattended cycle has not yet occurred.
## Cerberus Management Node (Deferred)
`cerberus` is postponed until the office in the new house is physically set up. It is not an inventory
host and this section is a design and implementation backlog, not authorization to provision it early.
The planned node is a Lenovo ThinkCentre M700 Tiny with an Intel Core i3-6100T, 8 GB RAM, a 256 GB SSD,
and native 1 Gbps Ethernet. It will connect to a multi-input KVM switch using a passive DisplayPort-to-HDMI
cable, sharing the monitor and peripherals with Ikaros. Fedora Sericea (immutable Fedora with the Sway
Wayland compositor) is the intended OS. Cerberus is an isolated management plane: a dedicated Toolbox
environment will run Ansible for future `uranus` cluster provisioning. Rootless Podman will host Grafana,
Prometheus, and Loki. The 256 GB local SSD is the hot tier retaining metrics and logs for 30 days; scheduled,
validated exports of older historical data will use a dedicated Atlas NFS dataset as cold storage.
### Implementation plan
- [ ] Confirm the office, KVM switch, passive DisplayPort-to-HDMI path, shared monitor/peripherals, and native
1 Gbps Ethernet are physically operational before adding Cerberus to inventory.
- [ ] Install and update Fedora Sericea with Sway; document the immutable-host lifecycle and keep host changes
declarative rather than treating the base OS as a mutable workstation.
- [ ] Model Cerberus as its own host with independent platform, role, desktop, network, and storage inputs;
do not repurpose Ikaros variables or make it a Uranus cluster member.
- [ ] Provision an isolated Toolbox-based Ansible controller with the required collections and a reproducible
project checkout; define its least-privilege SSH access, known-host handling, and Vault workflow without
storing secrets in the image or repository.
- [ ] Define the explicit Uranus provisioning workflow from Cerberus, including inventory boundaries,
validation-only runs, and separate approval for any destructive cluster operation.
- [ ] Design rootless Podman/Quadlet services for Grafana, Prometheus, and Loki, including persistent local
state, service ownership, LAN exposure/authentication, resource limits, updates, and backups.
- [ ] Size and enforce a 30-day local hot-retention policy for metrics and logs on the 256 GB SSD; validate
actual disk growth and alert before capacity exhaustion.
- [ ] Create and validate a dedicated Atlas NFS cold-storage dataset and least-privilege export for Cerberus;
do not use a broad existing share or couple it to unrelated Atlas application state.
- [ ] Implement scheduled, idempotent exports of data older than 30 days to the Atlas NFS cold tier, with
locking, capacity checks, integrity verification, retention rules, failure monitoring, and a tested restore.
- [ ] Validate management-plane recovery: rebuild Cerberus, restore observability history from Atlas, and
confirm that Uranus provisioning can resume without depending on unreproducible local state.
## Workstation / Windows Notes
- Native Linux workstation hosts can combine `workstation_host_linux` with an OS-specific dev group.
- `deadalus-fedora` keeps GNOME managed settings in `ansible/inventory/host_vars/deadalus-fedora.yml`.
- Ubuntu workstation follow-up work is still open around YubiKey/GPG/SSH-FIDO2 package verification, GPG signing setup on the YubiKey, and evaluating `ed25519-sk` SSH key generation.
- `workstation_host_windows` runs with `gather_facts: false` and validates PSRP settings plus `windows_package_backend` before role execution.
- Windows taskbar pins are driven by `windows_taskbar_pins` in `ansible/inventory/group_vars/workstation_host_windows.yml`; validate identifiers from a real Windows session before changing them.
## Coding Agent Notes
- Shared agent definitions and lifecycle flags live in `ai_agents` in `ansible/inventory/group_vars/all.yml`.
- Shared agent packages live in `ai_agents_npm_packages` in `ansible/inventory/group_vars/all.yml`.
- Shared agent dotfiles live in `ai_agents_dotfiles`; rendered configs live in `ai_agents_templates`.
- Every `ai_agents.<agent>` entry has independent `install_enabled`, `deploy_enabled`, and `uninstall_enabled` flags. Installation and removal must not both be true for the same agent; the common pre-task fails before changes when they conflict.
- Fedora, Void desktop, and WSL workstation profiles consume the shared agent definitions; do not duplicate package entries in profile-specific vars. IBM Bob on the workstation follows its own flags.
- WSL (`deadalus`) installs Claude Code, Codex and the Cline CLI; every other managed agent (including IBM Bob) is disabled and selected for removal through host overrides. `cline_deploy_enabled: true` also keeps Cline's cross-tool AGENTS pointer, global rules, and shared `~/.config/ai` context deployed on the host for the ecaas/cdp devcontainer bind mounts. Existing user state remains untouched.
- `dotfiles_common` deploys `ai_agents_dotfiles` and renders `ai_agents_templates` only when deployment is enabled.
- Removal is limited to the managed npm packages and `/usr/local/bin/bob`; never remove agent dotfiles, instructions, credentials, or user data.
- Desktop, native workstation, and WSL profiles consume the shared agent package list; do not duplicate package entries in profile-specific vars.
- `dotfiles_common` copies common dotfiles plus `ai_agents_dotfiles`, then renders `ai_agents_templates`.
- Keep `.config/ai/` as the common instruction source; update agent-specific entrypoints to reference it rather than duplicating instruction text.
- Fedora desktop AI apps (`chatgpt_desktop`, `opencode_desktop`, `cline_desktop`) follow the same lifecycle pattern through `ai_desktop_apps` in `ansible/inventory/group_vars/fedora.yml`; `install_enabled` and `uninstall_enabled` are independent per app and mutually exclusive (enforced by the common pre-task).
- ChatGPT opts in per host (`ikaros`, `nymph`); Cline opts in through `desktop_gnome` group vars; OpenCode Desktop keeps removal selected by default because Cline replaced it.
- Desktop-app removal deletes only managed artifacts: the RPM package (`chatgpt`, `opencode`, `cline`), ChatGPT's managed repository and signing key, and every cached download; it never removes user data, GNOME favorites, or the npm-managed CLI counterparts.
## Tooling Notes
- Install local tooling with:
- `python3 -m pip install ansible ansible-lint yamllint shellcheck-py`
- `ansible-galaxy collection install -r ansible/collections/requirements.yml`
- Required collections currently include `ansible.posix` and `community.general`.
- Required collections currently include `ansible.posix`, `ansible.windows`, `community.general`, and `community.windows`.
- `.yamllint` treats `line-length` as a warning at 120 chars and disables `document-start` and `comments-indentation`.
## When Updating Docs
- Keep `README.md` and `AGENTS.md` aligned when workflows materially change.
- If you add a new operational area, also add the narrowest validation command for it.
- Call out checks you could not run and any follow-up verification needed.
## Aegis Fedora IoT Notes
- `aegis` is a remote Fedora IoT Raspberry Pi 4 node. Bootstrap it once with
`ansible/bootstrap/aegis.bu`; the remaining configuration is applied by `profile_aegis` over SSH.
- Fedora IoT is immutable. Do not add it to mutable Fedora package or shared dotfile roles.
- `profile_aegis` owns the `nfs-utils` and `wireguard-tools` rpm-ostree layers and reports the required reboot
without initiating it. `wireguard_overlay` then configures Aegis as the WireGuard LAN gateway with persistent IPv4
forwarding, a scoped inter-zone policy, and source masquerading. It also owns rootful Podman Quadlets, persistent container
state under `/var/lib`, the Podman auto-update timer, LAN-restricted firewalld rules, and SSH hardening. Keep
`aegis_lan_subnet`, `aegis_adguard_web_port`, and `aegis_network_connection_uuid` host-specific;
SSH permits only the declared
key-authenticated users, never root or password authentication. Keep Apple IDs and other
credentials in Vault and use `no_log` for their rendering.
- `aegis_adguard_web_port` defaults to `80`. The initial AdGuard Home wizard port `3000` is intentionally unmanaged: open and close it manually only while
completing initial setup. Disable the local systemd-resolved stub through `profile_aegis` before
AdGuard binds port 53; keep
`/etc/resolv.conf` linked to `/run/systemd/resolve/resolv.conf`. LAN clients may use AdGuard, but
Aegis must use the independent upstream DNS declared by `aegis_host_dns_servers` so Greenboot does
not depend on the AdGuard container during startup.
- Aegis iCloudPD has been retired and is no longer managed by this role. Its service, Quadlet,
data, and MFA state were removed with the operator's explicit authorization.
## Project Devcontainer Generator
- `cmd/devcontainer/` generates standalone per-project language configurations;
it does not replace existing deadalus ecaas/cdp provisioning or remove host tools.
- Keep shared Git/agent behavior documented in `docs/project-devcontainers.md`.
- Focused validation: `go -C cmd/devcontainer test ./...`.
- Real engine builds, host credential forwarding and Fedora SELinux/Podman checks
require target-host validation; do not report generator tests as runtime evidence.
- `devcontainer_generator` builds the CLI natively on Fedora graphical desktops
and development workstations and installs it in `~/.local/bin/devcontainer`.
Validate with `ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator --check --diff`;
check mode skips compilation and binary installation explicitly.

View File

@@ -1,869 +0,0 @@
# Infra — Personal Infrastructure as Code
> **English version:** [README.md](README.md)
Questo repository contiene la configurazione **Infrastructure as Code (IaC)** utilizzata per gestire e mantenere allineate diverse macchine personali tramite **Ansible**.
L'obiettivo è avere **una singola fonte di verità** per:
- configurazione delle macchine
- pacchetti installati
- servizi di sistema
- configurazioni utente (dotfiles)
Il repository consente di gestire più sistemi operativi e profili macchina mantenendo una struttura modulare, riproducibile e idempotente.
---
# Architettura del progetto
```text
infra/
├── ansible/
│ ├── ansible.cfg
│ ├── site.yml
│ ├── inventory/
│ │ ├── hosts.yml
│ │ ├── group_vars/
│ │ └── host_vars/
│ ├── templates/
│ └── roles/
│
├── dotfiles/
│ ├── common/
│ ├── desktop/
│ ├── fedora/
│ ├── server/
│ ├── workstation/
│ ├── workstation_dev_wsl/
│ └── nymph/
│
├── scripts/
├── secrets/
├── README.md
└── README.it.md
```
Il repository è diviso in due componenti principali:
| Componente | Scopo |
| ---------- | -------------------------------------- |
| ansible | provisioning e configurazione macchine |
| dotfiles | configurazioni utente versionate |
---
# Macchine gestite
Il repository modella attualmente host Fedora/GNOME, una workstation Fedora WSL, un server Rocky
Linux 9 e un NAS Rocky Linux 9. La composizione resta separata in assi indipendenti:
```text
common user environment
+ host-specific platform
+ role-specific software
+ independently selectable desktop
+ host hardware overrides
```
Matrice target:
| Host | Platform | Role | Desktop |
| ------------ | -------- | -------------------- | ------- |
| ikaros | Fedora | Personal workstation | GNOME |
| nymph | Fedora | Desktop laptop | GNOME |
| deadalus | Fedora WSL | Workstation dev | — |
| prometheus | Rocky Linux | Server | — |
| atlas | Rocky Linux | NAS | — |
Regola operativa:
```text
ikaros must be boring
nymph is allowed to break
```
`ikaros` usa Fedora Workstation/GNOME come desktop personale stabile; `nymph` usa lo stesso
target Fedora Workstation/GNOME come laptop. I gruppi legacy `void` e `desktop` restano alias di
compatibilita per eventuali host Void futuri mentre i nuovi assi sono
`platform_*`, `role_*` e `desktop_*`.
Nota sullo stato attuale del playbook principale:
- `ansible/site.yml` applica oggi in automatico Fedora/GNOME su `ikaros` e `nymph`
- `ansible/site.yml` applica il profilo Fedora WSL alla workstation `deadalus`
- `ansible/site.yml` applica il profilo server Rocky a `prometheus` con DNF, systemd, dotfiles server e firewalld
- `ansible/site.yml` applica il profilo NAS Rocky su `atlas` tramite SSH remoto
## Nodo pianificato e posticipato: Cerberus
`cerberus` e un nodo di management **posticipato**, in attesa dell'allestimento
fisico dell'ufficio nella nuova casa. Non e ancora presente nell'inventory e non
esistono ruoli o playbook che lo prendano come target.
L'hardware previsto e un Lenovo ThinkCentre M700 Tiny (Intel Core i3-6100T,
8 GB di RAM e SSD da 256 GB) con Ethernet nativa a 1 Gbps. Condividera monitor
e periferiche di Ikaros tramite uno switch KVM a ingressi multipli, usando un
cavo passivo DisplayPort-HDMI per il collegamento video. Il sistema operativo
previsto e Fedora Sericea, la variante Fedora immutabile con compositor Wayland
Sway.
Cerberus sara un management plane isolato: Ansible verra eseguito in un ambiente
Toolbox dedicato per il provisioning del futuro cluster `uranus`, anziche da
Ikaros o da un host non gestito. Lo stack di osservabilita rootless Podman
eseguira Grafana, Prometheus e Loki. L'SSD locale sara l'hot storage, con
metriche e log conservati per 30 giorni; esportazioni programmate trasferiranno
i dati storici piu vecchi su un dataset Atlas montato via NFS come cold storage.
Il piano di implementazione, con prerequisiti espliciti, e in `AGENTS.md`.
## Desktop
Target operativi:
- `ikaros`: Fedora Workstation + GNOME, desktop personale stabile/floating.
- `nymph`: Fedora Workstation + GNOME, laptop desktop con dotfiles desktop condivisi e GNOME lasciato al default Fedora.
Il profilo Void desktop resta disponibile come modello riutilizzabile per host
futuri e usa esclusivamente `desktop_environment: minimal`: Sway e il default,
mentre Niri si seleziona con il gruppo `desktop_niri`. GNOME e disponibile solo
sui target Fedora tramite `desktop_gnome`.
Lo stato attuale del profilo desktop include, tra le altre cose:
- dotfiles comuni e desktop
- sessioni Sway e Niri per eventuali host Void in modalita `minimal`
- `emptty` con default host-specific in modalita `minimal` e session file Wayland per `sway`
- pacchetti Void Linux e servizi runit; le liste pacchetti Void desktop sono separate per criterio:
- `void_packages_base` per il runtime sistema (init, kernel, audio core, networking, firewall, hw daemons)
- `desktop_common_packages` per l'infrastruttura condivisa
- `desktop_minimal_packages` per applicazioni GTK e `emptty`
- `desktop_sway_packages` per i binari specifici della sessione Sway
- `turnstile` per i servizi utente Void, incluso `ssh-agent`
- `ssh-agent` con socket stabile condiviso tra shell e SSH in `~/.local/state/ssh-agent/socket`
- Emacs usa una sola configurazione orientata a Org e authoring, condivisa da desktop Fedora/GNOME e workstation; Vim resta l'editor di sviluppo
- `tmux` con plugin gestiti da TPM al bootstrap del profilo desktop
- Flatpak con remoto Flathub
- GNOME Keyring e `udiskie` nella modalita minimale
- multi-monitor Void: sotto Sway è gestito da `kanshi`
---
## Workstation
La workstation `deadalus` usa Fedora in WSL sulla macchina Windows omonima, senza runtime Flatpak o Snap.
Il profilo è pensato per sviluppo e lavoro.
Nel modello Ansible usato qui, un singolo inventory host puo appartenere intenzionalmente a piu gruppi e quindi ricevere piu play nello stesso run: l'associazione non e `1 host = 1 play`, ma `host + gruppi = layering finale`.
Il profilo workstation e agganciato al playbook principale tramite:
- layer dev Fedora
- layer WSL dedicato per sviluppo con `systemd`
Lo stato attuale del profilo workstation include:
- installazione pacchetti base Fedora via dnf
- installazione e configurazione di Docker dal repository ufficiale
- gestione dei dotfiles workstation e rendering dei template dev condivisi
- preparazione di Fedora WSL con `systemd` per il toolchain di sviluppo
- attivazione del firewall `firewalld` sui target Fedora che dichiarano regole host-specifiche
Workflow WSL previsto:
1. avviare Fedora WSL almeno una volta e completare la creazione dell'utente Linux
2. installare Ansible dentro la distribuzione WSL
3. lanciare il playbook dalla distribuzione su `deadalus` per configurare l'ambiente dev locale
4. usare VS Code con le estensioni Remote (`WSL`, `SSH`, `Dev Containers`) dal lato Windows
Le applicazioni Windows sono installate e gestite manualmente; il profilo WSL non installa componenti di remoting Python per esse.
---
## Server
La migrazione dei servizi pubblici a `fscotto.co`, la gestione Ansible
degli URL Gitea e i passaggi ancora aperti per ritirare DuckDNS sono in
[`docs/domain-fscotto-co.md`](docs/domain-fscotto-co.md).
Sistema operativo:
- Rocky Linux 9
Configurazione:
- nessun ambiente grafico
Macchina:
- `prometheus`
Profilo orientato a servizi server e gestione di dotfiles dedicati.
Lo stato attuale del profilo server include:
- installazione pacchetti Rocky via DNF, EPEL e CRB
- installazione di Podman e podman-compose
- abilitazione dei servizi systemd dichiarati in inventory/group vars
- copia dei dotfiles server e rendering del Quadlet rootful `prometheus-npm.service` per Nginx Proxy
Manager; il vecchio fallback Compose è stato rimosso con autorizzazione esplicita
- attivazione di firewalld con SSH, Cockpit (`9090/tcp`), HTTP e HTTPS abilitati
- Syncthing escluso dal profilo server Rocky
Il 2026-10-03 la pulizia opt-in autorizzata ha rimosso dati e immagini precedenti di Gitea,
Navidrome e PostgreSQL, directory obsolete vuote, helper finale Gitea e fallback Compose NPM.
I servizi migrati restano su Atlas. `server_legacy_stack_retired: true` evita che i normali task
ricreino i residui; la cancellazione richiede `--tags server_legacy_cleanup` e
`-e server_legacy_cleanup=true`. NPM attivo e archivi di backup restano intatti.
Export, pull Atlas e restore SQLite isolato post-pulizia sono riusciti; il primo ciclo automatico
resta da osservare. Evidenze e confini del recovery:
[`docs/prometheus-npm-quadlet.md`](docs/prometheus-npm-quadlet.md).
Nginx Proxy Manager pubblica solo `80/tcp` e `443/tcp`; la sua interfaccia di amministrazione e
associata a `127.0.0.1:81` ed e raggiungibile da Ikaros o Nymph con l'alias Bash `npm-tunnel`.
Nextcloud resta disabilitato e il profilo non crea directory `/srv/nextcloud`.
La fase 1 su Atlas non modifica i dati persistenti NPM. I proxy host NPM usano gli upstream LAN
`http://192.168.178.55:4533` per Navidrome e `http://192.168.178.55:8384` per la GUI Syncthing;
Prometheus li raggiunge attraverso Aegis come gateway WireGuard. Solo la GUI web di Syncthing usa
NPM; il traffico di sincronizzazione resta sulle porte native esposte sulla LAN dichiarata.
Mantenere l'autenticazione Syncthing e una policy di accesso NPM adeguata.
### Rimozione DuckDNS
Il supporto DuckDNS è stato rimosso dal profilo server: non restano task, template,
variabili o flag di abilitazione. Prometheus usa IP statico e `fscotto.co`.
Updater locale, log e cron erano già stati rimossi. Nome/account DuckDNS esterni
ed eventuale token cifrato esistente restano invariati per un possibile uso futuro.
Utente del profilo server:
- il profilo usa `server_username`, `server_user_group` e `server_user_home` definiti in `ansible/inventory/group_vars/server.yml`
- per default `server_username` eredita `username`, ma puo essere sovrascritto per tutti gli host server via inventory oppure a runtime con extra vars
- esempio override da CLI:
```bash
ansible-playbook ansible/site.yml --limit prometheus -e server_username=myuser
```
- se necessario puoi passare anche:
```bash
ansible-playbook ansible/site.yml --limit prometheus -e server_username=myuser -e server_user_group=mygroup -e server_user_home=/srv/myuser
```
---
## NAS
`atlas` è un NAS Rocky Linux 9 raggiunto via SSH. Normalmente il pool esiste già e il profilo gestisce
solo i dataset figli. La creazione iniziale del RAIDZ2 richiede esplicitamente `atlas_create_pool=true`
e quattro percorsi `/dev/disk/by-id/...` verificati in `atlas_zpool_disks`. Il ruolo non partiziona,
forza, distrugge, ripristina né modifica il layout vdev di un pool esistente. I client Linux usano NFSv4,
quelli Windows/WSL SMB; l'accesso è limitato alla LAN configurata.
Per il primo avvio servono `vault_atlas_admin_password_hash`, `vault_atlas_samba_password` e
`vault_atlas_immich_db_password`; il primo è un hash compatibile con `/etc/shadow`, non una password
Cockpit in chiaro. Il bootstrap usa l'amministratore preesistente:
```bash
ansible-playbook ansible/site.yml --limit atlas \
-e atlas_connection_username=<existing-admin>
```
Le esecuzioni successive usano `atlas_admin_username`. Storage, condivisioni e firewall LAN sono
abilitati; prima dell'applicazione verificare pool, mountpoint, subnet e zona firewalld. La creazione
del pool è protetta da un gate esplicito e avviene solo se è assente. Atlas non fa più parte della VPN
WireGuard: la vecchia interfaccia è stata ritirata manualmente dopo la verifica del collegamento tra
Prometheus e Aegis. Le chiavi SSH autorizzate sono in file separati sotto
`~/.ssh/authorized_keys.d/`. `atlas_manage_media_stack` resta disabilitato finché `/dev/dri`, percorsi
dei container e segreto del database Immich non sono validati.
Sotto `zpool` Atlas crea `archive` (SMB), `services/data` con i dataset applicativi
`services/data/navidrome` e `services/data/syncthing`, `media`, `media/music`, `media/photobook` e
`backup/hosts/prometheus`. Archivio e applicazioni usano `zstd`; media, Syncthing e backup host usano
`lz4`. `backup` ha una riserva di `500G` che copre i discendenti. SELinux targeted è persistente;
l'eventuale riavvio necessario viene segnalato, non eseguito. Atlas assegna l'interfaccia primaria
alla zona firewalld gestita, rifiuta redirect e source route, registra i martian, mantiene il reverse-path
filter loose e disabilita il forwarding IPv4. SSH consente soltanto l'amministratore dichiarato con
chiave pubblica: root, password, agent forwarding e remote forwarding sono disabilitati, mentre il
forwarding locale resta disponibile per i tunnel amministrativi. SMB3 espone `Archive` agli account
autorizzati da Vault sulla LAN, solo su TCP/445 con cifratura e firma obbligatorie. NFSv4 espone
soltanto `media/photobook` all'IP di Aegis su TCP/2049, con `all_squash` verso UID/GID `1100`.
L'account di sistema `immich` usa UID/GID `1100`, non ha shell di login né gruppo `wheel` e riceve i
gruppi `video` e `render`. Lo stack Immich futuro prevede Quadlet rootful per Server, ML, cache,
PostgreSQL e NPM su una rete Podman comune. Immich gira come `1100:1100`, Server e ML ricevono
`/dev/dri` e Photobook è montato in sola lettura su `/external/photobook`. NPM pubblica `80` e `443`;
l'interfaccia amministrativa resta su `127.0.0.1:81`, raggiungibile via tunnel SSH.
Atlas ospita temporaneamente Navidrome e Syncthing rootless fino alla sostituzione con Uranus. I
servizi sono inizializzati **ex novo**, senza migrare lo stato precedente, rispettivamente sotto
`/zpool/services/data/navidrome` e `/zpool/services/data/syncthing`; la musica in
`/zpool/media/music` è stata popolata separatamente da `/zpool/archive/Music` il 2026-09-30;
Navidrome ha completato la scansione. Il timer rootless `atlas-music-sync.timer` copia i file nuovi
o modificati ogni giorno alle 00:45 Europe/Rome, senza eliminare quelli presenti solo nella
destinazione; entrambi i dataset ZFS devono essere montati. La prima esecuzione schedulata è
riuscita il 2026-10-02. Alcune playlist originali contengono
ancora vecchi percorsi Windows. I servizi sono vincolati all'indirizzo LAN di Atlas
(`192.168.178.55`), mai a WireGuard. `wireguard_overlay` collega invece Prometheus (`10.0.0.1`)
e Aegis (`10.0.0.2`): le chiavi private restano sui rispettivi host e Ansible scambia solo le pubbliche.
Prometheus apre `51820/udp`; Aegis inoltra soltanto il traffico overlay→LAN dichiarato e applica
source NAT, evitando interfacce VPN su Atlas/Uranus e route statiche sul router. Navidrome (`4533/tcp`)
e la GUI Syncthing (`8384/tcp`) ammettono solo Aegis, mentre le porte native Syncthing sono limitate
alla LAN. Dopo la verifica dei servizi, configurare manualmente i Proxy Host NPM verso
`http://192.168.178.55:4533` e `http://192.168.178.55:8384`. Il peer Prometheus include la LAN
negli `AllowedIPs`; aggiungere la VIP Uranus quando esisterà. Dopo il reload di firewalld, Ansible
ricarica le reti Podman rootful di Prometheus per conservare DNS e connettività del proxy.
La migrazione Gitea da Prometheus ad Atlas è descritta in
[`docs/atlas-gitea-migration.md`](docs/atlas-gitea-migration.md). Gitea usa un Quadlet rootless
di `admin` su un dataset dedicato; l'immagine derivata mantiene UID/GID 1000 ma chiama l'utente
interno `gitea`. NPM resta su Prometheus e l'HTTPS pubblico primario serve Atlas. L'SSH pubblico
su TCP/2222 autentica la chiave `ikaros` e un `git ls-remote` è riuscito; l'operatore ha
confermato pull e push SSH. Login e scrittura Git via HTTPS sono stati confermati il 2026-10-03. I dati sorgente restano
conservati su Prometheus senza avviarne il vecchio container.
Validare il gateway con:
```bash
ANSIBLE_LOCAL_TEMP=/tmp/ansible-local \
ansible-playbook ansible/site.yml --limit prometheus,aegis --tags wireguard --check --diff
```
La prima esecuzione reale WireGuard deve includere entrambi i peer. Se Aegis ha appena installato il
layer `wireguard-tools`, riavviarlo manualmente e rieseguire senza `--check`: il ruolo attende un
handshake effettivo.
Gli snapshot ZFS ricorsivi coprono l'intero pool: 24 orari al minuto 05, 30 giornalieri alle 00:15,
8 settimanali la domenica alle 01:00 e 12 mensili il primo giorno alle 02:00. La retention elimina
solo gli snapshot con prefisso gestito `atlas-auto` e non esegue rollback. Lo scrub OpenZFS mensile è
previsto la prima domenica alle 03:00; il timer settimanale incompatibile è disabilitato. Il primo
snapshot orario ricorsivo è riuscito e la pulizia pianificata della retention è stata osservata il
2026-09-30. Il primo scrub mensile richiede ancora una verifica a runtime.
```bash
ANSIBLE_LOCAL_TEMP=/tmp/ansible-local \
ansible-playbook ansible/site.yml --limit atlas --tags snapshots,scrub --check --diff
```
Il backup Borg cifrato usa il sub-account Hetzner `u660064-sub1`, il repository relativo `./borg-data`
e Borg remoto 1.4 su SSH porta 23. La chiave ED25519 del server è fissata; una chiave client dedicata
appartiene all'account `borg`, bloccato e senza login, sudo o gruppi supplementari. La chiave privata
resta in `/etc/atlas-borg`; la passphrase proviene da `vault_atlas_borg_passphrase` ed è resa in un
file `0600`. Solo il wrapper root crea snapshot e mount; avvia il client come `borg` con il minimo
accesso temporaneo in lettura, senza concedergli gestione ZFS o sudo.
Il backup giornaliero parte alle 04:30 con un ritardo casuale fino a 30 minuti. Crea uno snapshot ZFS
ricorsivo temporaneo e ricostruisce tutti i dataset sotto `/zpool` in un albero di bind mount in sola
lettura, per inserirli in un unico archivio coerente. Il wrapper smonta ricorsivamente l'albero privato;
un helper `ExecStopPost` mirato rimuove eventuali mount dello snapshot nel namespace host e lo snapshot
temporaneo dopo l'uscita del processo. Borg conserva 30 archivi giornalieri, 8 settimanali e 12
mensili, poi compatta il repository. Il controllo completo di metadati e repository si svolge il 15
di ogni mese alle 06:00. Le operazioni usano un lock comune, journal e retry systemd limitati. Le
nuove esecuzioni riportano al massimo una riga di avanzamento al minuto: percentuale **stimata**,
dataset, file elaborati e byte originali/compressi/deduplicati. Il denominatore è la somma dei
`logicalreferenced` ZFS dello snapshot, non un totale Borg: può superare il 100% e non comprende
retention, compattazione o controlli. Le righe di progresso non riportano i nomi dei file; eventuali
warning possono farlo. Seguire il job con `sudo journalctl -fu atlas-borg-backup.service`; modifiche
all'helper non cambiano un'esecuzione già avviata.
Attivazione iniziale esplicita:
1. Inserire una passphrase unica in `secrets/vault.yml` con `ansible-vault edit`.
2. Generare e mostrare solo la chiave pubblica con
`ansible-playbook ansible/site.yml --limit atlas --tags borg_key`.
3. Installarla nel sub-account Hetzner, poi applicare con
`ansible-playbook ansible/site.yml --limit atlas --tags packages,borg`.
4. Copiare `secrets/recovery/atlas-borg-repokey.export` su un supporto davvero offline: la copia
locale ignorata da Git non è di per sé un backup offline.
Il ruolo inizializza solo un repository `repokey` assente, non accetta password SSH né host key non
fissate e non avvia manualmente il primo backup. Validazione:
```bash
ANSIBLE_LOCAL_TEMP=/tmp/ansible-local \
ansible-playbook ansible/site.yml --limit atlas --tags packages,borg --check --diff
```
L'attivazione iniziale è riuscita: backup e controllo del repository, restore completo in una
directory temporanea confrontato con l'albero `Archive`, esportazione offline della chiave di recupero
e pulizia di snapshot/mount temporanei. Il 2026-09-25 un test separato da snapshot ZFS giornaliero ha
copiato un file di `/zpool/archive` in `/var/tmp`, verificando contenuto, proprietario, modalità,
mtime e ACL POSIX; copia e mount temporanei sono stati rimossi senza interrompere Borg. Non è un test
di ripristino dell'intero dataset.
L'archivio del pool popolato del 2026-09-29 ha richiesto 1 h 32 min per 2,18 TB originali / 2,04 TB
compressi, con 13,49 GB di dimensione deduplicata. Retention e compattazione sono riuscite, ma un
errore di permessi su `RuntimeDirectory` ha impedito la pulizia dello snapshot dopo il job. Dopo la
correzione, l'archivio incrementale del 2026-09-30 è terminato in circa 22 secondi, ha rimosso lo
snapshot residuo e quello corrente ed è terminato con stato 0. Il monitor ha rilevato il 37% della
quota Storage Box utilizzata. Questi risultati non predicono durata o compressione dei prossimi run.
Il backup USB offline è distribuito come **servizio solo manuale** (`atlas_manage_usb_backup: true`):
Ansible non formatta, sblocca, monta né avvia automaticamente il disco. Il disco esistente è stato
verificato in sola lettura il 2026-09-23: UUID LUKS `577b3c43-ea37-4611-81a9-39d555cdfbd4`,
UUID ext4 interno `758e2d2e-a427-4797-aad9-39c3a9f17c7e`, mapper `zpool-backup`. All'ispezione
era montato in `/mnt/zpool-backup`; il servizio richiede invece che il mapper **non sia montato** prima
dell'avvio. Se serve, `systemd-ask-password` chiede interattivamente la passphrase LUKS tramite
l'agente di `systemctl start` e la passa direttamente a `cryptsetup`, senza salvarla, esporla negli
argomenti o memorizzarla nella cache. Lo script monta il disco privatamente, crea uno snapshot ZFS
ricorsivo, copia tutti i dataset in `atlas/snapshots/<timestamp>/` con `rsync --link-dest`, verifica
con un dry-run basato sui checksum, aggiorna atomicamente `atlas/latest`, smonta e chiude LUKS. Un
errore non sostituisce `latest` né cancella versioni complete precedenti. Borg e USB possono operare
contemporaneamente su snapshot distinti, ma la lettura concorrente può ridurre il throughput.
La copia USB conserva le ACL ma non gli attributi estesi generici, compreso `security.selinux`: la
policy della destinazione deve ricreare le etichette dopo un restore. Per un percorso esplicito:
```bash
ansible-playbook ansible/site.yml --limit atlas --tags restorecon \
-e '{"atlas_restorecon_paths":["/zpool/archive"]}'
```
Il task accetta solo percorsi sotto la radice del pool Atlas, esegue `restorecon -RFv` solo su quelli
indicati ed è altrimenti inattivo; non va lanciato sull'intero pool durante i run ordinari. Le vecchie
versioni USB non vengono eliminate automaticamente senza una retention deliberata. Il controllo di
capacità include il trasferimento stimato e una riserva libera di 10 GiB. Dopo un backup riuscito,
scollegare fisicamente il disco per renderlo davvero offline.
Validare la configurazione senza avviare il backup e, separatamente, un eventuale relabel pianificato:
```bash
ANSIBLE_LOCAL_TEMP=/tmp/ansible-local \
ansible-playbook ansible/site.yml --limit atlas --tags usb_backup,usb_reminder --check --diff
ansible-playbook ansible/site.yml --limit atlas --tags restorecon --check \
-e '{"atlas_restorecon_paths":["/zpool/archive"]}'
```
Prima dell'avvio manuale smontare in sicurezza `/mnt/zpool-backup`, se ancora montato. Con il mapper
chiuso, `sudo systemctl start atlas-usb-backup.service` chiede la passphrase e avvia il backup; né la
password LUKS né un keyfile vanno in Ansible. Seguire con
`sudo journalctl -fu atlas-usb-backup.service`. **Non esiste un timer di backup USB.** Soltanto
`atlas-usb-reminder.timer` è schedulato il primo sabato del mese alle 10:00 `Europe/Rome`: invia un
promemoria al notifier 45Drives Houston, senza avviare il backup. Un test manuale ha prodotto una
notifica in 45Drives Alerts, **non un'email**; il log conferma l'invio della notifica, non la consegna
di posta. Il primo evento pianificato era il 2026-10-03 alle 10:00 CEST. Controllare timer e risultato
con `systemctl list-timers atlas-usb-reminder.timer` e in 45Drives Alerts.
Il primo tentativo USB del 2026-09-23 fallì su `security.selinux` e, dopo l'interruzione, lasciò
snapshot e mapper aperti. Applicato il filtro rsync, furono rimossi lo snapshot fallito, il mapper
smontato e lo stato failed; non rimase una copia valida di quel tentativo. Un run del 2026-09-24
pubblicò una versione verificata ma fallì nella distruzione dello snapshot a causa di mount
`.zfs/snapshot` aperti nel namespace host. Dopo la pulizia non forzata, è stato aggiunto un helper
`ExecStopPost` mirato e testato con uno snapshot usa-e-getta. Un run successivo del 2026-09-24 ha
verificato i checksum, pubblicato la versione ed è terminato con successo: mapper chiuso, nessuno
snapshot USB temporaneo e pool sano. Il 2026-09-25 un test di restore indipendente ha aperto il disco
in sola lettura, montato ext4 con `ro,noload`, copiato un file di 5.707.945 byte da `atlas/latest` in
una directory vuota sotto `/var/tmp` e confrontato contenuto, proprietario, modalità, dimensione,
mtime e ACL POSIX. Il test ha rimosso copia e mount temporanei, chiuso LUKS e lasciato il pool sano
mentre Borg continuava. È un test su file, non un esercizio completo di disaster recovery.
Il monitoraggio Atlas è eseguito ogni 30 minuti da `atlas-health-monitor.timer`. Sonde in sola
lettura controllano stato/errori del pool e dei vdev, scrub/resilver, SMART dei quattro dischi del
pool e dell'NVMe di sistema, temperature dei dischi e CPU, spazio di sistema/pool/snapshot, crescita
di `zpool/backup` e quota Hetzner tramite `df -m` via SSH con l'account `borg` e la chiave fissata.
La query remota non apre il repository Borg né il suo lock. Gli alert di crescita richiedono una
baseline di circa 24 ore. Sono controllati anche attivazione e freschezza dei timer; hook systemd
`OnFailure` segnalano errori di snapshot, scrub, Borg, USB, promemoria e monitoraggio. Il monitor non
riavvia Borg; avvisa solo se un run supera 14 giorni. Soglie e percorsi stabili dei dischi sono nelle
variabili host. Gli avvisi usano 45Drives Houston con deduplicazione; **la consegna email non è stata
verificata**. Il controllo live del 2026-09-25 non ha trovato problemi e ha inviato una notifica di
prova. Il 2026-09-30 il monitor ha rilevato zero problemi e una quota Storage Box occupata al 37%.
L'hook per i job falliti ora passa il nome letterale della unità systemd; l'espansione è stata
verificata senza inviare un falso allarme.
```bash
ansible-playbook ansible/site.yml --limit atlas --tags monitoring --check --diff
sudo /usr/local/libexec/atlas-health-monitor --dry-run
sudo journalctl -u atlas-health-monitor.service -n 100 --no-pager
systemctl list-timers atlas-health-monitor.timer
```
`--dry-run` non invia alert e non modifica lo stato del monitor. Un controllo reale si avvia con
`sudo systemctl start atlas-health-monitor.service`, senza avviare servizi di backup. Per una prova
etichettata di 45Drives Alerts usare
`sudo /usr/local/libexec/atlas-health-monitor --test-notification`.
### Timer systemd di Atlas
Tutti i dieci timer gestiti sono abilitati. Gli orari sono locali ad Atlas (`Europe/Rome`); Borg e
monitoraggio aggiungono il ritardo casuale indicato. Tutti hanno `Persistent=true`: un evento perso
viene recuperato quando il timer torna attivo.
| Timer | Pianificazione (`OnCalendar`) | Azione |
| --- | --- | --- |
| `atlas-zfs-snapshot-hourly.timer` | `*-*-* *:05:00` — ogni ora al minuto 05 | Snapshot ricorsivo orario e retention |
| `atlas-zfs-snapshot-daily.timer` | `*-*-* 00:15:00` — ogni giorno alle 00:15 | Snapshot ricorsivo giornaliero e retention |
| `atlas-zfs-snapshot-weekly.timer` | `Sun *-*-* 01:00:00` — domenica alle 01:00 | Snapshot ricorsivo settimanale e retention |
| `atlas-zfs-snapshot-monthly.timer` | `*-*-01 02:00:00` — primo giorno del mese alle 02:00 | Snapshot ricorsivo mensile e retention |
| `zfs-scrub-monthly@zpool.timer` | `Sun *-*-01..07 03:00:00` — prima domenica alle 03:00 | Scrub ZFS |
| `atlas-borg-backup.timer` | `*-*-* 04:30:00` — ogni giorno alle 04:30, più 0–30 min casuali | Backup cifrato offsite |
| `atlas-borg-check.timer` | `*-*-15 06:00:00` — giorno 15 alle 06:00, più 0–30 min casuali | Controllo repository Borg |
| `atlas-usb-reminder.timer` | `Sat *-*-01..07 10:00:00 Europe/Rome` — primo sabato alle 10:00 | Solo promemoria 45Drives Alerts |
| `atlas-health-monitor.timer` | `*:0/30` — ogni mezz'ora, più 0–5 min casuali | Controlli di salute in sola lettura |
| `atlas-prometheus-pull.timer` | `*-*-* 03:00:00 Europe/Rome` — ogni giorno alle 03:00 | Pull e verifica del backup preparato su Prometheus |
`atlas-usb-backup.service` **non ha timer** e va avviato manualmente. Il timer del fornitore
`zfs-scrub-weekly@zpool.timer` è disabilitato a favore dello scrub mensile. Il timer di preparazione
su Prometheus è attivo alle 02:00 Europe/Rome; il primo ciclo pianificato è riuscito il 2026-10-01.
Un export, pull e ripristino temporaneo post-cutover NPM Quadlet sono riusciti il 2026-10-03;
il primo ciclo pianificato dopo quel cutover resta da osservare. Durante un backup Borg attivo,
`systemctl list-timers` può mostrare `-` per il prossimo evento senza che il timer sia disabilitato.
Per vedere la pianificazione corrente: `systemctl list-timers --all` su Atlas.
Nextcloud è previsto come servizio temporaneo su Atlas prima di Uranus, ma solo dopo la validazione
della protezione dei dati: richiede storage applicativo, database e cache separati, segreti Vault,
pubblicazione solo tramite NPM e Aegis, procedure di backup, aggiornamento e migrazione. Non
distribuirlo prima di completare la checklist di protezione dei dati.
Atlas è la destinazione dichiarata per iCloudPD. Ansible gestisce dataset, Quadlet rootless e
`icloudpd.conf` privato con Apple ID dal Vault: foto in `/zpool/archive/Pictures/iCloudPD`,
stato in `zpool/services/data/icloudpd`. Il primo avvio è stato manuale; password e MFA restano
gestiti interattivamente, senza avvio automatico al boot. L'inizializzazione è stata completata e
il download iniziale di foto e video è terminato il 2026-10-03. Su Aegis
il servizio, il Quadlet e `/var/lib/icloudpd` sono stati rimossi e verificati; il playbook Aegis
non contiene più task iCloudPD. L'accesso SMB e il ripristino dai backup dei nuovi dati restano
da verificare. L'export NFS Photobook resta
invariato. Dettagli in [`docs/atlas-icloudpd-migration.md`](docs/atlas-icloudpd-migration.md).
Il primo ciclo pianificato del backup di Prometheus e una prova di disaster recovery a dimensione reale
restano da verificare. Il 2026-09-30 una VM Rocky isolata ha superato ricostruzione OS con Ansible,
import del pool RAIDZ2 fittizio e ripristino da snapshot; RPO 24 ore/RTO 72 ore restano obiettivi
provvisori, non tempi misurati. Dettagli e limiti sono in `docs/atlas-recovery.md`. Il backlog
prioritizzato è in `AGENTS.md`.
---
# Composizione della configurazione
Emacs è abilitato sui profili Fedora/GNOME e workstation; la configurazione canonica è distribuita da `dotfiles_common`, con Org in `~/Org/`, template versionati e export PDF/HTML/Markdown/DOCX/ODT. Per abilitarlo temporaneamente su un altro profilo:
```bash
ansible-playbook ansible/site.yml --limit <host> --tags emacs -e emacs_enabled=true
```
La configurazione finale di una macchina è ottenuta combinando più livelli.
```text
common configuration
+ platform configuration
+ role configuration
+ desktop configuration
+ host overrides
```
Esempi correnti:
```text
ikaros -> common + platform_fedora + role_personal_workstation + graphical_desktop + desktop_gnome + ikaros
nymph -> common + platform_fedora + graphical_desktop + desktop_gnome + nymph
deadalus -> common + platform_fedora + workstation_dev_fedora + workstation_dev_wsl + deadalus
```
Questo approccio consente di:
- mantenere configurazioni condivise
- applicare override specifici per host
- evitare duplicazioni
- riutilizzare il profilo Void corrente su un host futuro assegnandolo a
`platform_void + graphical_desktop + desktop_sway`
---
# Ruoli Ansible
I principali ruoli attualmente presenti sono:
| Role | Descrizione |
| ------------------------- | ----------------------------------- |
| base | configurazione base comune |
| packages_void | installazione pacchetti su Void |
| packages_fedora | installazione pacchetti su Fedora |
| packages_rocky | installazione pacchetti su Rocky Linux 9 |
| services_runit | gestione servizi runit |
| services_systemd | gestione servizi systemd |
| profile_desktop_common | bootstrap desktop Void condiviso |
| profile_desktop_gnome | dotfiles desktop condivisi per Fedora/GNOME |
| profile_desktop_sway | sessione desktop sway / SwayFX (Wayland) |
| profile_desktop_niri | sessione desktop Niri su Void (Wayland) |
| profile_desktop_host | override desktop specifici per host |
| profile_personal_workstation | layer stabile per workstation personale |
| profile_workstation_dev_common | configurazione dev workstation condivisa |
| profile_workstation_dev_wsl | configurazione WSL condivisa per sviluppo |
| profile_server | configurazione server |
| profile_atlas | configurazione NAS Rocky Linux 9 |
| profile_backend_phase1 | Navidrome e Syncthing rootless su Atlas |
| wireguard_overlay | overlay WireGuard Prometheus/Atlas |
| dotfiles_common | distribuzione dotfiles comuni |
| dotfiles | distribuzione configurazioni utente |
---
# Stato attuale del playbook principale
Il playbook `ansible/site.yml` e attualmente composto da blocchi per asse:
```text
all -> dotfiles_common
platform_void -> packages_void + services_runit
platform_void & graphical_desktop -> profile_desktop_common + profile_desktop_sway + profile_desktop_niri + profile_desktop_host
platform_fedora -> packages_fedora + services_systemd
platform_rocky -> packages_rocky + services_systemd
wireguard_overlay -> wireguard_overlay (dopo platform_rocky)
atlas -> profile_atlas
role_backend_phase1 -> profile_backend_phase1 (dopo atlas)
platform_fedora & role_personal_workstation -> profile_personal_workstation
platform_fedora & desktop_gnome -> profile_desktop_gnome
workstation_dev_fedora -> profile_workstation_dev_common
workstation_dev_wsl -> profile_workstation_dev_wsl (dopo platform_fedora + workstation_dev_fedora)
rocky_server -> dotfiles_common + profile_server (dopo platform_rocky)
```
Questo significa che, allo stato attuale:
- `ikaros` riceve Fedora Workstation/GNOME come target desktop personale stabile
- `nymph` riceve Fedora Workstation/GNOME come target laptop
- il profilo Void resta selezionabile tramite `platform_void + graphical_desktop` per host futuri
- `deadalus` riceve il profilo Fedora WSL tramite play dev dedicati
- il server Rocky (`prometheus`) e gestito con pacchetti, servizi, dotfiles server e firewalld
- il NAS Rocky (`atlas`) usa un pool ZFS gia esistente, condivisioni NFSv4/SMB limitate alla LAN e Cockpit/45Drives
- NPM è un Quadlet rootful su Prometheus, mentre Gitea, Navidrome e Syncthing sono Quadlet
rootless su Atlas; il fallback Compose server è stato rimosso
# Dotfiles
La directory `dotfiles/` contiene le configurazioni utente versionate.
```text
dotfiles/
├── common
├── desktop
├── server
├── fedora
├── workstation
├── workstation_dev_wsl
└── nymph
```
Le configurazioni sono applicate tramite Ansible e organizzate per livelli:
| Livello | Scopo |
| ------- | -------------------------------- |
| common | configurazioni condivise |
| profile | configurazioni per tipo macchina |
| host | override specifici |
---
# Requisiti
Per utilizzare il repository sono necessari:
- Python 3
- Ansible
- `ansible-lint`
- `yamllint`
- `shellcheck`
- collection definite in `ansible/collections/requirements.yml`
- accesso locale o SSH alle macchine target, in base a come e definito l'inventory
Installazione base:
```bash
python3 -m pip install ansible ansible-lint yamllint shellcheck-py
ansible-galaxy collection install -r ansible/collections/requirements.yml
```
Gestione segreti:
- il repository supporta il caricamento opzionale di `secrets/vault.yml`
- il repository supporta anche `secrets/vault.local.yml` per override locali non versionati
- `secrets/vault.yml.example` funge da template/esempio
- se `secrets/vault.yml` non e presente, il playbook continua comunque senza caricare variabili locali opzionali
- se `secrets/.vault_pass.gpg` esiste viene usato automaticamente per sbloccare i vault tramite `gpg`; in alternativa resta supportato `secrets/.vault_pass` come fallback legacy locale; se nessuno dei due file esiste Ansible richiede la password in modo interattivo
---
# Utilizzo
Eseguire il playbook principale:
```bash
ansible-playbook ansible/site.yml
```
Allo stato attuale questo comando:
- distribuisce i dotfiles comuni a tutti gli host
- per `platform_void` applica pacchetti Void e servizi runit
- per `platform_void + graphical_desktop` applica bootstrap desktop condiviso, sessioni Sway/Niri e override specifici per host
- per `platform_fedora` applica pacchetti Fedora e servizi systemd a `ikaros`, `nymph` e `deadalus`
- per `platform_fedora & role_personal_workstation` applica il layer personale a `ikaros`
- per `platform_fedora & desktop_gnome` applica il profilo GNOME a `ikaros` e `nymph`
- per `workstation_dev_wsl` applica i tweak WSL dopo il layer Fedora a `deadalus`, escludendo Flatpak e Snap
- per `platform_rocky` applica pacchetti Rocky e servizi systemd ad `atlas` e `prometheus`; quindi applica il profilo NAS ad `atlas` e il profilo server a `prometheus`
- non riavvia automaticamente il display manager
- carica `secrets/vault.yml` solo se presente
- carica `secrets/vault.local.yml` solo se presente, dopo `vault.yml`, cosi gli override locali hanno precedenza
Per validare prima di applicare:
```bash
ansible-playbook ansible/site.yml --syntax-check
ansible-playbook ansible/site.yml --limit ikaros,nymph --check --diff
ansible-playbook ansible/site.yml --limit ikaros --check --diff
ansible-playbook ansible/site.yml --limit nymph --check --diff
ansible-playbook ansible/site.yml --limit deadalus --check --diff
ansible-playbook ansible/site.yml --limit prometheus --check --diff
ansible-playbook ansible/site.yml --limit atlas --check --diff
ansible-lint ansible/site.yml
ansible-lint ansible/roles
yamllint ansible/
```
Per testare un override dell'utente server senza modificare l'inventory:
```bash
ansible-playbook ansible/site.yml --limit prometheus --check --diff -e server_username=myuser
```
Per validazioni piu mirate:
```bash
ansible-playbook ansible/site.yml --limit <host> --tags <tag1>,<tag2> --check --diff
ansible-playbook ansible/site.yml --limit <host> --start-at-task "<task name>" --check --diff
ansible-lint ansible/roles/<role>
yamllint ansible/path/to/file.yml
ansible-playbook ansible/site.yml --limit prometheus --tags server_legacy_cleanup --check --diff -e server_legacy_cleanup=true
ansible-playbook ansible/site.yml --limit atlas --tags storage,sharing,containers --check --diff
ansible-playbook ansible/site.yml --limit atlas --tags backend_phase1 --check --diff
ansible-playbook ansible/site.yml --limit atlas --tags music_sync --check --diff
```
## Tag supportati dal playbook
Per vedere l'elenco reale aggiornato dei tag disponibili:
```bash
ansible-playbook ansible/site.yml --list-tags
```
Allo stato attuale `ansible/site.yml` espone questi tag:
| Tag | Scopo | Ambito principale |
| --- | --- | --- |
| `always` | pre-task sempre eseguiti, inclusi caricamento vault e validazioni preliminari | common |
| `ai_agents` | installazione agenti AI condivisi e distribuzione del contesto condiviso (bootstrap, regole, memoria ChatGPT) | Fedora, WSL |
| `atlas` | account, storage, condivisioni e container Atlas | NAS Atlas |
| `backend_phase1` | Quadlet rootless Navidrome e Syncthing | NAS Atlas |
| `containers` | Quadlet rootful Atlas | NAS Atlas |
| `dotfiles` | distribuzione/configurazione dotfiles | tutti i profili |
| `dotfiles:common` | dotfiles comuni condivisi | common, workstation, server |
| `dotfiles:desktop` | dotfiles desktop | desktop Void, Fedora/GNOME |
| `dotfiles:host` | override host-specifici desktop | desktop Void |
| `dotfiles:server` | dotfiles dedicati al profilo server | server |
| `dotfiles:workstation` | dotfiles dedicati alle workstation | personal workstation, WSL |
| `emptty` | gestione display manager `emptty` | desktop Void |
| `display-manager` | gestione del display manager `emptty` | desktop Void |
| `emacs` | configurazione Emacs condivisa e dipendenze di authoring | desktop Fedora/GNOME e workstation |
| `fonts` | installazione font | Fedora |
| `fzf` | configurazione FZF | dotfiles comuni |
| `git` | configurazione Git e GPG desktop | Fedora/GNOME, desktop Void |
| `gnome` | configurazione host GNOME | Fedora/GNOME desktop |
| `immich` | account e Quadlet Immich | NAS Atlas |
| `sway` | sessione/configurazione sway / SwayFX (Wayland) | desktop Void |
| `niri` | sessione/configurazione Niri (Wayland) | desktop Void |
| `npm` | installazione pacchetti npm globali | Fedora/GNOME, desktop Void, WSL |
| `nvidia` | componenti NVIDIA desktop | desktop Void |
| `packages` | installazione e aggiornamento pacchetti | tutti i profili |
| `podman` | integrazione Podman Compose e Quadlet rootless | server |
| `portal` | configurazione xdg-desktop-portal | desktop Void |
| `services` | gestione servizi runit/systemd | tutti i profili |
| `sharing` | condivisioni NFSv4 e SMB3 | NAS Atlas |
| `storage` | dataset ZFS figli | NAS Atlas |
| `theme` | configurazione del tema GTK/Qt | desktop Void |
| `tmux` | configurazione e plugin tmux | desktop Fedora/Void, WSL |
| `vim` | configurazione Vim | dotfiles comuni |
| `wireguard` | overlay WireGuard Prometheus/Atlas | Prometheus, NAS Atlas |
| `wsl` | bootstrap e configurazione WSL | WSL |
Esempi pratici:
```bash
ansible-playbook ansible/site.yml --limit nymph --tags dotfiles:desktop,gnome --check --diff
ansible-playbook ansible/site.yml --limit ikaros --tags gnome --check --diff
ansible-playbook ansible/site.yml --limit prometheus --tags services,dotfiles:server --check --diff
```
---
# Bootstrap di una nuova macchina
Una nuova macchina può essere inizializzata con i seguenti passaggi:
```bash
git clone <repo>
cd <repo-dir>
ansible-galaxy collection install -r ansible/collections/requirements.yml
ansible-playbook ansible/site.yml
```
Dopo l'esecuzione del playbook la macchina verra configurata secondo il profilo definito e i ruoli attualmente orchestrati.
Per aggiungere un nuovo host Void che riusa il profilo desktop preservato:
1. aggiungere l'host a `platform_void`;
2. aggiungerlo a `graphical_desktop`;
3. usare Sway, oppure aggiungerlo a `desktop_niri` per selezionare Niri;
4. lasciare eventuali dettagli hardware in `host_vars/<host>.yml`.
I gruppi legacy `void` e `desktop` sono parent di compatibilita, quindi un host
in `platform_void` e `graphical_desktop` continua a ricevere anche le variabili
Void e desktop esistenti.
Per il flusso mail desktop esiste inoltre uno script dedicato:
```bash
scripts/bootstrap_mail.sh
```
Lo script si occupa del bootstrap dei secret nel keyring, del primo sync con `mbsync` e dell'inizializzazione di `mu` usando la configurazione mail generata dai template.
Se modifichi questo script, valida almeno con:
```bash
sh -n scripts/bootstrap_mail.sh
shellcheck scripts/bootstrap_mail.sh
```
---
# Filosofia del progetto
Il repository segue alcuni principi chiave:
- Infrastructure as Code
- configurazione dichiarativa
- idempotenza
- ambienti riproducibili
- separazione tra configurazione sistema e configurazione utente
Questo consente di ricreare qualsiasi macchina partendo esclusivamente dal repository.
---
# Roadmap
Possibili evoluzioni future:
- hardening sicurezza server
- configurazione backup
- testing automatico playbook
- integrazione CI
- supporto ad altre distribuzioni Linux
---
# Licenza
Questo progetto è distribuito sotto licenza **LGPL-3.0**.

1429
README.md

File diff suppressed because it is too large Load Diff

View File

@@ -1,57 +0,0 @@
# One-time bootstrap for Fedora IoT on Aegis (Raspberry Pi 4).
# Generate only: ./generate-aegis-ign.sh
# Generate and write an SD card: ./generate-aegis-ign.sh --write IMAGE DEVICE
# The write mode uses arm-image-installer with the RPi4 target and embeds
# config.ign; it prompts for Wi-Fi credentials unless supplied through its
# WIFI_SSID and WIFI_PASS environment variables.
# For WiFi, the UEFI 'System Table Selection' must be DeviceTree (Esc at boot).
variant: fiot
version: 1.0.0
passwd:
users:
- name: admin
password_hash: "$6$bNDsU0XC5BxNJS5U$ENDGpdOUPJM3wcXBgNESCQkOqqQ9gN72/xEQoJsAI6QdsaY6mD4G5DBVIv7nHwHQOP35IH1oGRl.Uy3R2iUYQ1"
groups:
- wheel
ssh_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINrIxXjA3ffPwziKGR5gzc4gAoBehQPlnEMcXF4Wl0ZS ikaros"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEH/7GJfGt0ZVmKeEzceoFkFkeCXFryKK9vAbaip+HCx nymph"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA95wYlzpfN3rjUhpMeP4KHn8I6ZrjQXoDTgwgRIa++b siren"
systemd:
units:
- name: sshd.service
enabled: true
- name: rpm-ostree-install-wifi.service
enabled: true
contents: |
[Unit]
Description=Layer WiFi packages (driver, firmware, NetworkManager-wifi)
Wants=network-online.target
After=network-online.target
Before=zincati.service
ConditionPathExists=!/var/lib/%N.stamp
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/rpm-ostree install -y --allow-inactive NetworkManager-wifi NetworkManager-wwan wpa_supplicant wireless-regdb iw brcmfmac-firmware
ExecStart=/bin/touch /var/lib/%N.stamp
ExecStart=/bin/systemctl --no-block reboot
[Install]
WantedBy=multi-user.target
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: |
aegis
- path: /etc/sysctl.d/99-ip-forward.conf
mode: 0644
contents:
inline: |
net.ipv4.ip_forward = 1
links:
- path: /etc/localtime
target: ../usr/share/zoneinfo/Europe/Rome

View File

@@ -1,147 +0,0 @@
#!/usr/bin/env sh
set -eu
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname "$0")" && pwd)
BUTANE_IMAGE=${BUTANE_IMAGE:-quay.io/coreos/butane:release}
BUTANE_SOURCE=${BUTANE_SOURCE:-"$SCRIPT_DIR/aegis.bu"}
IGNITION_OUTPUT=${IGNITION_OUTPUT:-"$SCRIPT_DIR/config.ign"}
SSH_PUBLIC_KEY=${SSH_PUBLIC_KEY:-"$HOME/.ssh/id_ed25519.pub"}
WIFI_SECURITY=${WIFI_SECURITY:-wpa-psk}
usage() {
cat <<'USAGE'
Usage:
generate-aegis-ign.sh
generate-aegis-ign.sh --write IMAGE DEVICE
Environment overrides:
BUTANE_IMAGE Butane container image (default: quay.io/coreos/butane:release)
BUTANE_SOURCE Butane source path (default: aegis.bu beside this script)
IGNITION_OUTPUT Ignition output path (default: config.ign beside this script)
SSH_PUBLIC_KEY SSH public key passed to arm-image-installer
WIFI_SSID Wi-Fi SSID; prompted if unset in --write mode
WIFI_PASS Wi-Fi password; prompted if unset in --write mode
WIFI_SECURITY Wi-Fi security type (default: wpa-psk)
USAGE
}
require_command() {
if ! command -v "$1" >/dev/null 2>&1; then
printf 'Error: required command not found: %s\n' "$1" >&2
exit 1
fi
}
read_required() {
prompt=$1
value=$2
if [ -z "$value" ]; then
printf '%s' "$prompt" >&2
IFS= read -r value
fi
if [ -z "$value" ]; then
printf '%s\n' 'Error: a value is required.' >&2
exit 1
fi
printf '%s' "$value"
}
read_secret() {
value=$1
if [ -z "$value" ]; then
printf '%s' 'Wi-Fi password: ' >&2
stty -echo
IFS= read -r value
stty echo
printf '\n' >&2
fi
if [ -z "$value" ]; then
printf '%s\n' 'Error: a value is required.' >&2
exit 1
fi
printf '%s' "$value"
}
write_image=false
case $# in
0)
;;
3)
if [ "$1" != '--write' ]; then
usage >&2
exit 2
fi
write_image=true
IMAGE=$2
DEVICE=$3
;;
*)
usage >&2
exit 2
;;
esac
require_command podman
if [ ! -f "$BUTANE_SOURCE" ]; then
printf 'Error: Butane source not found: %s\n' "$BUTANE_SOURCE" >&2
exit 1
fi
OUTPUT_DIR=$(dirname "$IGNITION_OUTPUT")
if [ ! -d "$OUTPUT_DIR" ]; then
printf 'Error: output directory not found: %s\n' "$OUTPUT_DIR" >&2
exit 1
fi
umask 077
TEMP_OUTPUT=$(mktemp "$OUTPUT_DIR/.config.ign.XXXXXX")
trap 'rm -f "$TEMP_OUTPUT"' EXIT HUP INT TERM
podman run --rm -i "$BUTANE_IMAGE" --strict < "$BUTANE_SOURCE" > "$TEMP_OUTPUT"
mv "$TEMP_OUTPUT" "$IGNITION_OUTPUT"
trap - EXIT HUP INT TERM
printf 'Generated Ignition config: %s\n' "$IGNITION_OUTPUT"
if [ "$write_image" = false ]; then
exit 0
fi
if [ ! -f "$IMAGE" ]; then
printf 'Error: image not found: %s\n' "$IMAGE" >&2
exit 1
fi
if [ ! -b "$DEVICE" ]; then
printf 'Error: target is not a block device: %s\n' "$DEVICE" >&2
exit 1
fi
if [ ! -f "$SSH_PUBLIC_KEY" ]; then
printf 'Error: SSH public key not found: %s\n' "$SSH_PUBLIC_KEY" >&2
exit 1
fi
require_command arm-image-installer
WIFI_SSID=$(read_required 'Wi-Fi SSID: ' "${WIFI_SSID:-}")
WIFI_PASS=$(read_secret "${WIFI_PASS:-}")
printf 'Writing %s to %s.\n' "$IMAGE" "$DEVICE" >&2
sudo arm-image-installer \
--image="$IMAGE" \
--target=rpi4 \
--media="$DEVICE" \
--ignition="$IGNITION_OUTPUT" \
--addkey="$SSH_PUBLIC_KEY" \
--resizefs \
--wifi-ssid="$WIFI_SSID" \
--wifi-pass="$WIFI_PASS" \
--wifi-security="$WIFI_SECURITY"

View File

@@ -1,4 +1,6 @@
---
collections:
- name: ansible.posix
- name: ansible.windows
- name: community.general
- name: community.windows

View File

@@ -7,30 +7,6 @@ user_shell: /bin/bash
effective_username: "{{ username }}"
effective_user_group: "{{ user_group }}"
effective_user_home: "{{ user_home }}"
emacs_enabled: false
emacs_dotfiles:
- name: Bash Emacs client fragment
src: .bashrc.d/25-emacs-client-desktop.sh
dest: .bashrc.d/25-emacs-client-desktop.sh
mode: "0644"
- name: Emacs authoring configuration
src: .emacs.d/
dest: .emacs.d/
mode: preserve
emacs_authoring_directories:
- .bashrc.d
- Org
- Org/documentation
- Org/meetings
- Org/projects
emacs_authoring_files:
- name: Org HTML stylesheet
src: .emacs.d/templates/org/org.css
dest: Org/org.css
mode: "0644"
xdg_user_directories:
- Desktop
@@ -56,18 +32,6 @@ common_packages:
- zip
- zoxide
vim_plugins_enabled: true
vim_plugin_distro_packages:
- fzf
- vim-fugitive
vim_plugin_source_plugins:
- name: fzf
repo: https://github.com/junegunn/fzf.git
version: v0.72.0
- name: fzf.vim
repo: https://github.com/junegunn/fzf.vim.git
version: 34a564c81f36047f50e593c1656f4580ff75ccca
common_dotfiles:
- name: .bashrc
src: .bashrc
@@ -90,133 +54,38 @@ common_dotfiles:
dest: .config/bat/
mode: preserve
# AI coding-agent lifecycle controls are independent for every agent.
# Installation and removal are mutually exclusive per agent; the common
# pre-task enforces this before any changes are made.
opencode_install_enabled: true
opencode_deploy_enabled: true
opencode_uninstall_enabled: false
codex_install_enabled: true
codex_deploy_enabled: true
codex_uninstall_enabled: false
codex_relay_install_enabled: false
codex_relay_uninstall_enabled: false
gemini_cli_install_enabled: true
gemini_cli_deploy_enabled: true
gemini_cli_uninstall_enabled: false
claude_code_install_enabled: false
claude_code_uninstall_enabled: true
cline_install_enabled: true
cline_deploy_enabled: true
cline_uninstall_enabled: false
ibm_bob_install_enabled: true
ibm_bob_uninstall_enabled: false
ai_agents_npm_packages:
- name: "opencode-ai"
state: latest
- name: "@anthropic-ai/claude-code"
state: latest
- name: "@openai/codex"
state: latest
- name: "@google/gemini-cli"
state: latest
# npm registry requests can be interrupted transiently. Keep retries bounded
# so persistent proxy, DNS, or registry failures still fail the play clearly.
ai_agents_npm_install_retries: 3
ai_agents_npm_install_retry_delay: 10
ai_agents:
opencode:
npm_package: opencode-ai
install_enabled: "{{ opencode_install_enabled }}"
deploy_enabled: "{{ opencode_deploy_enabled }}"
uninstall_enabled: "{{ opencode_uninstall_enabled }}"
opencode_mobile:
npm_package: opencode-mobile
install_enabled: false
deploy_enabled: false
uninstall_enabled: true
claude_code:
npm_package: "@anthropic-ai/claude-code"
install_enabled: "{{ claude_code_install_enabled }}"
deploy_enabled: false
uninstall_enabled: "{{ claude_code_uninstall_enabled }}"
codex:
npm_package: "@openai/codex"
install_enabled: "{{ codex_install_enabled }}"
deploy_enabled: "{{ codex_deploy_enabled }}"
uninstall_enabled: "{{ codex_uninstall_enabled }}"
codex_relay:
npm_package: codex-relay
install_enabled: "{{ codex_relay_install_enabled }}"
deploy_enabled: false
uninstall_enabled: "{{ codex_relay_uninstall_enabled }}"
gemini_cli:
npm_package: "@google/gemini-cli"
install_enabled: "{{ gemini_cli_install_enabled }}"
deploy_enabled: "{{ gemini_cli_deploy_enabled }}"
uninstall_enabled: "{{ gemini_cli_uninstall_enabled }}"
cline:
npm_package: cline
install_enabled: "{{ cline_install_enabled }}"
deploy_enabled: "{{ cline_deploy_enabled }}"
uninstall_enabled: "{{ cline_uninstall_enabled }}"
github_copilot:
npm_package: "@github/copilot"
install_enabled: false
deploy_enabled: false
uninstall_enabled: true
ibm_bob:
install_enabled: "{{ ibm_bob_install_enabled }}"
deploy_enabled: false
uninstall_enabled: "{{ ibm_bob_uninstall_enabled }}"
ai_agents_deploy_enabled_names: >-
{{ ai_agents | dict2items | selectattr('value.deploy_enabled') | map(attribute='key') | list }}
ai_agents_enabled: true
ai_agents_dotfiles:
- name: AI common config
src: .config/ai/
dest: .config/ai/
mode: preserve
agents:
- opencode
- codex
- gemini_cli
- cline
- name: Gemini CLI config
src: .gemini/
dest: .gemini/
mode: preserve
agents:
- gemini_cli
- name: OpenCode config
src: .config/opencode/
dest: .config/opencode/
mode: preserve
agents:
- opencode
- name: Claude Code memory
src: .claude/
dest: .claude/
mode: preserve
agents:
- claude_code
- name: Codex global AGENTS instructions
src: .codex/AGENTS.md
dest: .codex/AGENTS.md
mode: "0644"
agents:
- codex
- name: Cline cross-tool AGENTS instructions
src: .agents/AGENTS.md
dest: .agents/AGENTS.md
mode: "0644"
agents:
- cline
- name: Cline global rules
src: .cline/rules/
dest: .cline/rules/
mode: preserve
agents:
- cline
ai_agents_templates:
- name: Codex config
src: .codex/config.toml.j2
dest: .codex/config.toml
mode: "0644"
agents:
- codex

View File

@@ -1,11 +1,11 @@
---
desktop_environment: minimal
desktop_protonmail_bridge_cert_path: ~/.var/app/ch.protonmail.protonmail-bridge/config/protonmail/bridge-v3/cert.pem
desktop_sessions_enabled:
- sway
- i3
desktop_default_session: sway
desktop_default_session_env: wayland
desktop_default_session: i3
desktop_default_session_env: xorg
desktop_prompt_for_session: true
desktop_source_tools:
@@ -29,19 +29,13 @@ desktop_source_tools:
desktop_binary_tools: []
desktop_npm_packages: >-
{{
[
{'name': '@mermaid-js/mermaid-cli', 'state': 'latest'},
{'name': 'vscode-langservers-extracted', 'state': 'latest'}
]
}}
desktop_uv_tools:
- debugpy
- python-lsp-server
desktop_npm_packages: "{{ ai_agents_npm_packages + [] }}"
desktop_common_dotfiles:
- name: XDG autostart entries
src: .config/autostart/
dest: .config/autostart/
mode: preserve
- name: fastfetch config
src: .config/fastfetch/
dest: .config/fastfetch/
@@ -54,6 +48,22 @@ desktop_common_dotfiles:
src: .local/bin/setup-gtk-theme
dest: .local/bin/setup-gtk-theme
mode: "0755"
- name: MIME application defaults
src: .config/mimeapps.list
dest: .config/mimeapps.list
mode: "0644"
- name: Thunar config
src: .config/Thunar/
dest: .config/Thunar/
mode: preserve
- name: Udiskie config
src: .config/udiskie/
dest: .config/udiskie/
mode: preserve
- name: Udiskie password helper
src: .local/bin/udiskie-password
dest: .local/bin/udiskie-password
mode: "0755"
- name: WirePlumber config
src: .config/wireplumber/
dest: .config/wireplumber/
@@ -82,6 +92,10 @@ desktop_common_dotfiles:
src: .bashrc.d/20-editor-desktop.sh
dest: .bashrc.d/20-editor-desktop.sh
mode: "0644"
- name: Bash Emacs client fragment
src: .bashrc.d/25-emacs-client-desktop.sh
dest: .bashrc.d/25-emacs-client-desktop.sh
mode: "0644"
- name: Bash VM helper fragment
src: .bashrc.d/30-runvm.sh
dest: .bashrc.d/30-runvm.sh
@@ -119,38 +133,49 @@ desktop_common_dotfiles:
dest: .ssh/config
mode: "0600"
desktop_minimal_dotfiles:
- name: Minimal desktop MIME defaults
src: .config/mimeapps.list
dest: .config/mimeapps.list
mode: "0644"
- name: Thunar config
src: .config/Thunar/
dest: .config/Thunar/
desktop_emacs_dotfiles:
- name: Emacs config
src: .emacs.d/
dest: .emacs.d/
mode: preserve
- name: Udiskie config
src: .config/udiskie/
dest: .config/udiskie/
mode: preserve
- name: Udiskie password helper
src: .local/bin/udiskie-password
dest: .local/bin/udiskie-password
mode: "0755"
desktop_minimal_managed_paths:
- .config/Thunar
- .config/alacritty
- .config/dunst
- .config/flameshot
- .config/foot
- .config/gtklock
- .config/kanshi
- .config/rofi
- .config/sway
- .config/udiskie
- .config/waybar
- .config/wlogout
- .local/bin/udiskie-password
desktop_i3_dotfiles:
- name: i3 config
src: .config/i3/
dest: .config/i3/
mode: preserve
- name: dunst config
src: .config/dunst/
dest: .config/dunst/
mode: preserve
- name: i3blocks config
src: .config/i3blocks/
dest: .config/i3blocks/
mode: preserve
- name: rofi config
src: .config/rofi/
dest: .config/rofi/
mode: preserve
- name: picom config
src: .config/picom/picom.conf
dest: .config/picom/picom.conf
mode: "0644"
- name: polybar config
src: .config/polybar/config.ini
dest: .config/polybar/config.ini
mode: "0644"
- name: polybar launcher
src: .config/polybar/launch.sh
dest: .config/polybar/launch.sh
mode: "0755"
- name: alacritty config
src: .config/alacritty/
dest: .config/alacritty/
mode: preserve
- name: .xinitrc
src: .xinitrc
dest: .xinitrc
mode: "0644"
desktop_sway_dotfiles:
- name: alacritty config
@@ -185,42 +210,17 @@ desktop_sway_dotfiles:
src: .config/foot/
dest: .config/foot/
mode: preserve
- name: gtklock config
src: .config/gtklock/
dest: .config/gtklock/
mode: preserve
desktop_niri_dotfiles:
- name: foot config
src: .config/foot/
dest: .config/foot/
mode: preserve
- name: dunst config
src: .config/dunst/
dest: .config/dunst/
mode: preserve
- name: rofi config
src: .config/rofi/
dest: .config/rofi/
mode: preserve
- name: waybar config
src: .config/waybar/
dest: .config/waybar/
mode: preserve
- name: niri config
src: .config/niri/
dest: .config/niri/
mode: preserve
desktop_flatpak_packages:
- be.alexandervanhee.gradia
- ch.protonmail.protonmail-bridge
- com.discordapp.Discord
- com.calibre_ebook.calibre
- com.github.tchx84.Flatseal
- com.spotify.Client
- io.github.flattool.Warehouse
- org.onlyoffice.desktopeditors
- org.telegram.desktop
- org.mozilla.Thunderbird
desktop_flatpak_extensions:
- org.gtk.Gtk3theme.Yaru-Blue-dark//stable

View File

@@ -1,171 +0,0 @@
---
desktop_profile: gnome
desktop_environment: gnome
desktop_sessions_enabled: []
desktop_default_session: gnome
emacs_enabled: true
# Cline Desktop is installed (and pinned in the GNOME favorites) on every
# GNOME host; set cline_desktop_uninstall_enabled here to remove it instead.
cline_desktop_install_enabled: true
# Fedora Workstation/GNOME desktop applications. Keep this profile separate from
# workstation_* so nymph can remain a desktop laptop rather than a dev workstation.
fedora_desktop_packages:
# Fedora equivalents of the development/tooling packages previously pulled by
# the Void desktop profile.
- 7zip
- arm-image-installer
- nodejs-bash-language-server
- bluez
- bridge-utils
- clang-tools-extra
- cmake
- cscope
- ctags
- croc
- delve
- dnsmasq
- thunderbird
- fastfetch
- poppler-glib
- poppler-utils
- fontconfig-devel
- freetype-devel
- gh
- golang
- golangci-lint
- gopls
- gnome-shell-extension-gsconnect
- hunspell
- libvirt
- liberation-fonts
- libasan
- libubsan
- libX11-devel
- libXft-devel
- meld
- mpv
- nextcloud-client
- pdfarranger
- pinentry-gnome3
- plocate
- playerctl
- podman-compose
- qemu
- qemu-img
- qemu-tools
- rclone
- remmina
- rpi-imager
- ruff
- rustup
- rsync
- shfmt
- seahorse
- syncthing
- tealdeer
- terminus-fonts
- tmux
- wl-clipboard
- ty
- uv
- valgrind
- virt-manager
- virt-install
- wireplumber
- yt-dlp
- zstd
fedora_removed_packages:
- evolution
- evolution-langpacks
fedora_nerd_fonts_version: v3.3.0
fedora_nerd_fonts:
- Hack
- JetBrainsMono
- Iosevka
- UbuntuSans
- NerdFontsSymbolsOnly
fedora_flatpak_packages:
- be.alexandervanhee.gradia
- com.spotify.Client
- org.desktop_plus.desktop-plus
- org.onlyoffice.desktopeditors
- org.telegram.desktop
# GNOME-only dotfiles. Kept out of desktop_common_dotfiles so the Void desktops
# do not receive XDG autostart entries for applications they do not install.
# Nextcloud desktop is the `nextcloud-client` package in fedora_desktop_packages;
# this entry matches what the client itself writes when "Launch on startup" is on.
desktop_gnome_dotfiles:
- name: Nextcloud autostart entry
src: .config/autostart/Nextcloud.desktop
dest: .config/autostart/Nextcloud.desktop
mode: "0644"
# Thunderbird is provisioned from a seeded profile plus a managed user.js:
# Existing Thunderbird accounts are reused without changing their preferences.
# Only a new profile receives account, calendar and address book defaults in user.js.
# The address comes from Vault; the app-specific password is never stored here
# and is requested by Thunderbird on first use.
thunderbird_icloud_enabled: true
thunderbird_profile_name: "{{ username }}"
thunderbird_profile_dir: "{{ username }}.default-release"
thunderbird_full_name: "{{ vault_personal_full_name | default(username) }}"
thunderbird_icloud_email: "{{ vault_icloud_email }}"
thunderbird_icloud_account_name: iCloud
thunderbird_icloud_imap_host: imap.mail.me.com
thunderbird_icloud_imap_port: 993
thunderbird_icloud_smtp_host: smtp.mail.me.com
thunderbird_icloud_smtp_port: 587
thunderbird_icloud_caldav_url: https://caldav.icloud.com/
thunderbird_icloud_carddav_url: https://contacts.icloud.com/
thunderbird_icloud_calendar_id: 4f2c1d6e-9b3a-4f7c-8e21-6d5a0c9b7e13
thunderbird_icloud_addressbook_uid: 9e0b7c4a-2d51-4a8f-b6c3-1f7d5e2a8b46
# Native VS Code; opt in to managing settings only after defining them.
vscode_extensions:
- esbenp.prettier-vscode
- github.remotehub
- ms-azuretools.vscode-containers
# ms-azuretools.vscode-docker is deprecated: since June 2025 it is just an
# extension pack wrapping Container Tools. Only the real extension is kept.
- ms-vscode-remote.remote-containers
- ms-vscode-remote.remote-ssh
- ms-vscode-remote.remote-ssh-edit
- ms-vscode-remote.remote-wsl
- ms-vscode-remote.vscode-remote-extensionpack
- ms-vscode.azure-repos
- ms-vscode.remote-explorer
- ms-vscode.remote-repositories
- ms-vscode.remote-server
- pkief.material-icon-theme
- redhat.vscode-xml
- redhat.vscode-yaml
- saoudrizwan.claude-dev
- vscodevim.vim
# Managed user settings deploy as a full-file overlay with a timestamped backup;
# any manual settings.json edit is converged away on the next run. These keys cover
# the podman Dev Containers engine selection and the Container Tools clients.
# editor.fontFamily uses the canonical 'JetBrainsMono Nerd Font' family name: the
# live 'JetBriansMono NF' was a typo whose fallback chain rendered Liberation Mono.
vscode_settings:
containers.containerClient: com.microsoft.visualstudio.containers.podman
containers.orchestratorClient: com.microsoft.visualstudio.orchestrators.podmancompose
dev.containers.dockerPath: podman
editor.cursorStyle: block
editor.fontFamily: "'JetBrainsMono Nerd Font', 'Droid Sans Mono', monospace"
editor.formatOnPaste: true
workbench.iconTheme: material-icon-theme
workbench.startupEditor: none
# User-level keybindings apply to every window, including Dev Containers, SSH and WSL remotes.
# Keys avoid Ctrl+<letter>, which the Vim extension uses for its motions; Alt is not bound by Vim.
vscode_keybindings:
- key: alt+j
command: workbench.action.terminal.toggleTerminal
when: "!terminalFocus"
- key: alt+j
command: workbench.action.togglePanel
when: terminalFocus

View File

@@ -1,5 +0,0 @@
---
desktop_profile: niri
desktop_sessions_enabled:
- niri
desktop_default_session: niri

View File

@@ -1,2 +0,0 @@
---
desktop_profile: sway

View File

@@ -8,22 +8,16 @@ fedora_packages_base:
- htop
- jq
- make
# Keep the LTS stream explicit. Fedora 45's rolling `nodejs` package
# conflicts with the nodejs22-bin alternative installed by the F44→F45
# upgrade.
- nodejs22
- openssl
- nodejs
- ripgrep
fedora_manage_docker_repo: true
fedora_emacs_packages:
- emacs-pgtk
- pandoc
- latexmk
- texlive-latex
- texlive-luatex
- texlive-collection-latexrecommended
fedora_manage_google_chrome_repo: true
fedora_manage_intellij_repo: true
fedora_manage_vscode_repo: true
fedora_intellij_copr_owner: coder966
fedora_intellij_copr_project: intellij-idea-ultimate
fedora_intellij_package_name: intellij-idea-ultimate
fedora_docker_packages:
- docker-ce
@@ -33,86 +27,50 @@ fedora_docker_packages:
- docker-compose-plugin
enabled_services:
- docker
- firewalld
fedora_dotfiles:
- src: .bashrc.d/
dest: .bashrc.d/
mode: preserve
- src: .gtkrc-2.0
dest: .gtkrc-2.0
mode: "0644"
- src: .config/gtk-3.0/
dest: .config/gtk-3.0/
mode: preserve
- src: .config/gtk-4.0/
dest: .config/gtk-4.0/
mode: preserve
workstation_firewall_backend: firewalld
fedora_dev_packages:
- croc
fedora_workstation_dev_packages:
- distrobox
- gnupg
- gnupg2-gpg-agent
- libfido2
- openssh-clients
- pandoc
- shellcheck
fedora_flatpak_remote_name: flathub
fedora_flatpak_remote_url: https://dl.flathub.org/repo/flathub.flatpakrepo
workstation_host_linux_packages_fedora:
- code
- firewall-config
- gnome-extensions-app
- gnome-shell-extension-appindicator
- gnome-shell-extension-just-perfection
- gnome-shell-extension-no-overview
- gnome-tweaks
- libreoffice
- meld
- NetworkManager-openconnect-gnome
- pcsc-lite
- pinentry-gnome3
- podman
- podman-compose
- rclone
- yubikey-manager
cline_desktop_version: "0.0.49"
# Launcher file shipped by the pinned RPM; the GNOME profile pins it in the
# favorites while installation stays enabled.
cline_desktop_launcher: Cline.desktop
# Digests published with the official GitHub release; update with the version.
cline_desktop_rpm_checksums:
x86_64: sha256:e10036a036ee531451695559e2c96feceb3d621408a6615bdd708ffcf9e778ab
aarch64: sha256:aec36edb594bdc400b0c2275230f29de6814a78ad60add4938347d20cfb93b74
cline_desktop_rpm_url: >-
https://github.com/cline/cline/releases/download/desktop-v{{ cline_desktop_version }}/Cline_{{ cline_desktop_version }}_{{ ansible_facts['architecture'] }}.rpm
cline_desktop_rpm_path: "/var/cache/cline-desktop-{{ cline_desktop_version }}-{{ ansible_facts['architecture'] }}.rpm"
# OpenCode Desktop was replaced by Cline Desktop. The pinned release stays
# available for reinstall, while removal is selected in the lifecycle flags
# below so leftovers from the switch converge away on graphical hosts.
opencode_desktop_version: "2.2.5"
# Digests published with the official GitHub release; update with the version.
opencode_desktop_rpm_checksums:
x86_64: sha256:4feb27fe98df9b7579abd31a790d331e9aff87c95f67081beefa2aaaa76ebada
aarch64: sha256:e84b1e03e2b4fb337ddfe015b6457a7aa0dfe171338be08e643ad66b1657033a
opencode_desktop_rpm_url: >-
https://github.com/anomalyco/opencode/releases/download/v{{ opencode_desktop_version }}/opencode-desktop-linux-{{ ansible_facts['architecture'] }}.rpm
opencode_desktop_rpm_path: "/var/cache/opencode-desktop-{{ opencode_desktop_version }}-{{ ansible_facts['architecture'] }}.rpm"
# AI desktop-app lifecycle controls are independent for every app and mirror
# the CLI coding-agent flags. Installation and removal are mutually exclusive
# per app; the common pre-task enforces this before any changes are made.
# ChatGPT opts in per host, Cline opts in through desktop_gnome group vars.
chatgpt_desktop_install_enabled: false
chatgpt_desktop_uninstall_enabled: false
opencode_desktop_install_enabled: false
opencode_desktop_uninstall_enabled: true
ai_desktop_apps:
chatgpt_desktop:
install_enabled: "{{ chatgpt_desktop_install_enabled }}"
uninstall_enabled: "{{ chatgpt_desktop_uninstall_enabled }}"
opencode_desktop:
install_enabled: "{{ opencode_desktop_install_enabled }}"
uninstall_enabled: "{{ opencode_desktop_uninstall_enabled }}"
cline_desktop:
install_enabled: "{{ cline_desktop_install_enabled | default(false) }}"
uninstall_enabled: "{{ cline_desktop_uninstall_enabled | default(false) }}"
chatgpt_desktop_supported_fedora_versions:
- "43"
- "44"
- "45"
chatgpt_desktop_supported_architectures:
- x86_64
- aarch64
chatgpt_desktop_rpm_gpg_key: RPM-GPG-KEY-chatgpt-3BFA0E4AE8B8CC16A2D9BA684A3B4A566C4660E4.asc
chatgpt_desktop_rpm_repository: https://persistent.oaistatic.com/codex-app-prod/linux/rpm/$basearch
workstation_flatpak_remote_name: flathub
workstation_flatpak_remote_url: https://dl.flathub.org/repo/flathub.flatpakrepo
workstation_flatpak_packages:
- com.getpostman.Postman
- com.spotify.Client
- com.github.jeromerobert.pdfarranger
- com.github.xournalpp.xournalpp
- io.dbeaver.DBeaverCommunity
- org.mozilla.Thunderbird
- org.telegram.desktop

View File

@@ -1,3 +0,0 @@
---
host_capabilities:
- graphical_desktop

View File

@@ -1,5 +0,0 @@
---
platform_profile: fedora
platform_family: redhat
platform_package_manager: dnf
platform_service_manager: systemd

View File

@@ -1,2 +0,0 @@
---
# Fedora IoT is immutable: do not attach the mutable Fedora package roles.

View File

@@ -1,55 +0,0 @@
---
platform_profile: rocky
platform_family: redhat
platform_package_manager: dnf
platform_service_manager: systemd
rocky_openzfs_release_rpm: https://zfsonlinux.org/epel/zfs-release-3-0.el9.noarch.rpm
rocky_openzfs_gpg_key_url: >-
https://raw.githubusercontent.com/zfsonlinux/zfsonlinux.github.com/master/zfs-release/RPM-GPG-KEY-openzfs-key2
rocky_openzfs_gpg_key_fingerprint: 7DC7 299D CF7C 7FD9 CD87 701B A599 FD5E 9DB8 4141
rocky_syncthing_version: 2.1.3
rocky_syncthing_archive_checksum: sha256:f929eb8e5b72a85543eeeefb2c38f34a68e0c530e70758a2905b78840c76602c
rocky_syncthing_archive_url: >-
{{
'https://github.com/syncthing/syncthing/releases/download/v'
~ rocky_syncthing_version
~ '/syncthing-linux-amd64-v'
~ rocky_syncthing_version
~ '.tar.gz'
}}
rocky_manage_openzfs_repo: false
rocky_manage_syncthing_binary: false
rocky_manage_podman: false
rocky_manage_github_cli_repo: false
rocky_github_cli_repo_url: https://cli.github.com/packages/rpm/gh-cli.repo
rocky_github_cli_repo_file: /etc/yum.repos.d/gh-cli.repo
enabled_services:
- firewalld
rocky_common_packages:
- bash-completion
- bat
- fzf
- git
- jq
- tree
- unzip
- vim-enhanced
- wget
- zip
- zoxide
rocky_packages_base:
- dnf-plugins-core
- firewalld
- openssh-server
- rsync
- selinux-policy-targeted
- sudo
rocky_profile_packages: []
rocky_podman_packages: []

View File

@@ -1,18 +0,0 @@
---
platform_profile: void
platform_family: void
platform_package_manager: xbps
platform_service_manager: runit
vim_plugin_distro_packages:
- fzf
vim_plugin_source_plugins:
- name: fzf
repo: https://github.com/junegunn/fzf.git
version: v0.72.0
- name: fzf.vim
repo: https://github.com/junegunn/fzf.vim.git
version: 34a564c81f36047f50e593c1656f4580ff75ccca
- name: vim-fugitive
repo: https://github.com/tpope/vim-fugitive.git
version: 3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0

View File

@@ -1,42 +0,0 @@
---
rocky_manage_podman: true
rocky_manage_github_cli_repo: true
rocky_profile_packages:
- avahi
- curl
- dmidecode
- dosfstools
- gcc
- gcc-c++
- git-delta
- gh
- gnupg2
- htop
- make
- nmap-ncat
- nodejs
- parted
- pciutils
- pinentry
- ranger
- ripgrep
rocky_podman_packages:
- podman
- podman-compose
enabled_services:
- firewalld
- podman.socket
server_firewall_backend: firewalld
server_firewalld_zone: public
server_firewalld_services:
- ssh
- cockpit
- http
- https
server_firewalld_ports: []
server_sshd_service_name: sshd
server_compose_selinux_mount_option: Z

View File

@@ -1,16 +0,0 @@
---
machine_role: personal_workstation
role_profile: personal_workstation
role_stability: stable
personal_workstation_directories:
- path: "{{ user_home }}/Documents"
mode: "0755"
- path: "{{ user_home }}/Downloads"
mode: "0755"
- path: "{{ user_home }}/Org"
mode: "0755"
- path: "{{ user_home }}/Remotes"
mode: "0755"
personal_workstation_flatpak_packages: []

View File

@@ -6,12 +6,7 @@ effective_username: "{{ server_username }}"
effective_user_group: "{{ server_user_group }}"
effective_user_home: "{{ server_user_home }}"
server_container_stack_dir: /opt/docker/server
server_npm_quadlet_stage: false
server_npm_quadlet_cutover: false
server_legacy_stack_retired: false
server_legacy_cleanup: false
ai_agents: {}
vim_plugins_enabled: false
ai_agents_enabled: false
profile_packages:
- avahi-daemon
@@ -29,9 +24,6 @@ profile_packages:
- rsync
server_dotfiles:
- src: .bashrc.d/20-editor-server.sh
dest: .bashrc.d/20-editor-server.sh
mode: "0644"
- src: .gnupg/gpg-agent.conf
dest: .gnupg/gpg-agent.conf
mode: "0600"
@@ -41,6 +33,9 @@ server_dotfiles:
- src: .themes.gitignore
dest: .themes.gitignore
mode: "0644"
- src: duckdns/
dest: duckdns/
mode: preserve
server_templates:
- src: server/.gitconfig.j2
@@ -54,10 +49,6 @@ server_templates:
no_log: true
server_directories:
- path: "{{ server_user_home }}/.bashrc.d"
owner: "{{ server_username }}"
group: "{{ server_user_group }}"
mode: "0755"
- path: "{{ server_user_home }}/.gnupg"
owner: "{{ server_username }}"
group: "{{ server_user_group }}"
@@ -66,6 +57,14 @@ server_directories:
owner: root
group: root
mode: "0755"
- path: /opt/navidrome/data
owner: "{{ server_username }}"
group: "{{ server_user_group }}"
mode: "0755"
- path: /opt/music
owner: "{{ server_username }}"
group: "{{ server_user_group }}"
mode: "0755"
- path: /opt/npm/data
owner: root
group: root
@@ -74,46 +73,53 @@ server_directories:
owner: root
group: root
mode: "0755"
- path: /opt/postgres/data
owner: root
group: root
mode: "0755"
- path: /opt/gitea/data
owner: root
group: root
mode: "0755"
- path: /opt/syncthing/config
owner: root
group: root
mode: "0755"
- path: /srv/syncthing
owner: root
group: root
mode: "0755"
- path: /srv/syncthing/data
owner: "1000"
group: "1000"
mode: "0755"
- path: /srv/nextcloud
owner: root
group: root
mode: "0755"
- path: /srv/nextcloud/data
owner: root
group: root
mode: "0755"
server_ufw_rules:
- rule: allow
name: OpenSSH
- rule: allow
port: "22000"
proto: tcp
comment: Syncthing sync traffic
- rule: allow
port: "22000"
proto: udp
comment: Syncthing QUIC sync traffic
- rule: allow
port: "21027"
proto: udp
comment: Syncthing local discovery
server_sshd_settings:
PermitRootLogin: "no"
server_sshd_allow_users:
- "{{ server_username }}"
server_backup_export_enabled: false
server_backup_username: prometheus-backup
server_backup_public_key_name: atlas-pull
server_backup_export_root: /var/lib/prometheus-backup-export
server_backup_rrsync_path: /usr/share/doc/rsync/support/rrsync
server_backup_export_calendar: "*-*-* 02:00:00 Europe/Rome"
server_backup_export_start_timer: false
# Ongoing public Gitea proxy configuration.
server_gitea_proxy_enabled: false
server_gitea_on_atlas: false
server_gitea_atlas_address: "{{ hostvars['atlas'].ansible_host }}"
server_gitea_npm_domains: []
server_gitea_ssh_public_port: 2222
server_gitea_ssh_target_port: 2222
server_backup_export_source_keep: 3
server_backup_export_paths: >-
{{ ['opt/npm/data', 'opt/npm/letsencrypt']
+ ([] if server_gitea_on_atlas | bool else ['opt/gitea/data', 'home/git/.ssh'])
+ ([] if server_legacy_stack_retired | bool else
['opt/docker/server/docker-compose.yml',
'etc/systemd/system/podman-compose-server.service'])
+ (['etc/containers/systemd/prometheus-npm.container',
'etc/containers/systemd/server-web.network']
if server_npm_quadlet_stage | bool else [])
+ ['etc/ssh/sshd_config', 'etc/ssh/sshd_config.d',
'etc/firewalld', 'etc/wireguard/wg0.conf'] }}
server_backup_export_excludes: >-
{{ ['opt/npm/data/logs']
+ ([] if server_gitea_on_atlas | bool else
['opt/gitea/data/gitea/log', 'opt/gitea/data/gitea/tmp',
'opt/gitea/data/gitea/sessions', 'opt/gitea/data/gitea/indexers']) }}
server_ssh_authorized_keys: []
server_ssh_authorized_key_directory: "{{ server_user_home }}/.ssh/authorized_keys.d"

View File

@@ -0,0 +1,28 @@
---
ubuntu_packages_base:
- curl
- ufw
- htop
- build-essential
- nodejs
- git-delta
- jq
- ripgrep
ubuntu_manage_docker_repo: true
ubuntu_docker_packages:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
enabled_services:
- ufw
- docker
ubuntu_dotfiles:
- src: .bashrc.d/
dest: .bashrc.d/
mode: preserve

View File

@@ -1,4 +1,11 @@
---
desktop_void_source_tools:
- name: st
repo: https://codeberg.org/fscotto/st
build_cmd: make
binary_name: st
install_name: st
void_packages_base:
- 7zip
- NetworkManager
@@ -19,6 +26,7 @@ void_packages_base:
- go
- hugo
- ImageMagick
- isync
- libtool
- linux
- linux-headers
@@ -28,6 +36,8 @@ void_packages_base:
- lm_sensors
- man-pages-devel
- man-pages-posix
- msmtp
- mu4e
- nodejs
- ntfs-3g
- pipewire
@@ -57,6 +67,7 @@ enabled_services:
- cupsd
- dbus
- elogind
- emptty
- libvirtd
- nanoklogd
- socklog-unix
@@ -91,51 +102,57 @@ desktop_void_dotfiles:
mode: "0755"
desktop_common_packages:
- blueman
- brightnessctl
- cups
- cups-filters
- cups-pk-helper
- croc
- flatpak
- libsecret
- sane
- sane-airscan
- turnstile
- xdg-desktop-portal
- xdg-user-dirs
desktop_emacs_packages:
- pinentry-emacs
desktop_minimal_packages:
- alacritty
- blueman
- brightnessctl
- dex
- emptty
- exo
- ffmpegthumbnailer
- flatpak
- gnome-keyring
- gvfs
- gvfs-cdda
- gvfs-mtp
- gvfs-smb
- libsecret
- network-manager-applet
- pavucontrol
- pinentry-emacs
- pinentry-gtk
- ristretto
- sane
- sane-airscan
- seahorse
- shotwell
- simple-scan
- system-config-printer
- Thunar
- thunar-archive-plugin
- thunar-volman
- tumbler
- turnstile
- udiskie
- xarchiver
- xdg-desktop-portal
- xdg-desktop-portal-gtk
- xdg-user-dirs
- xfce-polkit
- xournalpp
desktop_i3_packages:
- arandr
- autorandr
- feh
- i3
- i3blocks
- i3blocks-blocklets
- i3lock-color
- i3status
- dunst
- picom
- polybar
- rofi
- scrot
- setxkbmap
- volumeicon
- xclip
- xfce4-clipman-plugin
- xfce4-screenshooter
- xkbutils
- xorg-fonts
- xorg-minimal
- xss-lock
- xdotool
desktop_sway_packages:
- cliphist
@@ -143,7 +160,6 @@ desktop_sway_packages:
- flameshot
- foot
- foot-terminfo
- gtklock
- grim
- kanshi
- rofi
@@ -151,6 +167,7 @@ desktop_sway_packages:
- swayfx
- swaybg
- swayidle
- swaylock
- SwayOSD
- Waybar
- wl-clipboard
@@ -158,43 +175,29 @@ desktop_sway_packages:
- xdg-desktop-portal-wlr
- xorg-server-xwayland
desktop_niri_packages:
- cliphist
- dunst
- foot
- foot-terminfo
- gtklock
- grim
- niri
- rofi
- slurp
- SwayOSD
- Waybar
- wl-clipboard
- xdg-desktop-portal-gtk
- xorg-server-xwayland
profile_packages:
- bash-language-server
- alacritty
- bluez
- bridge-utils
- ctags
- firefox
- deluge-gtk
- delve
- dnsmasq
- thunderbird
- emacs-gtk3
- poppler-glib
- poppler-utils
- exo
- fontconfig-devel
- freetype-devel
- gvfs-cdda
- gvfs-mtp
- gvfs-smb
- gufw
- golangci-lint
- gopls
- hunspell
- libvirt
- libspa-bluetooth
- libreoffice
- liberation-fonts-ttf
- libvterm-devel
- libX11-devel
- libXft-devel
- meld
@@ -210,22 +213,24 @@ profile_packages:
- remmina
- ripgrep
- rustup
- ristretto
- rsync
- shfmt
- shotwell
- ruff
- terminus-font
- texlive
- ty
- tumbler
- uv
- Thunar
- thunar-archive-plugin
- thunar-volman
- ffmpegthumbnailer
- virt-manager
- virt-manager-tools
- wireplumber
- xarchiver
- xournalpp
- yaru
- yaru-plus
- zstd
void_removed_packages:
- evolution
profile_emacs_packages:
- emacs-pgtk

View File

@@ -1,3 +1,5 @@
---
workstation_manage_opencode: true
workstation_manage_ibm_bob: true
workstation_ibm_bob_install_url: "https://bob.ibm.com/download/bobshell.sh"
workstation_npm_packages: "{{ ai_agents_npm_packages + [] }}"

View File

@@ -1,11 +1,12 @@
---
emacs_enabled: true
workstation_git_https_cas:
- url: https://gitlab.ecaas.datacenter.comune.roma
certificate: ecaas.datacenter.comune.roma.crt
- url: https://gitlab.datacenter.comune.roma
certificate: datacenter.comune.roma.crt
workstation_dev_packages:
- distrobox
- gnupg
- gpg-agent
- libfido2-1
- openssh-client
- pandoc
- shellcheck
workstation_user_directories:
- path: "{{ user_home }}/.config"

View File

@@ -1,35 +1,27 @@
---
# Claude Code is managed only on the Fedora WSL development profile.
claude_code_install_enabled: true
claude_code_uninstall_enabled: false
enabled_services:
- docker
workstation_dev_wsl_packages:
- buildah
- helm
# Fedora ships the kubectl client binary in the kubernetes-client package.
- kubernetes-client
- lazygit
- pinentry-curses
- python3-pip
- tmux
# Maven version pinned in the devcontainer images; update it deliberately.
workstation_maven_version: 3.9.16
workstation_cdp_node_version: 20.18.3
workstation_dev_wsl_excluded_packages:
- pcscd
- pinentry-gnome3
- podman
- podman-compose
- ufw
- yubikey-manager
workstation_is_wsl: true
workstation_manage_google_chrome: false
workstation_removed_snap_packages: []
workstation_snap_packages: []
workstation_dev_wsl_python_packages:
- pypsrp
- pyspnego
workstation_wsl_systemd_enabled: true
workstation_dev_wsl_dotfiles:
- src: .gnupg/gpg-agent.conf
dest: .gnupg/gpg-agent.conf
mode: "0600"
- src: .tmux.conf
dest: .tmux.conf
mode: "0644"
source_dir: desktop
- src: .tmux/bin/
dest: .tmux/bin/
mode: preserve
source_dir: desktop

View File

@@ -0,0 +1,72 @@
---
workstation_host_linux_packages:
- gnome-shell-extension-manager
- gnome-shell-extensions
- gnome-tweaks
- gufw
- libreoffice
- meld
- network-manager-openconnect-gnome
- pcscd
- pinentry-gnome3
- podman
- podman-compose
- yubikey-manager
workstation_host_linux_dotfiles:
- src: .gnupg/gpg-agent.conf
dest: .gnupg/gpg-agent.conf
mode: "0600"
workstation_firewall_backend: ufw
workstation_manage_google_chrome: true
workstation_removed_snap_packages:
- firefox
workstation_snap_packages:
- name: intellij-idea-ultimate
classic: true
channel: latest/stable
- name: postman
classic: false
channel: latest/stable
- name: thunderbird
classic: false
channel: latest/stable
- name: code
classic: true
channel: latest/stable
- name: xournalpp
classic: false
channel: latest/stable
- name: pdfarranger
classic: false
channel: latest/stable
- name: spotify
classic: false
channel: latest/stable
- name: telegram-desktop
classic: false
channel: latest/stable
- name: dbeaver-ce
classic: true
channel: latest/stable
workstation_gnome_extensions:
- id: 9308
uuid: bluetooth-battery-monitor@v8v88v8v88.com
version_tag: 68559
enabled: true
- id: 1401
uuid: bluetooth-quick-connect@bjarosze.gmail.com
version_tag: 65323
enabled: true
- id: 6099
uuid: paperwm@paperwm.github.com
version_tag: 68525
enabled: true
workstation_disabled_gnome_extensions:
- tiling-assistant@ubuntu.com
- ubuntu-dock@ubuntu.com

View File

@@ -0,0 +1,71 @@
---
ansible_connection: psrp
ansible_psrp_auth: negotiate
ansible_psrp_cert_validation: ignore
ansible_psrp_protocol: https
ansible_port: 5986
ansible_shell_type: powershell
windows_enable_dark_theme: true
windows_hide_taskbar_search: true
windows_hide_taskbar_widgets: true
windows_terminal_default_profile_name: Ubuntu
windows_taskbar_layout_directory: 'C:\ProgramData\Infra\Windows'
windows_taskbar_layout_path: '{{ windows_taskbar_layout_directory }}\taskbar-layout.xml'
windows_taskbar_reapply_every_logon: false
windows_taskbar_pins:
- type: desktop_application_id
id: Chrome
- type: desktop_application_id
id: Microsoft.Windows.Explorer
- type: app_user_model_id
id: Microsoft.OutlookForWindows_8wekyb3d8bbwe!Microsoft.OutlookforWindows
- type: app_user_model_id
id: MSTeams_8wekyb3d8bbwe!MSTeams
- type: app_user_model_id
id: 5319275A.WhatsAppDesktop_cv1g1gvanyjgm!App
- type: desktop_application_id
id: Telegram.TelegramDesktop
- type: desktop_application_id
id: Microsoft.VisualStudioCode
- type: desktop_application_link_path
path: '%APPDATA%\Microsoft\Windows\Start Menu\Programs\JetBrains Toolbox\IntelliJ IDEA Ultimate.lnk'
- type: desktop_application_id
id: com.squirrel.Postman.Postman
- type: app_user_model_id
id: Microsoft.WindowsTerminal_8wekyb3d8bbwe!App
- type: desktop_application_link_path
path: '%APPDATA%\Microsoft\Windows\Start Menu\Programs\DBeaver Community\DBeaver.lnk'
windows_winget_packages:
- id: 7zip.7zip
name: 7-Zip
- id: Adobe.Acrobat.Reader.64-bit
name: Adobe Acrobat Reader
- id: DBeaver.DBeaver.Community
name: DBeaver Community
- id: Google.Chrome
name: Google Chrome
- id: JetBrains.IntelliJIDEA.Ultimate
name: IntelliJ IDEA Ultimate
- id: Logitech.OptionsPlus
name: Logitech Options+
- id: Microsoft.VisualStudioCode
name: Visual Studio Code
- id: Microsoft.WindowsTerminal
name: Windows Terminal
- id: Postman.Postman
name: Postman
- id: Telegram.TelegramDesktop
name: Telegram Desktop
- id: 9NKSQGP7F2NH
name: WhatsApp
source: msstore
windows_vscode_extensions:
- ms-vscode-remote.remote-containers
- ms-vscode-remote.remote-ssh
- ms-vscode-remote.remote-wsl
windows_wsl_distribution_name: Ubuntu

View File

@@ -1,44 +0,0 @@
---
ansible_host: aegis
ansible_connection: ssh
ansible_user: pi
ansible_become: true
ansible_python_interpreter: /usr/bin/python3
# Avoid PTY framing around module JSON on this remote Fedora IoT host.
ansible_ssh_use_tty: false
aegis_lan_subnet: 192.168.178.0/24
aegis_adguard_web_port: 80
aegis_network_connection_name: FRITZ!Box 7530 NR
aegis_network_connection_uuid: a52fda3d-3eb6-351f-bf04-753edcb76944
aegis_host_dns_servers:
- 192.168.178.1
aegis_host_dns_search_domains:
- fritz.box
# Aegis is the internal WireGuard endpoint and NAT gateway for the LAN.
wireguard_overlay_enabled: true
wireguard_address: 10.0.0.2/24
wireguard_enable_ipv4_forwarding: true
wireguard_reload_rootful_podman_networks: true
wireguard_forwarding_policies:
- name: aegis-wireguard-to-lan
ingress_zone: wireguard
egress_zone: public
source: 10.0.0.0/24
destination: "{{ aegis_lan_subnet }}"
masquerade: true
wireguard_peers:
- name: prometheus
host: prometheus
endpoint: "{{ hostvars['prometheus']['ansible_host'] }}:{{ hostvars['prometheus']['wireguard_listen_port'] }}"
allowed_ips:
- 10.0.0.0/24
persistent_keepalive: 25
aegis_ssh_authorized_keys:
- name: ikaros
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINrIxXjA3ffPwziKGR5gzc4gAoBehQPlnEMcXF4Wl0ZS ikaros"
- name: nymph
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEH/7GJfGt0ZVmKeEzceoFkFkeCXFryKK9vAbaip+HCx nymph"
- name: siren
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA95wYlzpfN3rjUhpMeP4KHn8I6ZrjQXoDTgwgRIa++b siren"

View File

@@ -1,285 +0,0 @@
---
# Atlas declares its intended steady state; set a feature flag false only for a deliberate suspension.
hostname: atlas
ansible_host: 192.168.178.55
ansible_user: "{{ atlas_connection_username }}"
ansible_port: 22
ansible_ssh_private_key_file: /home/fscotto/.ssh/id_ed25519
atlas_admin_username: admin
atlas_connection_username: "{{ atlas_admin_username }}"
atlas_admin_group: "{{ atlas_admin_username }}"
atlas_admin_home: "/home/{{ atlas_admin_username }}"
atlas_admin_uid: 1000
atlas_admin_gid: 1000
atlas_admin_ssh_keys:
- name: ikaros
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINrIxXjA3ffPwziKGR5gzc4gAoBehQPlnEMcXF4Wl0ZS ikaros"
- name: nymph
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEH/7GJfGt0ZVmKeEzceoFkFkeCXFryKK9vAbaip+HCx nymph"
- name: siren
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA95wYlzpfN3rjUhpMeP4KHn8I6ZrjQXoDTgwgRIa++b siren"
atlas_admin_password_hash: "{{ vault_atlas_admin_password_hash | default('!') }}"
atlas_ssh_allow_tcp_forwarding: local
atlas_lan_subnet: 192.168.178.0/24
atlas_aegis_ip: 192.168.178.54
atlas_manage_firewall: true
atlas_firewalld_zone: public
atlas_zfs_pool: zpool
# Populate only for the first pool bootstrap with four real persistent disk paths.
# Confirmed empty 4 TB IronWolf data disks; the NVMe system disk is intentionally excluded.
atlas_zpool_disks:
- /dev/disk/by-id/ata-ST4000VN006-3CW104_WW6AC1XM
- /dev/disk/by-id/ata-ST4000VN006-3CW104_WW6A73T2
- /dev/disk/by-id/ata-ST4000VN006-3CW104_WW6A6VJK
- /dev/disk/by-id/ata-ST4000VN006-3CW104_WW6AC1LM
atlas_create_pool: false
atlas_zfs_dataset_archive: archive
atlas_zfs_dataset_services: services
atlas_zfs_dataset_app_data: services/data
atlas_zfs_dataset_navidrome: services/data/navidrome
atlas_zfs_dataset_syncthing: services/data/syncthing
atlas_zfs_dataset_media: media
atlas_zfs_dataset_music: media/music
atlas_zfs_dataset_backup: backup
atlas_zfs_dataset_host_backups: backup/hosts
atlas_zfs_dataset_backup_prometheus: backup/hosts/prometheus
atlas_zfs_backup_reservation: 500G
atlas_zfs_dataset_photobook: media/photobook
atlas_mount_root: /zpool
atlas_manage_storage: true
atlas_manage_nextcloud: true
# Two local consistent bundles; long-term history stays in Borg/USB and ZFS.
atlas_nextcloud_backup_keep: 2
atlas_nextcloud_domain: cloud.fscotto.co
atlas_onlyoffice_domain: office.fscotto.co
# Resolved official amd64 images on 2026-10-03; updates are deliberate.
atlas_nextcloud_image: docker.io/library/nextcloud:33.0.9-apache@sha256:a97666d6ae931bde78a80cfba8abdf46d436d7b540f31895803f6fb0a012d689
atlas_nextcloud_postgres_image: docker.io/library/postgres:17-bookworm@sha256:639ab7ceb90e13123085b741fb31ef493fba25463002f6da665352e7b534b652
atlas_nextcloud_redis_image: docker.io/library/redis:7.4-bookworm@sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f
atlas_onlyoffice_image: docker.io/onlyoffice/documentserver:9.4.0.1@sha256:3ab6ebc7c605e5a32b7ae3ff19daed4925090245acc8100ce2230bd766c88212
atlas_nextcloud_users:
- username: fabio
display_name: Fabio
password: "{{ vault_nextcloud_fabio_password }}"
- username: chiara
display_name: Chiara
password: "{{ vault_nextcloud_chiara_password }}"
atlas_nextcloud_external_mounts:
- name: Documenti
user: fabio
source: /zpool/archive/Documents
target: /mnt/archive-documents
readonly: false
# Expose the iCloudPD originals directly in Fabio's canonical Photos folder.
# This remains a read-only external mount; iCloudPD is the sole writer.
- name: Photos
user: fabio
source: /zpool/archive/Pictures/iCloudPD
target: /mnt/archive-icloud
readonly: true
atlas_nextcloud_apps:
- id: groupfolders
version: 21.0.9
url: https://github.com/nextcloud-releases/groupfolders/releases/download/v21.0.9/groupfolders-v21.0.9.tar.gz
checksum: sha256:d8b95f0778425f646f2311ba5b42d8e2fcfdf37dc2fd35fcac8d3f01bde38a21
- id: onlyoffice
version: 10.2.1
url: https://github.com/ONLYOFFICE/onlyoffice-nextcloud/releases/download/v10.2.1/onlyoffice.tar.gz
checksum: sha256:144998af0610ccd17ee8d7025e2f8001472da03f6dab90ff38039247825e3a9b
- id: contacts
version: 8.9.1
url: https://github.com/nextcloud-releases/contacts/releases/download/v8.9.1/contacts-v8.9.1.tar.gz
checksum: sha256:a25cdf448b192631b8e8eb7addc31b40382b33871b10521f4308ac5a6e0457bf
- id: calendar
version: 6.6.2
url: https://github.com/nextcloud-releases/calendar/releases/download/v6.6.2/calendar-v6.6.2.tar.gz
checksum: sha256:7e83632d4436d3037a34d1c73cbc06d5ccb6e8fc10f096a86a43a0515588529c
# Rootless Gitea was restored from the stopped-source export before production activation.
# Paperless runs rootless on dedicated ZFS datasets; NPM remains on Prometheus.
atlas_manage_paperless: true
atlas_paperless_domain: documents.fscotto.co
# Resolved official amd64 images on 2026-10-12; upgrades remain deliberate.
atlas_paperless_image: ghcr.io/paperless-ngx/paperless-ngx:3.2.1@sha256:5fa76604a81df6945086e0837b14b56543d137e8ce4f311cc5d9ebe907e74e79
atlas_paperless_postgres_image: docker.io/library/postgres:17-bookworm@sha256:3645570cccdfa447589da9f57dd740faa29b30938e861289a5574b6ca6b03826
atlas_paperless_valkey_image: docker.io/valkey/valkey:8-bookworm@sha256:fea8b3e67b15729d4bb70589eb03367bab9ad1ee89c876f54327fc7c6e618571
atlas_paperless_tika_image: docker.io/apache/tika:3.3.1.0@sha256:90b7fa1dc018434075fce9e1d9b88b1e3d0ea6979d0cf86e116c79a8073ae973
atlas_paperless_gotenberg_image: docker.io/gotenberg/gotenberg:8.37@sha256:f29984bd1e226bf1b93ba90af06000afa8b315853e99d27b9aaa41b93f15c769
atlas_paperless_ollama_image: docker.io/ollama/ollama:0.40.3@sha256:adca95a12c2b386a8f9a995e7fa0600e187e3323b5e5522f5a6c3b1ec73eff99
atlas_manage_gitea: true
atlas_gitea_production_enabled: true
atlas_gitea_public_domain: git.fscotto.co
atlas_prometheus_pull_start_timer: true
atlas_manage_zfs_snapshots: true
atlas_zfs_snapshot_prefix: atlas-auto
atlas_zfs_snapshot_policies:
- name: hourly
calendar: "*-*-* *:05:00"
keep: 24
- name: daily
calendar: "*-*-* 00:15:00"
keep: 30
- name: weekly
calendar: "Sun *-*-* 01:00:00"
keep: 8
- name: monthly
calendar: "*-*-01 02:00:00"
keep: 12
atlas_manage_zfs_scrub: true
atlas_zfs_scrub_calendar: "Sun *-*-01..07 03:00:00"
atlas_manage_borg_backup: true
atlas_borg_repository_host: u660064-sub1.your-storagebox.de
atlas_borg_repository_user: u660064-sub1
atlas_borg_repository_port: 23
atlas_borg_repository_path: ./borg-data
atlas_borg_remote_path: borg-1.4
# Verified against Hetzner's published ED25519 fingerprint on 2026-09-17:
# SHA256:XqONwb1S0zuj5A1CDxpOSuD2hnAArV1A3wKY7Z3sdgM
atlas_borg_host_key: >-
[u660064-sub1.your-storagebox.de]:23 ssh-ed25519
AAAAC3NzaC1lZDI1NTE5AAAAIICf9svRenC/PLKIL9nk6K/pxQgoiFC41wTNvoIncOxs
atlas_borg_backup_calendar: "*-*-* 04:30:00"
atlas_borg_check_calendar: "*-*-15 06:00:00"
atlas_borg_randomized_delay: 30m
atlas_borg_keep_daily: 30
atlas_borg_keep_weekly: 8
atlas_borg_keep_monthly: 12
atlas_manage_usb_backup: true
# Read-only lsblk verification on Atlas, 2026-09-23. Never store the LUKS password here.
atlas_usb_backup_luks_uuid: 577b3c43-ea37-4611-81a9-39d555cdfbd4
atlas_usb_backup_fs_uuid: 758e2d2e-a427-4797-aad9-39c3a9f17c7e
atlas_usb_backup_mapper_name: zpool-backup
atlas_manage_usb_reminder: true
atlas_usb_reminder_calendar: "Sat *-*-01..07 10:00:00 Europe/Rome"
atlas_manage_monitoring: true
atlas_manage_prometheus_backup_pull: true
# Prometheus ED25519 host key read through the controller's strict SSH trust on 2026-09-30.
# Fingerprint: SHA256:rfedk7DHI9mLB3UHk/4F3HHlSIiswtCAFsAXvfh6iXk
atlas_prometheus_ssh_host_key: >-
179.237.102.172 ssh-ed25519
AAAAC3NzaC1lZDI1NTE5AAAAIC4b+QXlPupoEx71W9NKs9tTeYjBqTkVMqbGB97nMNWv
# Physical pool disks and the system NVMe; the disconnected USB disk is intentionally excluded.
atlas_monitor_smart_devices:
- { name: pool-1, path: "{{ atlas_zpool_disks[0] }}", warning_c: 50, critical_c: 55 }
- { name: pool-2, path: "{{ atlas_zpool_disks[1] }}", warning_c: 50, critical_c: 55 }
- { name: pool-3, path: "{{ atlas_zpool_disks[2] }}", warning_c: 50, critical_c: 55 }
- { name: pool-4, path: "{{ atlas_zpool_disks[3] }}", warning_c: 50, critical_c: 55 }
- name: system-nvme
path: /dev/disk/by-id/nvme-Patriot_M.2_P320_256GB_P320ADB26011606111
warning_c: 70
critical_c: 85
atlas_monitor_timers:
- { name: atlas-zfs-snapshot-hourly.timer, max_age_hours: 3 }
- { name: atlas-zfs-snapshot-daily.timer, max_age_hours: 36 }
- { name: atlas-zfs-snapshot-weekly.timer, max_age_hours: 216 }
- { name: atlas-zfs-snapshot-monthly.timer, max_age_hours: 960 }
- { name: zfs-scrub-monthly@zpool.timer, max_age_hours: 960 }
- { name: atlas-borg-backup.timer, max_age_hours: 48 }
- { name: atlas-borg-check.timer, max_age_hours: 960 }
# The first manual USB reminder is not due until October; activation is checked, not age.
- { name: atlas-usb-reminder.timer, max_age_hours: 0 }
atlas_monitor_failure_units:
- atlas-zfs-snapshot@.service
- zfs-scrub@zpool.service
- atlas-borg-backup.service
- atlas-borg-check.service
- atlas-usb-backup.service
- atlas-usb-reminder.service
- atlas-health-monitor.service
atlas_monitor_remote_capacity:
user: "{{ atlas_borg_repository_user }}"
host: "{{ atlas_borg_repository_host }}"
run_as: "{{ atlas_borg_username }}"
ssh_wrapper: "{{ atlas_borg_ssh_wrapper_path }}"
warning_percent: 80
critical_percent: 90
growth_warning_gib_day: 500
atlas_manage_sharing: true
atlas_manage_media_stack: false
# Planned after data-protection validation: move iCloudPD photo ingestion from
# Aegis to Atlas, with photos under /zpool/archive/Pictures/iCloudPD and
# application/MFA state in a separate dataset. Do not deploy or cut over yet.
# WireGuard is retired on Atlas. These rootless services are a temporary home
# until Uranus replaces them.
backend_phase1_enabled: true
backend_phase1_start_services: true
backend_phase1_bind_address: "{{ ansible_host }}"
backend_phase1_firewalld_zone: "{{ atlas_firewalld_zone }}"
backend_phase1_npm_source_ip: "{{ atlas_aegis_ip }}"
backend_phase1_syncthing_native_subnet: "{{ atlas_lan_subnet }}"
backend_phase1_music_sync_enabled: true
rocky_manage_openzfs_repo: true
rocky_manage_syncthing_binary: false
rocky_manage_podman: true
rocky_podman_packages:
- podman
host_packages:
- cockpit
- cockpit-podman
- cockpit-storaged
- realmd
- pcp
- python3-pcp
- cryptsetup
- nfs-utils
- policycoreutils
- policycoreutils-python-utils
- python3-libselinux
- setroubleshoot-server
- samba
- samba-client
- samba-common-tools
- borgbackup
- zfs
atlas_nfs_exports:
- path: "{{ atlas_photobook_mountpoint }}"
client: "{{ atlas_aegis_ip }}"
options:
- rw
- sync
- no_subtree_check
- all_squash
- "anonuid={{ atlas_immich_uid }}"
- "anongid={{ atlas_immich_gid }}"
atlas_samba_share_name: Archive
atlas_samba_workgroup: WORKGROUP
atlas_samba_encryption: required
# Append any pre-existing laptop Unix account here and keep its Samba password in Vault.
atlas_samba_accounts:
- username: "{{ atlas_admin_username }}"
password: "{{ vault_atlas_samba_password | default('') }}"
atlas_samba_valid_users: "{{ atlas_samba_accounts | map(attribute='username') | list }}"
atlas_immich_db_password: "{{ vault_atlas_immich_db_password | default('') }}"
atlas_firewalld_rich_rules:
- 'rule family="ipv4" source address="{{ atlas_lan_subnet }}" port port="22" protocol="tcp" accept'
- 'rule family="ipv4" source address="{{ atlas_lan_subnet }}" port port="9090" protocol="tcp" accept'
- 'rule family="ipv4" source address="{{ atlas_aegis_ip }}" port port="2049" protocol="tcp" accept'
- 'rule family="ipv4" source address="{{ atlas_lan_subnet }}" port port="445" protocol="tcp" accept'
host_enabled_services:
- sshd
- cockpit.socket
- pmlogger.service
- zfs.target
# Torrent Web UI: LAN and the existing Aegis gateway for the manual NPM proxy.
atlas_manage_qbittorrent: true
atlas_qbittorrent_image: docker.io/qbittorrentofficial/qbittorrent-nox@sha256:92bfd78d731e254ba64f62b77b0696add6447a33642ee5feda106a26b285aa7f
atlas_qbittorrent_reverse_proxy_enabled: true
atlas_qbittorrent_public_domain: torrent.fscotto.co
# LAN-only HTTP downloader; RPC secret is generated and retained privately on Atlas.
atlas_manage_aria2: true
atlas_aria2_gateway_enabled: true
atlas_aria2_public_domain: downloads.fscotto.co
atlas_aria2_image: docker.io/p3terx/aria2-pro@sha256:086d1a37c586edb07ec0fb956bf9edd89d1d38d138ad5309ff96d510c8c9a011
atlas_ariang_image: docker.io/p3terx/ariang@sha256:73849cf75fe9f959229222622e887310df505cbf868eb9c735e2af376523c010

View File

@@ -0,0 +1,176 @@
---
hostname: deadalus-fedora
host_packages: []
host_enabled_services: []
workstation_firewall_backend: firewalld
workstation_host_vscode_extensions:
- ms-vscode-remote.remote-containers
- ms-vscode-remote.remote-ssh
- ms-azuretools.vscode-docker
- redhat.vscode-yaml
- redhat.ansible
workstation_gnome_managed_settings:
- schema: org.gnome.shell
key: favorite-apps
value: "['google-chrome.desktop', 'org.gnome.Nautilus.desktop', 'com.spotify.Client.desktop', 'org.mozilla.Thunderbird.desktop', 'org.telegram.desktop.desktop', 'code.desktop', 'intellij-idea-ultimate.desktop', 'io.dbeaver.DBeaverCommunity.desktop', 'com.getpostman.Postman.desktop', 'org.gnome.Ptyxis.desktop']"
- schema: org.gnome.shell
key: app-picker-layout
value: "[{'6f4bfcaf-700e-4fe3-8fd2-4a3e6fc46bcf': <{'position': <0>}>, 'System': <{'position': <1>}>, 'Utilities': <{'position': <2>}>, 'org.gnome.Contacts.desktop': <{'position': <3>}>, 'org.gnome.Weather.desktop': <{'position': <4>}>, 'org.gnome.clocks.desktop': <{'position': <5>}>, 'org.gnome.Maps.desktop': <{'position': <6>}>, 'org.gnome.SimpleScan.desktop': <{'position': <7>}>, 'org.gnome.Settings.desktop': <{'position': <8>}>, 'org.gnome.Boxes.desktop': <{'position': <9>}>, 'org.gnome.Showtime.desktop': <{'position': <10>}>, 'org.gnome.Snapshot.desktop': <{'position': <11>}>, 'org.gnome.Characters.desktop': <{'position': <12>}>, 'org.gnome.Calculator.desktop': <{'position': <13>}>, 'org.gnome.Calendar.desktop': <{'position': <14>}>, 'org.gnome.TextEditor.desktop': <{'position': <15>}>, 'org.gnome.Meld.desktop': <{'position': <16>}>, 'org.gnome.tweaks.desktop': <{'position': <17>}>, 'org.gnome.Software.desktop': <{'position': <18>}>}]"
- schema: org.gnome.desktop.input-sources
key: sources
value: "[('xkb', 'us')]"
- schema: org.gnome.desktop.interface
key: color-scheme
value: "'prefer-dark'"
- schema: org.gnome.desktop.privacy
key: report-technical-problems
value: "false"
- schema: org.gnome.desktop.wm.preferences
key: button-layout
value: "'appmenu:minimize,maximize,close'"
- schema: org.gnome.nautilus.preferences
key: click-policy
value: "'double'"
- schema: org.gnome.nautilus.preferences
key: date-time-format
value: "'simple'"
- schema: org.gnome.nautilus.preferences
key: default-folder-viewer
value: "'icon-view'"
- schema: org.gnome.nautilus.preferences
key: default-sort-order
value: "'name'"
- schema: org.gnome.nautilus.preferences
key: recursive-search
value: "'local-only'"
- schema: org.gnome.nautilus.preferences
key: show-create-link
value: "true"
- schema: org.gnome.nautilus.preferences
key: show-delete-permanently
value: "true"
- schema: org.gnome.nautilus.preferences
key: show-directory-item-counts
value: "'local-only'"
- schema: org.gnome.nautilus.preferences
key: show-hidden-files
value: "false"
- schema: org.gnome.nautilus.preferences
key: show-image-thumbnails
value: "'local-only'"
- schema: org.gnome.nautilus.preferences
key: thumbnail-limit
value: "uint64 50"
- schema: org.gnome.nautilus.icon-view
key: captions
value: "['none', 'none', 'none']"
- schema: org.gnome.nautilus.icon-view
key: default-zoom-level
value: "'medium'"
- schema: org.gtk.Settings.FileChooser
key: clock-format
value: "'24h'"
- schema: org.gtk.Settings.FileChooser
key: date-format
value: "'regular'"
- schema: org.gtk.Settings.FileChooser
key: location-mode
value: "'path-bar'"
- schema: org.gtk.Settings.FileChooser
key: show-hidden
value: "false"
- schema: org.gtk.Settings.FileChooser
key: show-size-column
value: "true"
- schema: org.gtk.Settings.FileChooser
key: show-type-column
value: "true"
- schema: org.gtk.Settings.FileChooser
key: sort-column
value: "'name'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: clock-format
value: "'24h'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: date-format
value: "'regular'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: location-mode
value: "'path-bar'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: show-hidden
value: "false"
- schema: org.gtk.gtk4.Settings.FileChooser
key: show-size-column
value: "true"
- schema: org.gtk.gtk4.Settings.FileChooser
key: show-type-column
value: "true"
- schema: org.gtk.gtk4.Settings.FileChooser
key: sort-column
value: "'name'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: sort-directories-first
value: "true"
- schema: org.gnome.TextEditor
key: auto-indent
value: "true"
- schema: org.gnome.TextEditor
key: highlight-matching-brackets
value: "true"
- schema: org.gnome.TextEditor
key: indent-style
value: "'tab'"
- schema: org.gnome.TextEditor
key: keybindings
value: "'default'"
- schema: org.gnome.TextEditor
key: restore-session
value: "true"
- schema: org.gnome.TextEditor
key: show-line-numbers
value: "false"
- schema: org.gnome.TextEditor
key: spellcheck
value: "true"
- schema: org.gnome.TextEditor
key: style-scheme
value: "'Adwaita'"
- schema: org.gnome.TextEditor
key: style-variant
value: "'follow'"
- schema: org.gnome.TextEditor
key: use-system-font
value: "true"
- schema: org.gnome.TextEditor
key: wrap-text
value: "true"
- schema: org.gnome.desktop.background
key: picture-uri
value: "'file:///usr/share/backgrounds/gnome/lcd-rainbow-l.jxl'"
- schema: org.gnome.desktop.background
key: picture-uri-dark
value: "'file:///usr/share/backgrounds/gnome/lcd-rainbow-d.jxl'"
workstation_gnome_extension_dconf_settings:
- path: /org/gnome/shell/extensions/paperwm/
key: selection-border-radius-bottom
value: "15"
- path: /org/gnome/shell/extensions/paperwm/
key: selection-border-radius-top
value: "15"
- path: /org/gnome/shell/extensions/paperwm/
key: selection-border-size
value: "5"
- path: /org/gnome/shell/extensions/paperwm/
key: show-window-position-bar
value: "false"
- path: /org/gnome/shell/extensions/paperwm/
key: show-workspace-indicator
value: "false"
- path: /org/gnome/shell/extensions/paperwm/
key: window-gap
value: "10"

View File

@@ -0,0 +1,319 @@
---
hostname: deadalus-ubuntu
host_packages: []
host_enabled_services: []
workstation_host_vscode_extensions:
- ms-vscode-remote.remote-containers
- ms-vscode-remote.remote-ssh
- ms-azuretools.vscode-docker
- redhat.vscode-yaml
- redhat.ansible
workstation_gnome_managed_settings:
- schema: org.gnome.shell
key: favorite-apps
value: "['google-chrome.desktop', 'org.gnome.Nautilus.desktop', 'spotify_spotify.desktop', 'thunderbird_thunderbird.desktop', 'telegram-desktop_telegram-desktop.desktop', 'code_code.desktop', 'intellij-idea-ultimate_intellij-idea-ultimate.desktop', 'dbeaver-ce_dbeaver-ce.desktop', 'postman_postman.desktop', 'org.gnome.Ptyxis.desktop']"
- schema: org.gnome.shell
key: app-picker-layout
value: "[{'Utilities': <{'position': <0>}>, 'System': <{'position': <1>}>, 'a3b499f3-e2cc-40ac-9145-7db9c827dff2': <{'position': <2>}>, 'org.gnome.Calculator.desktop': <{'position': <3>}>, 'com.mattjakeman.ExtensionManager.desktop': <{'position': <4>}>, 'org.gnome.clocks.desktop': <{'position': <5>}>, 'htop.desktop': <{'position': <6>}>, 'org.gnome.Characters.desktop': <{'position': <7>}>, 'gnome-language-selector.desktop': <{'position': <8>}>, 'org.gnome.Meld.desktop': <{'position': <9>}>, 'net.nokyan.Resources.desktop': <{'position': <10>}>, 'org.gnome.TextEditor.desktop': <{'position': <11>}>, 'org.gnome.tweaks.desktop': <{'position': <12>}>, 'vim.desktop': <{'position': <13>}>, 'snap-store_snap-store.desktop': <{'position': <14>}>, 'org.gnome.Yelp.desktop': <{'position': <15>}>}]"
- schema: org.gnome.desktop.app-folders
key: folder-children
value: "['System', 'Utilities', 'YaST', 'Pardus', 'a3b499f3-e2cc-40ac-9145-7db9c827dff2']"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/System/
key: name
value: "'X-GNOME-Shell-System.directory'"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/System/
key: translate
value: "true"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/System/
key: categories
value: "@as []"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/System/
key: apps
value: "['nm-connection-editor.desktop', 'org.gnome.baobab.desktop', 'org.gnome.DiskUtility.desktop', 'im-config.desktop', 'org.gnome.Logs.desktop', 'org.gnome.Sysprof.desktop', 'gufw.desktop', 'firmware-updater_firmware-updater.desktop', 'org.gnome.Settings.desktop', 'update-manager.desktop', 'desktop-security-center_desktop-security-center.desktop']"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/Utilities/
key: name
value: "'X-GNOME-Shell-Utilities.directory'"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/Utilities/
key: translate
value: "true"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/Utilities/
key: categories
value: "@as []"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/Utilities/
key: apps
value: "['org.gnome.Papers.desktop', 'org.gnome.font-viewer.desktop', 'org.gnome.Loupe.desktop', 'org.gnome.seahorse.Application.desktop']"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/YaST/
key: name
value: "'suse-yast.directory'"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/YaST/
key: translate
value: "true"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/YaST/
key: categories
value: "['X-SuSE-YaST']"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/YaST/
key: apps
value: "@as []"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/Pardus/
key: name
value: "'X-Pardus-Apps.directory'"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/Pardus/
key: translate
value: "true"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/Pardus/
key: categories
value: "['X-Pardus-Apps']"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/Pardus/
key: apps
value: "@as []"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/a3b499f3-e2cc-40ac-9145-7db9c827dff2/
key: name
value: "'Office'"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/a3b499f3-e2cc-40ac-9145-7db9c827dff2/
key: translate
value: "false"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/a3b499f3-e2cc-40ac-9145-7db9c827dff2/
key: categories
value: "@as []"
- schema: org.gnome.desktop.app-folders.folder
path: /org/gnome/desktop/app-folders/folders/a3b499f3-e2cc-40ac-9145-7db9c827dff2/
key: apps
value: "['libreoffice-calc.desktop', 'libreoffice-base.desktop', 'libreoffice-draw.desktop', 'libreoffice-impress.desktop', 'libreoffice-math.desktop', 'libreoffice-writer.desktop', 'xournalpp_xournalpp.desktop', 'libreoffice-startcenter.desktop', 'pdfarranger_pdfarranger.desktop']"
- schema: org.gnome.desktop.input-sources
key: sources
value: "[('xkb', 'us')]"
- schema: org.gnome.desktop.interface
key: accent-color
value: "'orange'"
- schema: org.gnome.desktop.interface
key: clock-format
value: "'24h'"
- schema: org.gnome.desktop.interface
key: clock-show-date
value: "true"
- schema: org.gnome.desktop.interface
key: color-scheme
value: "'prefer-dark'"
- schema: org.gnome.desktop.interface
key: cursor-theme
value: "'Adwaita'"
- schema: org.gnome.desktop.interface
key: document-font-name
value: "'Adwaita Sans 12'"
- schema: org.gnome.desktop.interface
key: font-name
value: "'Adwaita Sans 11'"
- schema: org.gnome.desktop.interface
key: gtk-theme
value: "'Yaru-dark'"
- schema: org.gnome.desktop.interface
key: icon-theme
value: "'Yaru-dark'"
- schema: org.gnome.desktop.interface
key: monospace-font-name
value: "'Ubuntu Sans Mono 11'"
- schema: org.gnome.desktop.interface
key: show-battery-percentage
value: "false"
- schema: org.gnome.desktop.interface
key: text-scaling-factor
value: "1.0"
- schema: org.gnome.desktop.privacy
key: report-technical-problems
value: "false"
- schema: org.gnome.desktop.wm.preferences
key: button-layout
value: "'appmenu:close'"
- schema: org.gnome.desktop.wm.preferences
key: focus-mode
value: "'click'"
- schema: org.gnome.desktop.wm.preferences
key: focus-new-windows
value: "'smart'"
- schema: org.gnome.desktop.wm.preferences
key: num-workspaces
value: "4"
- schema: org.gnome.nautilus.preferences
key: click-policy
value: "'double'"
- schema: org.gnome.nautilus.preferences
key: date-time-format
value: "'simple'"
- schema: org.gnome.nautilus.preferences
key: default-folder-viewer
value: "'icon-view'"
- schema: org.gnome.nautilus.preferences
key: default-sort-order
value: "'name'"
- schema: org.gnome.nautilus.preferences
key: recursive-search
value: "'local-only'"
- schema: org.gnome.nautilus.preferences
key: show-create-link
value: "true"
- schema: org.gnome.nautilus.preferences
key: show-delete-permanently
value: "true"
- schema: org.gnome.nautilus.preferences
key: show-directory-item-counts
value: "'local-only'"
- schema: org.gnome.nautilus.preferences
key: show-hidden-files
value: "false"
- schema: org.gnome.nautilus.preferences
key: show-image-thumbnails
value: "'local-only'"
- schema: org.gnome.nautilus.preferences
key: thumbnail-limit
value: "uint64 50"
- schema: org.gnome.nautilus.icon-view
key: captions
value: "['none', 'none', 'none']"
- schema: org.gnome.nautilus.icon-view
key: default-zoom-level
value: "'medium'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: clock-format
value: "'24h'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: date-format
value: "'regular'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: location-mode
value: "'path-bar'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: show-hidden
value: "false"
- schema: org.gtk.gtk4.Settings.FileChooser
key: show-size-column
value: "true"
- schema: org.gtk.gtk4.Settings.FileChooser
key: show-type-column
value: "true"
- schema: org.gtk.gtk4.Settings.FileChooser
key: sort-column
value: "'name'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: sort-directories-first
value: "true"
- schema: org.gtk.gtk4.Settings.FileChooser
key: sort-order
value: "'ascending'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: startup-mode
value: "'recent'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: type-format
value: "'category'"
- schema: org.gtk.gtk4.Settings.FileChooser
key: view-type
value: "'list'"
- schema: org.gnome.settings-daemon.plugins.color
key: night-light-schedule-automatic
value: "false"
- schema: org.gnome.settings-daemon.plugins.power
key: sleep-inactive-ac-timeout
value: "3600"
- schema: org.gnome.settings-daemon.plugins.power
key: sleep-inactive-ac-type
value: "'nothing'"
- schema: org.gnome.system.location
key: enabled
value: "false"
- schema: org.gnome.TextEditor
key: auto-indent
value: "true"
- schema: org.gnome.TextEditor
key: auto-save-delay
value: "uint32 3"
- schema: org.gnome.TextEditor
key: custom-font
value: "'Monospace 11'"
- schema: org.gnome.TextEditor
key: discover-settings
value: "true"
- schema: org.gnome.TextEditor
key: draw-spaces
value: "@as []"
- schema: org.gnome.TextEditor
key: enable-snippets
value: "false"
- schema: org.gnome.TextEditor
key: highlight-current-line
value: "false"
- schema: org.gnome.TextEditor
key: highlight-matching-brackets
value: "true"
- schema: org.gnome.TextEditor
key: indent-style
value: "'tab'"
- schema: org.gnome.TextEditor
key: indent-width
value: "-1"
- schema: org.gnome.TextEditor
key: keybindings
value: "'default'"
- schema: org.gnome.TextEditor
key: line-height
value: "1.2"
- schema: org.gnome.TextEditor
key: recolor-window
value: "true"
- schema: org.gnome.TextEditor
key: restore-session
value: "true"
- schema: org.gnome.TextEditor
key: right-margin-position
value: "uint32 80"
- schema: org.gnome.TextEditor
key: show-grid
value: "false"
- schema: org.gnome.TextEditor
key: show-line-numbers
value: "false"
- schema: org.gnome.TextEditor
key: show-map
value: "false"
- schema: org.gnome.TextEditor
key: show-right-margin
value: "false"
- schema: org.gnome.TextEditor
key: spellcheck
value: "true"
- schema: org.gnome.TextEditor
key: style-scheme
value: "'Adwaita'"
- schema: org.gnome.TextEditor
key: style-variant
value: "'follow'"
- schema: org.gnome.TextEditor
key: tab-width
value: "uint32 8"
- schema: org.gnome.TextEditor
key: use-system-font
value: "true"
- schema: org.gnome.TextEditor
key: wrap-text
value: "true"

View File

@@ -0,0 +1,2 @@
---
hostname: deadalus-win

View File

@@ -0,0 +1,5 @@
---
hostname: deadalus-wsl
host_packages: []
host_enabled_services: []

View File

@@ -1,37 +0,0 @@
---
hostname: deadalus
workstation_wsl_windows_user_home: /mnt/c/Users/FABIOSCOTTODISANTOLO
workstation_ecaas_workspace: "{{ user_home }}/Work/sipo/ecaas"
workstation_cdp_workspace: "{{ user_home }}/Work/sipo/cdp"
workstation_ecaas_git_required_ca: ecaas.datacenter.comune.roma.crt
# Claude Code, Codex and the Cline CLI are the coding agents installed on WSL; every
# other managed agent is disabled. Cline's cross-tool instructions (.agents/AGENTS.md,
# .cline/rules/) and the shared ~/.config/ai context are deployed for the ecaas/cdp
# devcontainers, and the cline npm package is installed by profile_workstation_dev_common.
claude_code_install_enabled: true
claude_code_uninstall_enabled: false
opencode_install_enabled: false
opencode_deploy_enabled: false
opencode_uninstall_enabled: true
codex_install_enabled: true
codex_deploy_enabled: false
codex_uninstall_enabled: false
gemini_cli_install_enabled: false
gemini_cli_deploy_enabled: false
gemini_cli_uninstall_enabled: true
cline_install_enabled: true
cline_deploy_enabled: true
cline_uninstall_enabled: false
ibm_bob_install_enabled: false
ibm_bob_uninstall_enabled: true
host_packages: []
host_enabled_services: []
# Fedora WSL must not receive alternative application runtimes.
fedora_excluded_packages:
- flatpak
fedora_removed_packages:
- flatpak
- snapd

View File

@@ -1,26 +1,26 @@
---
hostname: ikaros
codex_relay_install_enabled: false
codex_relay_uninstall_enabled: true
gemini_cli_install_enabled: false
gemini_cli_deploy_enabled: false
gemini_cli_uninstall_enabled: true
chatgpt_desktop_install_enabled: true
desktop_ai_media_enabled: true
desktop_ai_media_external_storage_enabled: true
desktop_ai_media_external_luks_uuid: 6948c504-2d60-4cc8-9e7f-3ccdf28e80d7
desktop_ai_media_external_mountpoint: /run/media/fscotto/Backup
desktop_ai_media_external_source: /run/media/fscotto/Backup/ai-media
desktop_sessions_enabled:
- i3
- sway
desktop_default_session: i3
desktop_default_session_env: xorg
host_packages:
- podman
- openssh-clients
- openssh-server
- mesa-vulkan-drivers
- openssh
- mesa-dri
- vulkan-loader
- mesa-vulkan-radeon
- mesa-vaapi
- xf86-video-amdgpu
host_firewalld_rich_rules:
- rule family="ipv4" source address="192.168.0.0/24" service name="ssh" accept
host_ufw_rules:
- rule: allow
port: "22"
proto: tcp
src: "192.168.0.0/24"
host_sshd_settings:
PermitRootLogin: "no"
@@ -33,258 +33,10 @@ host_sshd_allow_users:
host_authorized_ssh_keys: "{{ vault_ikaros_authorized_ssh_keys | default([]) }}"
host_i3_dotfiles:
- src: .config/autorandr/
dest: .config/autorandr/
mode: preserve
host_enabled_services:
- sshd
# Host-local GNOME preferences captured from ikaros' live session. Keep these
# here rather than in desktop_gnome so nymph remains unmanaged for GNOME
# settings until it has its own real-use tuning.
gnome_gsettings_settings:
- schema: org.gnome.GWeather4
key: temperature-unit
value: "'centigrade'"
- schema: org.gnome.Ptyxis
key: cursor-shape
value: "'block'"
- schema: org.gnome.Ptyxis
key: default-columns
value: "uint32 140"
- schema: org.gnome.Ptyxis
key: default-profile-uuid
value: "'caa3c49ba73a208b4c4b64b56a5cd0af'"
- schema: org.gnome.Ptyxis
key: default-rows
value: "uint32 35"
- schema: org.gnome.Ptyxis
key: font-name
value: "'JetBrainsMono Nerd Font 14'"
- schema: org.gnome.Ptyxis
key: new-tab-position
value: "'last'"
- schema: org.gnome.Ptyxis
key: profile-uuids
value: "['caa3c49ba73a208b4c4b64b56a5cd0af']"
- schema: org.gnome.Ptyxis
key: restore-session
value: "false"
- schema: org.gnome.Ptyxis
key: restore-window-size
value: "false"
- schema: org.gnome.Ptyxis
key: use-system-font
value: "false"
- schema: org.gnome.Ptyxis.Profile
path: /org/gnome/Ptyxis/Profiles/caa3c49ba73a208b4c4b64b56a5cd0af/
key: bold-is-bright
value: "true"
- schema: org.gnome.Ptyxis.Profile
path: /org/gnome/Ptyxis/Profiles/caa3c49ba73a208b4c4b64b56a5cd0af/
key: label
value: "'Default'"
- schema: org.gnome.Ptyxis.Profile
path: /org/gnome/Ptyxis/Profiles/caa3c49ba73a208b4c4b64b56a5cd0af/
key: palette
value: "'linux'"
- schema: org.gnome.Ptyxis.Profile
path: /org/gnome/Ptyxis/Profiles/caa3c49ba73a208b4c4b64b56a5cd0af/
key: scroll-on-output
value: "true"
- schema: org.gnome.TextEditor
key: highlight-current-line
value: "true"
- schema: org.gnome.TextEditor
key: indent-style
value: "'space'"
- schema: org.gnome.TextEditor
key: indent-width
value: "-1"
- schema: org.gnome.TextEditor
key: right-margin-position
value: "uint32 120"
- schema: org.gnome.TextEditor
key: show-line-numbers
value: "true"
- schema: org.gnome.TextEditor
key: show-right-margin
value: "true"
- schema: org.gnome.TextEditor
key: tab-width
value: "uint32 4"
- schema: org.gnome.desktop.background
key: picture-options
value: "'zoom'"
- schema: org.gnome.desktop.background
key: picture-uri
value: "'file:///usr/share/backgrounds/gnome/morphogenesis-l.svg'"
- schema: org.gnome.desktop.background
key: picture-uri-dark
value: "'file:///usr/share/backgrounds/gnome/morphogenesis-d.svg'"
- schema: org.gnome.desktop.datetime
key: automatic-timezone
value: "true"
- schema: org.gnome.desktop.input-sources
key: sources
value: "[('xkb', 'us+alt-intl')]"
- schema: org.gnome.desktop.interface
key: accent-color
value: "'blue'"
- schema: org.gnome.desktop.interface
key: color-scheme
value: "'prefer-dark'"
- schema: org.gnome.desktop.peripherals.touchpad
key: two-finger-scrolling-enabled
value: "true"
- schema: org.gnome.desktop.privacy
key: remove-old-temp-files
value: "true"
- schema: org.gnome.desktop.privacy
key: remove-old-trash-files
value: "true"
- schema: org.gnome.desktop.privacy
key: report-technical-problems
value: "false"
- schema: org.gnome.desktop.screensaver
key: picture-options
value: "'zoom'"
- schema: org.gnome.desktop.screensaver
key: picture-uri
value: "'file:///usr/share/backgrounds/gnome/morphogenesis-l.svg'"
- schema: org.gnome.desktop.search-providers
key: sort-order
value: "['org.gnome.Settings.desktop', 'org.gnome.Contacts.desktop', 'org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'org.gnome.seahorse.Application.desktop', 'org.gnome.Calculator.desktop', 'org.gnome.Calendar.desktop', 'org.gnome.Software.desktop', 'org.gnome.Characters.desktop', 'org.gnome.Boxes.desktop', 'org.gnome.clocks.desktop', 'com.mattjakeman.ExtensionManager.desktop']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-1
value: "['<Super>1']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-2
value: "['<Super>2']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-3
value: "['<Super>3']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-4
value: "['<Super>4']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-5
value: "['<Super>5']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-6
value: "['<Super>6']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-7
value: "['<Super>7']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-8
value: "['<Super>8']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-9
value: "['<Super>9']"
- schema: org.gnome.desktop.wm.keybindings
key: switch-to-workspace-10
value: "['<Super>0']"
- schema: org.gnome.meld
key: highlight-current-line
value: "true"
- schema: org.gnome.meld
key: highlight-syntax
value: "true"
- schema: org.gnome.meld
key: indent-width
value: "4"
- schema: org.gnome.meld
key: insert-spaces-instead-of-tabs
value: "true"
- schema: org.gnome.meld
key: prefer-dark-theme
value: "true"
- schema: org.gnome.meld
key: show-line-numbers
value: "true"
- schema: org.gnome.meld
key: style-scheme
value: "'meld-dark'"
- schema: org.gnome.meld
key: wrap-mode
value: "'none'"
- schema: org.gnome.nautilus.list-view
key: default-zoom-level
value: "'large'"
- schema: org.gnome.nautilus.list-view
key: use-tree-view
value: "false"
- schema: org.gnome.nautilus.preferences
key: default-folder-viewer
value: "'icon-view'"
- schema: org.gnome.nautilus.preferences
key: show-create-link
value: "true"
- schema: org.gnome.nautilus.preferences
key: show-delete-permanently
value: "true"
- schema: org.gnome.settings-daemon.plugins.color
key: night-light-enabled
value: "true"
- schema: org.gnome.settings-daemon.plugins.media-keys
key: custom-keybindings
value: "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
- schema: org.gnome.settings-daemon.plugins.media-keys.custom-keybinding
path: /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/
key: binding
value: "'<Super>Return'"
- schema: org.gnome.settings-daemon.plugins.media-keys.custom-keybinding
path: /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/
key: command
value: "'ptyxis'"
- schema: org.gnome.settings-daemon.plugins.media-keys.custom-keybinding
path: /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/
key: name
value: "'Launch Terminal'"
- schema: org.gnome.shell
key: app-picker-layout
value: >-
[{'System': <{'position': <0>}>, 'Utilities': <{'position': <1>}>, 'org.fedoraproject.MediaWriter.desktop': <{'position': <2>}>, 'org.gnome.Contacts.desktop': <{'position': <3>}>, 'org.gnome.Calendar.desktop': <{'position': <4>}>, 'org.gnome.Calculator.desktop': <{'position': <5>}>, 'org.gnome.Weather.desktop': <{'position': <6>}>, 'org.gnome.clocks.desktop': <{'position': <7>}>, 'org.gnome.Maps.desktop': <{'position': <8>}>, 'org.gnome.SimpleScan.desktop': <{'position': <9>}>, 'org.gnome.TextEditor.desktop': <{'position': <10>}>, 'org.gnome.Settings.desktop': <{'position': <11>}>, 'org.gnome.Boxes.desktop': <{'position': <12>}>, 'org.gnome.Showtime.desktop': <{'position': <13>}>, 'org.gnome.Snapshot.desktop': <{'position': <14>}>, 'org.gnome.Characters.desktop': <{'position': <15>}>, 'org.gnome.Tour.desktop': <{'position': <16>}>, 'org.gnome.Yelp.desktop': <{'position': <17>}>, 'org.gnome.Software.desktop': <{'position': <18>}>, 'be.alexandervanhee.gradia.desktop': <{'position': <19>}>, 'com.github.jeromerobert.pdfarranger.desktop': <{'position': <20>}>, 'org.onlyoffice.desktopeditors.desktop': <{'position': <21>}>, 'org.gnome.Meld.desktop': <{'position': <22>}>, 'com.mattjakeman.ExtensionManager.desktop': <{'position': <23>}>}, {'com.raspberrypi.rpi-imager.desktop': <{'position': <0>}>, 'org.remmina.Remmina.desktop': <{'position': <1>}>, 'com.nextcloud.desktopclient.nextcloud.desktop': <{'position': <2>}>, 'syncthing-start.desktop': <{'position': <3>}>, 'syncthing-ui.desktop': <{'position': <4>}>, 'emacs.desktop': <{'position': <5>}>, 'emacs-client.desktop': <{'position': <6>}>, 'chatgpt.desktop': <{'position': <7>}>, 'org.gnome.gitlab.somas.Apostrophe.desktop': <{'position': <8>}>, 'mpv.desktop': <{'position': <9>}>, 'htop.desktop': <{'position': <10>}>, 'ai-media-facefusion.desktop': <{'position': <11>}>, 'ai-media-rvc.desktop': <{'position': <12>}>}]
- schema: org.gnome.shell
key: disabled-extensions
value: >-
['window-list@gnome-shell-extensions.gcampax.github.com', 'background-logo@fedorahosted.org', 'apps-menu@gnome-shell-extensions.gcampax.github.com', 'places-menu@gnome-shell-extensions.gcampax.github.com', 'maximize-new-windows@VitalyOstanin']
- schema: org.gnome.shell
key: enabled-extensions
value: >-
['status-icons@gnome-shell-extensions.gcampax.github.com', 'gnome-ui-tune@itstime.tech', 'appindicatorsupport@rgcjonas.gmail.com', 'bluetooth-battery-monitor@v8v88v8v88.com', 'clipboard-indicator@tudmotu.com', 'status-area-horizontal-spacing@mathematical.coffee.gmail.com', 'MaximizeWindowIntoNewWorkspace@kyleross.com', 'gnome-shell-extension-maximized-by-default@stiggimy.github.com']
- schema: org.gnome.shell
key: favorite-apps
value: >-
['org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'com.spotify.Client.desktop', 'net.thunderbird.Thunderbird.desktop', 'org.telegram.desktop.desktop', 'Cline.desktop', 'org.desktop_plus.desktop-plus.desktop', 'com.microsoft.VSCode.desktop', 'org.gnome.Ptyxis.desktop', 'virt-manager.desktop']
- schema: org.gnome.shell
key: remember-mount-password
value: "true"
- schema: org.gnome.shell.keybindings
key: switch-to-application-1
value: "@as []"
- schema: org.gnome.shell.keybindings
key: switch-to-application-2
value: "@as []"
- schema: org.gnome.shell.keybindings
key: switch-to-application-3
value: "@as []"
- schema: org.gnome.shell.keybindings
key: switch-to-application-4
value: "@as []"
- schema: org.gnome.shell.keybindings
key: switch-to-application-5
value: "@as []"
- schema: org.gnome.shell.keybindings
key: switch-to-application-6
value: "@as []"
- schema: org.gnome.shell.keybindings
key: switch-to-application-7
value: "@as []"
- schema: org.gnome.shell.keybindings
key: switch-to-application-8
value: "@as []"
- schema: org.gnome.shell.keybindings
key: switch-to-application-9
value: "@as []"
- schema: org.gnome.system.location
key: enabled
value: "true"

View File

@@ -1,16 +1,44 @@
---
hostname: nymph
codex_relay_install_enabled: false
codex_relay_uninstall_enabled: true
gemini_cli_install_enabled: false
gemini_cli_deploy_enabled: false
gemini_cli_uninstall_enabled: true
desktop_sessions_enabled:
- i3
- sway
chatgpt_desktop_install_enabled: true
desktop_default_session: i3
desktop_default_session_env: xorg
desktop_emptty_session_error_logging: rotate
# Fedora Workstation/GNOME laptop target. GNOME is provided by the base Fedora
# Workstation install; Ansible deploys shared desktop dotfiles but leaves GNOME
# settings unmanaged for now.
host_packages: []
host_enabled_services: []
host_packages:
- nvidia580
- linux-mainline-headers
- mesa-dri
- vulkan-loader
- mesa-vulkan-intel
- intel-video-accel
- power-profiles-daemon
- tlp
- tlp-rdw
- upower
host_enabled_services:
- tlp
host_i3_dotfiles:
- src: .config/autorandr/
dest: .config/autorandr/
mode: preserve
- src: .config/wireplumber/wireplumber.conf.d/60-camera-priority.conf
dest: .config/wireplumber/wireplumber.conf.d/60-camera-priority.conf
mode: "0644"
host_sway_dotfiles:
- src: .config/sway/host.conf
dest: .config/sway/host.conf
mode: "0644"
- src: .config/sway/session-env
dest: .config/sway/session-env
mode: "0644"
- src: .config/kanshi/
dest: .config/kanshi/
mode: preserve

View File

@@ -1,62 +1,5 @@
---
hostname: prometheus
ansible_host: 179.237.102.172
ansible_user: rocky
ansible_port: 22
ansible_ssh_private_key_file: /home/fscotto/.ssh/id_ed25519
server_username: rocky
server_legacy_stack_retired: true
# Destructive deletion runs only with an explicit extra-var and cleanup tag.
server_legacy_cleanup: false
# Explicit opt-in cleanup; no data, volumes, networks or NPM images are removed.
server_legacy_image_cleanup: false
server_legacy_images:
- docker.gitea.com/gitea:1.25.2
- docker.io/deluan/navidrome:latest
- docker.io/library/postgres:13
server_npm_quadlet_stage: true
server_npm_quadlet_image: docker.io/jc21/nginx-proxy-manager@sha256:52b2c59994f3d36acfcf70a1626f29734df0ed8c71bacc0269f78b6f939858bb
# The stopped-source export and live Quadlet cutover passed on 2026-10-03.
server_npm_quadlet_cutover: true
server_backup_export_enabled: true
server_backup_export_start_timer: true
# Install the final-copy helper only; it is never run by a normal playbook invocation.
server_gitea_proxy_enabled: true
server_gitea_on_atlas: true
server_gitea_npm_domains:
- git.fscotto.duckdns.org
server_ssh_authorized_keys:
- name: ikaros
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINrIxXjA3ffPwziKGR5gzc4gAoBehQPlnEMcXF4Wl0ZS ikaros"
- name: nymph
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEH/7GJfGt0ZVmKeEzceoFkFkeCXFryKK9vAbaip+HCx nymph"
- name: siren
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA95wYlzpfN3rjUhpMeP4KHn8I6ZrjQXoDTgwgRIa++b siren"
wireguard_overlay_enabled: true
wireguard_address: 10.0.0.1/24
wireguard_listen_port: 51820
wireguard_enable_ipv4_forwarding: true
wireguard_reload_rootful_podman_networks: true
wireguard_peers:
- name: aegis
host: aegis
# TODO: Aggiungere VIP di Uranus in futuro
allowed_ips:
- 10.0.0.2/32
- 192.168.178.0/24
host_packages:
- cockpit
- cockpit-navigator
- cockpit-podman
- cockpit-storaged
- realmd
- pcp
- python3-pcp
- setroubleshoot-server
host_enabled_services:
- cockpit.socket
- pmlogger.service
host_packages: []
host_enabled_services: []

View File

@@ -1,42 +1,7 @@
---
all:
children:
platform_void:
hosts: {}
platform_fedora:
hosts:
ikaros:
ansible_connection: local
nymph:
ansible_connection: local
deadalus:
ansible_connection: local
platform_fedora_iot:
hosts:
aegis:
platform_rocky:
hosts:
atlas:
children:
rocky_server:
void:
children:
platform_void:
fedora:
children:
platform_fedora:
platform_fedora_iot:
rocky:
children:
platform_rocky:
graphical_desktop:
hosts:
ikaros:
ansible_connection: local
@@ -44,63 +9,79 @@ all:
ansible_connection: local
desktop:
children:
graphical_desktop:
role_personal_workstation:
hosts:
ikaros:
ansible_connection: local
role_aegis:
hosts:
aegis:
desktop_sway:
hosts: {}
desktop_niri:
hosts: {}
desktop_gnome:
hosts:
ikaros:
ansible_connection: local
nymph:
ansible_connection: local
ubuntu:
children:
ubuntu_workstation:
workstation_dev_wsl:
ubuntu_server:
fedora:
children:
fedora_workstation:
workstation:
children:
workstation_host:
workstation_dev:
workstation_host:
children:
workstation_host_linux:
workstation_host_windows:
workstation_dev:
children:
workstation_dev_ubuntu:
workstation_dev_fedora:
workstation_dev_wsl:
server:
children:
rocky_server:
ubuntu_server:
ubuntu_workstation:
hosts:
deadalus-ubuntu:
ansible_connection: local
fedora_workstation:
hosts:
deadalus-fedora:
ansible_connection: local
workstation_host_linux:
hosts:
deadalus-ubuntu:
ansible_connection: local
deadalus-fedora:
ansible_connection: local
workstation_dev_ubuntu:
hosts:
deadalus-ubuntu:
ansible_connection: local
workstation_dev_fedora:
hosts:
deadalus:
deadalus-fedora:
ansible_connection: local
workstation_host_windows:
hosts:
deadalus-win:
workstation_dev_wsl:
hosts:
deadalus:
deadalus-wsl:
ansible_connection: local
rocky_server:
ubuntu_server:
hosts:
prometheus:
wireguard_overlay:
hosts:
prometheus:
aegis:
role_backend_phase1:
hosts:
atlas:
ansible_connection: local

View File

@@ -1,14 +0,0 @@
---
desktop_ai_media_enabled: false
desktop_ai_media_root: "{{ user_home }}/.local/share/ai-media"
desktop_ai_media_build_root: "{{ user_home }}/.local/share/ai-media-build"
desktop_ai_media_external_storage_enabled: false
desktop_ai_media_external_luks_uuid: ""
desktop_ai_media_external_mountpoint: ""
desktop_ai_media_external_source: ""
desktop_ai_media_debian_snapshot: "20261013T000000Z"
desktop_ai_media_base_image: >-
docker.io/library/python@sha256:34386ef0cb081344d7ec1c103ba398e6e9f64e9ab3a1509accc92a4e24a07258
desktop_ai_media_facefusion_revision: 72470819a0373be3388b3929c8f8f311f418fc3c
desktop_ai_media_rvc_revision: 81eed5e8f68b6bed1789f682fe78cdd324495afc
desktop_ai_media_apps: [facefusion, rvc]

View File

@@ -1,56 +0,0 @@
import configparser
import pathlib
import re
import sys
import xml.etree.ElementTree as ET
root = pathlib.Path(sys.argv[1]).resolve()
home = pathlib.Path.home()
local_filesystems = {
"btrfs", "ext2", "ext3", "ext4", "xfs", "zfs", "tmpfs", "overlay",
"ramfs", "ntfs3", "vfat", "exfat",
}
mounts = []
for line in pathlib.Path("/proc/self/mountinfo").read_text().splitlines():
fields, description = line.split(" - ", 1)
mount = re.sub(r"\\([0-7]{3})", lambda m: chr(int(m[1], 8)), fields.split()[4])
mounts.append((pathlib.Path(mount), description.split()[0]))
automount_at_root = any(p == root and kind == "autofs" for p, kind in mounts)
backing_mount_at_root = any(
p == root and kind != "autofs" for p, kind in mounts
)
if automount_at_root and not backing_mount_at_root:
raise SystemExit("Media storage is not mounted; refusing to start")
covering = [
(p, kind) for p, kind in mounts
if kind != "autofs" and (root == p or root.is_relative_to(p))
]
if covering:
selected = max(covering, key=lambda entry: len(entry[0].parts))
if selected[1] not in local_filesystems:
raise SystemExit("Media storage is not on a local filesystem; refusing to start")
for mount, kind in mounts:
if mount == root and kind == "autofs":
continue
if mount.is_relative_to(root) and kind not in local_filesystems:
raise SystemExit("Non-local mount beneath media storage; refusing to start")
sync_roots = []
nextcloud = home / ".config/Nextcloud/nextcloud.cfg"
if nextcloud.exists():
configuration = configparser.ConfigParser(interpolation=None, strict=False)
configuration.read(nextcloud)
for section in configuration.sections():
for key, value in configuration.items(section):
if key.lower().endswith("localpath"):
sync_roots.append(pathlib.Path(value).expanduser().resolve())
for configuration in (
home / ".config/syncthing/config.xml",
home / ".local/state/syncthing/config.xml",
):
if configuration.exists():
for folder in ET.parse(configuration).getroot().findall("folder"):
if folder.get("path"):
sync_roots.append(pathlib.Path(folder.get("path")).expanduser().resolve())
for path in sync_roots:
if root == path or root.is_relative_to(path) or path.is_relative_to(root):
raise SystemExit("Media storage overlaps a Nextcloud/Syncthing folder; refusing to start")

View File

@@ -1,88 +0,0 @@
import hashlib
import pathlib
import sys
import zipfile
app = sys.argv[1]
root = pathlib.Path("/opt/app")
if app == "facefusion":
sys.path.insert(0, str(root))
from facefusion import state_manager
from facefusion.args import apply_args
from facefusion.program import create_program
from facefusion.core import common_pre_check, processors_pre_check
args = vars(create_program().parse_args([
"run", "--execution-providers", "cpu",
"--processors", "face_swapper",
]))
apply_args(args, state_manager.init_item)
if not common_pre_check() or not processors_pre_check():
raise RuntimeError("FaceFusion model preparation failed")
else:
for relative in (
"hubert_base/config.json",
"hubert_base/preprocessor_config.json",
"hubert_base/pytorch_model.bin",
"rmvpe.pt",
):
destination = root / "assets" / relative
if relative == "rmvpe.pt":
destination = root / "assets/rmvpe/rmvpe.pt"
destination.parent.mkdir(parents=True, exist_ok=True)
if not destination.is_file():
raise FileNotFoundError("Missing checksum-pinned public model: " + str(destination))
for directory in ("weights", "indices", "pretrained", "pretrained_v2", "pymss_weights"):
(root / "assets" / directory).mkdir(parents=True, exist_ok=True)
# Mutable working data stays outside the immutable application tree.
for name, destination in (
("TEMP", "/tmp/rvc-temp"),
("assets/weights", "/work/state/weights"),
("logs", "/work/state"),
):
path = root / name
if path.exists():
import shutil
shutil.rmtree(path)
path.symlink_to(destination)
# Expose only separation models that are actually baked into this image.
separation = root / "tools/pymss_webui.py"
original = "PYMSS_MODEL_CHOICES = [spec.label for spec in MODEL_SPECS]"
replacement = """PYMSS_MODEL_CHOICES = [
spec.label for spec in MODEL_SPECS
if (weight_pymss_root / spec.model_file).is_file()
and (weight_pymss_root / spec.config_file).is_file()
]"""
code = separation.read_text()
if code.count(original) != 1:
raise RuntimeError("Pinned RVC separation model selector has changed")
separation.write_text(code.replace(original, replacement))
webui = root / "webui.py"
code = webui.read_text()
for label, destination in (
("主结果文件夹", "/work/output/vocals"),
("分离残余文件夹", "/work/output/instrumental"),
):
original = 'label=i18n("' + label + '"), value="opt"'
if code.count(original) != 1:
raise RuntimeError("Pinned RVC separation output selector has changed")
code = code.replace(original, 'label=i18n("' + label + '"), value="' + destination + '"')
webui.write_text(code)
# Bake only the public silence fixture; personal datasets never enter the build.
with zipfile.ZipFile(root / "assets/mute.zip") as archive:
destination = pathlib.Path("/opt/training-fixture")
for entry in archive.infolist():
target = (destination / entry.filename).resolve()
if not target.is_relative_to(destination):
raise ValueError("Invalid public silence archive member")
archive.extractall(destination)
with open("/opt/model-checksums.sha256", "w") as manifest:
for directory in (root / ".assets", root / "assets"):
if directory.exists():
for path in sorted(directory.rglob("*")):
if path.is_file():
digest = hashlib.file_digest(path.open("rb"), "sha256").hexdigest()
manifest.write(digest + " " + str(path) + "\n")

View File

@@ -1,384 +0,0 @@
"""Small host-side orchestrator for offline ai-media presets."""
import argparse
from datetime import datetime
import ipaddress
import json
import os
from pathlib import Path
import re
import shutil
import subprocess
import sys
from urllib.parse import urlsplit
import uuid
NAME = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]*\Z")
SOURCE_NAMES = tuple(f"source{number}.jpg" for number in range(11, 19))
def video_url(value):
parsed = urlsplit(value)
if parsed.scheme not in ("http", "https") or not parsed.hostname or parsed.username or parsed.password:
raise ValueError("Use an HTTP(S) video URL without embedded credentials")
host = parsed.hostname.lower().rstrip(".")
if host == "localhost" or host.endswith(".localhost"):
raise ValueError("Local URLs are not accepted")
try:
address = ipaddress.ip_address(host)
except ValueError:
pass
else:
if not address.is_global:
raise ValueError("Private or local IP URLs are not accepted")
return value
def media_file(root, name, *, video=False):
if not NAME.fullmatch(name) or name in (".", ".."):
raise ValueError("Use a simple filename in the ai-media input directory")
path = root / "input" / name
if not path.is_file() or path.is_symlink():
raise FileNotFoundError(path)
if video and path.suffix.lower() != ".mp4":
raise ValueError("The video must be an MP4 file")
return path
def audio_file(root, name):
if not name or any(not NAME.fullmatch(part) or part in (".", "..")
for part in name.split("/")):
raise ValueError("Use an audio path relative to input/ or output/ without traversal")
matches = [root / directory / name for directory in ("input", "output")]
matches = [path for path in matches if path.is_file() and path.resolve() == path]
if len(matches) != 1:
raise ValueError("Audio must exist in exactly one of input/ or output/")
return matches[0]
def container_path(root, path):
directory = path.relative_to(root).parts[0]
if directory not in ("input", "output"):
raise ValueError("Media path outside input/output")
return "/work/" + str(path.relative_to(root))
def run(*command):
print("+", " ".join(map(str, command)), flush=True)
subprocess.run([str(part) for part in command], check=True)
def has_stream(path, kind):
result = subprocess.run([
"ffprobe", "-v", "error", "-show_entries", "stream=codec_type",
"-of", "json", str(path),
], check=True, capture_output=True, text=True)
return kind in [stream["codec_type"] for stream in json.loads(result.stdout)["streams"]]
def probe(path, kind):
if not has_stream(path, kind):
raise RuntimeError(f"Missing {kind} stream: {path}")
def duration(path):
result = subprocess.run([
"ffprobe", "-v", "error", "-show_entries", "format=duration",
"-of", "default=noprint_wrappers=1:nokey=1", str(path),
], check=True, capture_output=True, text=True)
return float(result.stdout.strip())
def output_path(root, video, suffix, extension="mp4"):
return root / "output" / f"{video.stem}-{suffix}.{extension}"
def mix_target(root, args):
name = args.output or f"{Path(args.vocals).stem}-mix.wav"
return wav_target(root, name)
def wav_target(root, name):
if not NAME.fullmatch(name) or Path(name).suffix.lower() != ".wav":
raise ValueError("Use a simple WAV output filename")
target = root / "output" / name
if target.exists() or target.is_symlink():
raise FileExistsError(target)
return target
def process_voice(args, root, launcher):
source = audio_file(root, args.audio)
probe(source, "audio")
target = wav_target(root, args.output or f"{source.stem}-mia_voce.wav")
job = root / "output" / f".{source.stem}-voice-convert-{args.job_id}"
job.mkdir(mode=0o700)
print("Working directory:", job, flush=True)
prepared = job / "audio.wav"
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
"-i", container_path(root, source), "-map", "0:a:0", "-vn",
"-c:a", "pcm_s16le", container_path(root, prepared))
run(launcher, "rvc", "cli", container_path(root, prepared),
container_path(root, job), "--convert-only")
converted = job / "vocals-mia_voce.wav"
probe(converted, "audio")
os.link(converted, target)
return target
def process_mix(args, root, launcher):
vocals = audio_file(root, args.vocals)
instrumental = audio_file(root, args.instrumental)
target = mix_target(root, args)
for source in (vocals, instrumental):
probe(source, "audio")
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
"-i", container_path(root, vocals), "-i", container_path(root, instrumental),
"-filter_complex", "[0:a][1:a]amix=inputs=2:duration=longest:normalize=0[a]",
"-map", "[a]", "-c:a", "pcm_s16le", container_path(root, target))
probe(target, "audio")
return target
def mux(launcher, root, video, audio, target):
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
"-i", container_path(root, video), "-i", container_path(root, audio),
"-map", "0:v:0", "-map", "1:a:0", "-c:v", "copy", "-c:a", "aac",
"-b:a", "192k", "-shortest", "-movflags", "+faststart",
container_path(root, target))
probe(target, "video")
probe(target, "audio")
def download_video(root, url, job_id):
video_url(url)
if not job_id or not NAME.fullmatch(job_id):
raise ValueError("Invalid job ID")
if shutil.which("yt-dlp") is None:
raise RuntimeError("yt-dlp is required for URL downloads")
prefix = f"download-{job_id}"
destination = root / "input" / f"{prefix}.mp4"
if list((root / "input").glob(prefix + ".*")):
raise FileExistsError(destination)
print("Downloading one video into input/ with yt-dlp", flush=True)
subprocess.run([
"yt-dlp", "--ignore-config", "--no-playlist", "--no-overwrites",
"--no-progress", "-t", "mp4", "--recode-video", "mp4",
"--output", str(root / "input" / f"{prefix}.%(ext)s"), url,
], check=True)
if not destination.is_file() or destination.is_symlink():
raise RuntimeError("yt-dlp did not produce the expected MP4 in input/")
probe(destination, "video")
return destination
def process_split(args, root, launcher, video):
probe(video, "audio")
target = root / "output" / f"{video.stem}-{args.preset}"
if target.exists():
raise FileExistsError(target)
job = root / "output" / f".{video.stem}-{args.preset}-{args.job_id}"
job.mkdir(mode=0o700)
print("Working directory:", job, flush=True)
silent = job / "video.mp4"
audio = job / "audio.wav"
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
"-i", container_path(root, video), "-map", "0:v:0", "-c:v", "copy",
"-an", "-movflags", "+faststart", container_path(root, silent))
probe(silent, "video")
if has_stream(silent, "audio"):
raise RuntimeError("Unexpected audio stream in split video")
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
"-i", container_path(root, video), "-map", "0:a:0", "-vn",
"-c:a", "pcm_s16le", container_path(root, audio))
probe(audio, "audio")
files = {"video.mp4": silent, "audio.wav": audio}
if args.preset == "split-stems":
run(launcher, "rvc", "cli", container_path(root, audio),
container_path(root, job), "--separate-only")
for stem in ("vocals", "instrumental"):
matches = list((job / stem).glob("*.wav"))
if len(matches) != 1:
raise RuntimeError(f"Expected exactly one {stem} stem")
probe(matches[0], "audio")
files[f"{stem}.wav"] = matches[0]
# Publish only after every processing step and stream check succeeded.
target.mkdir(mode=0o700)
for name, source in files.items():
os.link(source, target / name)
return target
def process(args, root, launcher):
video = media_file(root, args.video, video=True)
probe(video, "video")
if args.preset in ("split", "split-stems"):
return process_split(args, root, launcher, video)
if args.preset == "merge":
audio = audio_file(root, args.audio)
probe(audio, "audio")
target = output_path(root, video, "unito")
if target.exists():
raise FileExistsError(target)
mux(launcher, root, video, audio, target)
return target
suffix = "mia_voce" if args.preset == "audio-convert" else "facefusion"
target = output_path(root, video, suffix, "wav" if args.preset == "audio-convert" else "mp4")
if target.exists():
raise FileExistsError(target)
job = root / "output" / f".{video.stem}-{suffix}-{args.job_id}"
job.mkdir(mode=0o700)
print("Working directory:", job, flush=True)
if args.preset == "audio-convert":
probe(video, "audio")
extracted = job / "audio.wav"
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
"-i", container_path(root, video), "-vn", "-c:a", "pcm_s16le",
container_path(root, extracted))
run(launcher, "rvc", "cli", container_path(root, extracted), container_path(root, job))
instrumental = list((job / "instrumental").glob("*.wav"))
if len(instrumental) != 1:
raise RuntimeError("Expected exactly one instrumental stem")
converted = job / "vocals-mia_voce.wav"
probe(converted, "audio")
mixed = job / "mix.wav"
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
"-i", container_path(root, instrumental[0]),
"-i", container_path(root, converted),
"-filter_complex", "[0:a][1:a]amix=inputs=2:duration=longest:normalize=0[a]",
"-map", "[a]", "-c:a", "pcm_s16le", container_path(root, mixed))
probe(mixed, "audio")
os.link(mixed, target)
else:
original_has_audio = has_stream(video, "audio")
sources = [media_file(root, name) for name in SOURCE_NAMES]
processed = job / "swapped.mp4"
run(launcher, "facefusion", "cli", "headless-run",
"--source-paths", *[container_path(root, path) for path in sources],
"--target-path", container_path(root, video),
"--output-path", container_path(root, processed),
"--processors", "face_swapper", "--face-swapper-model", "hyperswap_1a_256",
"--face-swapper-pixel-boost", "256x256", "--face-swapper-weight", "0.5",
"--face-detector-model", "yolo_face", "--face-detector-size", "640x640",
"--face-detector-angles", "0", "90", "180", "270",
"--face-detector-score", "0.5", "--face-selector-mode", "one",
"--face-selector-order", "large-small", "--face-selector-gender", "female",
"--face-selector-race", "white",
"--face-mask-types", "occlusion", "region", "area", "box",
"--face-occluder-model", "xseg_1",
"--face-parser-model", "bisenet_resnet_34", "--face-mask-blur", "0.3",
"--output-video-encoder", "libx264", "--output-video-preset", "veryfast",
"--output-video-quality", "80", "--output-video-fps", "30",
"--execution-providers", "cpu", "--output-audio-encoder", "aac",
"--jobs-path", "/work/state", "--temp-path", "/work/state/tmp")
probe(processed, "video")
if abs(duration(processed) - duration(video)) > 0.5:
raise RuntimeError("FaceFusion output duration differs from the input; refusing a partial result")
if original_has_audio:
# Restore the original soundtrack explicitly. Some completed
# FaceFusion jobs have produced video-only MP4 files.
mux(launcher, root, processed, video, target)
else:
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
"-i", container_path(root, processed), "-map", "0:v:0",
"-c:v", "copy", "-an", "-movflags", "+faststart",
container_path(root, target))
probe(target, "video")
if has_stream(target, "audio"):
raise RuntimeError("Unexpected audio stream in silent FaceFusion output")
return target
def process_complete(args, root, launcher):
video = media_file(root, args.video, video=True)
if not has_stream(video, "audio"):
raise RuntimeError("The video has no audio to convert")
common = {"video": video.name, "job_id": args.job_id}
audio = process(argparse.Namespace(preset="audio-convert", **common), root, launcher)
swapped = process(argparse.Namespace(preset="video-convert", **common), root, launcher)
target = output_path(root, video, "completo")
if target.exists():
raise FileExistsError(target)
mux(launcher, root, swapped, audio, target)
return target
def main():
parser = argparse.ArgumentParser(prog="ai-media preset")
parser.add_argument("root", type=Path, help=argparse.SUPPRESS)
parser.add_argument("launcher", type=Path, help=argparse.SUPPRESS)
parser.add_argument("--run", action="store_true", help=argparse.SUPPRESS)
parser.add_argument("--job-id", help=argparse.SUPPRESS)
sub = parser.add_subparsers(dest="preset", required=True)
for name in ("audio-convert", "video-convert", "merge", "split", "split-stems", "convert"):
command = sub.add_parser(name)
command.add_argument("video", help="MP4 filename inside input/ or HTTP(S) video URL")
if name == "merge":
command.add_argument("audio", help="unique audio filename in input/ or output/")
mix = sub.add_parser("mix", help="mix vocal and instrumental audio into one WAV")
mix.add_argument("vocals", help="vocal audio path relative to input/ or output/")
mix.add_argument("instrumental", help="instrumental audio path relative to input/ or output/")
mix.add_argument("--output", help="WAV filename in output/ (default: <vocals>-mix.wav)")
voice = sub.add_parser("voice-convert", help="apply mia_voce directly to an audio file")
voice.add_argument("audio", help="audio path relative to input/ or output/")
voice.add_argument("--output", help="WAV filename in output/ (default: <audio>-mia_voce.wav)")
args = parser.parse_args()
root = args.root.resolve(strict=True)
launcher = args.launcher.resolve(strict=True)
audio_only = args.preset in ("mix", "voice-convert")
remote_video = not audio_only and not NAME.fullmatch(args.video)
if args.preset == "voice-convert":
source = audio_file(root, args.audio)
wav_target(root, args.output or f"{source.stem}-mia_voce.wav")
preset_inputs = [args.audio]
if args.output:
preset_inputs += ["--output", args.output]
elif args.preset == "mix":
audio_file(root, args.vocals)
audio_file(root, args.instrumental)
mix_target(root, args)
preset_inputs = [args.vocals, args.instrumental]
if args.output:
preset_inputs += ["--output", args.output]
elif remote_video:
video_url(args.video)
if shutil.which("yt-dlp") is None:
raise RuntimeError("yt-dlp is required for URL downloads")
else:
media_file(root, args.video, video=True)
if not audio_only:
preset_inputs = [args.video] + ([args.audio] if args.preset == "merge" else [])
if args.preset == "merge":
audio_file(root, args.audio)
if args.preset in ("video-convert", "convert"):
for name in SOURCE_NAMES:
media_file(root, name)
if args.run:
if remote_video:
args.video = download_video(root, args.video, args.job_id).name
if args.preset == "voice-convert":
result = process_voice(args, root, launcher)
elif args.preset == "mix":
result = process_mix(args, root, launcher)
else:
result = (process_complete(args, root, launcher)
if args.preset == "convert" else process(args, root, launcher))
print("Completed:", result, flush=True)
return
unit = "ai-media-preset-" + datetime.now().strftime("%Y%m%d-%H%M%S") + "-" + uuid.uuid4().hex[:8]
subprocess.run(["systemd-run", "--user", "--collect", f"--unit={unit}",
"--property=Type=exec", "--property=Restart=no",
"/usr/bin/python3", str(Path(__file__).resolve()), str(root), str(launcher),
"--run", "--job-id", unit, args.preset,
*preset_inputs], check=True)
print("Job:", unit)
print("Logs: journalctl --user -fu", unit)
if __name__ == "__main__":
try:
main()
except (ValueError, FileNotFoundError, FileExistsError, subprocess.CalledProcessError) as error:
raise SystemExit(str(error)) from error

View File

@@ -1,94 +0,0 @@
"""Offline RVC worker for the voice preset (runs inside the RVC container)."""
import argparse
import os
from pathlib import Path
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument("input_wav", type=Path)
parser.add_argument("job_dir", type=Path)
mode = parser.add_mutually_exclusive_group()
mode.add_argument("--separate-only", action="store_true")
mode.add_argument("--convert-only", action="store_true")
args = parser.parse_args()
source = args.input_wav.resolve(strict=True)
job = args.job_dir.resolve(strict=True)
output = Path("/work/output").resolve(strict=True)
if not source.is_relative_to(output) or not job.is_relative_to(output):
raise ValueError("RVC preset paths must be inside /work/output")
if source.parent != job or not source.is_file():
raise ValueError("Expected the extracted WAV inside the job directory")
weights = Path("/work/state/weights/mia_voce.pth")
index = Path("/work/state/mia_voce/added_IVF256_Flat_nprobe_1_mia_voce_v2.index")
if not args.separate_only and not weights.is_file():
raise FileNotFoundError(weights)
if not args.separate_only and not index.is_file():
raise FileNotFoundError(index)
os.environ.update(
weight_root="/work/state/weights",
outside_index_root="/work/models/indices",
index_root="/work/state",
weight_pymss_root="/opt/app/assets/pymss_weights",
rmvpe_root="/opt/app/assets/rmvpe",
OMP_NUM_THREADS="4",
MKL_NUM_THREADS="4",
)
# The pinned WebUI imports its own argparse configuration at module load.
sys.argv = sys.argv[:1]
vocal_source = source
if not args.convert_only:
from tools.pymss_webui import pymss_separate
vocals_dir = job / "vocals"
instrumental_dir = job / "instrumental"
vocals_dir.mkdir()
instrumental_dir.mkdir()
failures = []
def on_event(event):
if event.get("event") in ("fatal", "cancelled", "busy"):
failures.append(event.get("message", str(event)))
for progress in pymss_separate(
"vocals-bs-roformer-368", str(source), str(vocals_dir), None,
str(instrumental_dir), "wav", event_callback=on_event,
):
print(progress, flush=True)
if failures:
raise RuntimeError("RVC separation failed: " + "; ".join(failures))
vocals = list(vocals_dir.glob("*.wav"))
instrumental = list(instrumental_dir.glob("*.wav"))
if len(vocals) != 1 or len(instrumental) != 1:
raise RuntimeError("RVC did not produce exactly one vocal and instrumental stem")
if args.separate_only:
print("Vocal and instrumental stems ready (no voice conversion)", flush=True)
return
vocal_source = vocals[0]
from configs.config import Config
from infer.vc.modules import VC
import soundfile as sf
voice = VC(Config())
voice.get_vc(weights.name)
status, result = voice.vc_single(
0, str(vocal_source), 0, "rmvpe", str(index), 0.75, 0, 1, 0.33,
)
if result is None or result[0] is None or result[1] is None:
raise RuntimeError("RVC voice conversion failed: " + str(status))
converted = job / "vocals-mia_voce.wav"
sf.write(converted, result[1], result[0])
if converted.stat().st_size == 0:
raise RuntimeError("RVC produced an empty converted voice")
print("RVC converted voice ready", flush=True)
if __name__ == "__main__":
main()

View File

@@ -1,63 +0,0 @@
--index-url https://pypi.org/simple
aiofiles==24.1.0
annotated-doc==0.0.5
annotated-types==0.8.0
anyio==4.15.1
brotli==1.2.0
certifi==2026.7.22
click==8.5.0
fastapi==0.143.0
ffmpy==1.0.0
filelock==4.1.1
flatbuffers==25.12.19
fsspec==2026.9.0
gradio==5.50.0
gradio_client==1.14.0
gradio_rangeslider==0.0.8
groovy==0.1.2
h11==0.16.0
hf-xet==1.7.0
httpcore==1.0.9
httpx==0.28.1
huggingface_hub==1.33.0
idna==3.20
Jinja2==3.1.6
markdown-it-py==4.2.0
MarkupSafe==3.0.4
mdurl==0.1.2
ml_dtypes==0.6.0
numpy==2.4.6
onnx==1.23.1
onnxruntime==1.30.0
opencv-python-headless==5.0.0.93
opentelemetry-api==1.45.1
orjson==3.13.0
packaging==26.3
pandas==2.3.3
pillow==11.3.0
pip==25.0.1
protobuf==7.36.2
pydantic==2.12.3
pydantic_core==2.41.4
pydub==0.25.1
Pygments==2.21.0
python-dateutil==2.9.0.post0
python-multipart==0.0.32
pytz==2026.5
PyYAML==6.0.3
rich==15.0.0
ruff==0.17.0
safehttpx==0.1.7
scipy==1.18.1
semantic-version==2.10.0
shellingham==1.5.4
six==1.17.0
starlette==0.52.1
tomlkit==0.13.3
tqdm==4.70.1
typer==0.27.3
typing-inspection==0.4.4
typing_extensions==4.16.0
tzdata==2026.5
uvicorn==0.54.0
websockets==15.0.1

View File

@@ -1,120 +0,0 @@
--index-url https://pypi.org/simple
--extra-index-url https://download.pytorch.org/whl/cpu
absl-py==2.5.1
aiohappyeyeballs==2.7.1
aiohttp==3.14.5
aiosignal==1.4.0
altair==4.2.2
anyio==3.7.1
attrs==26.1.0
audioread==3.1.0
av==15.1.0
certifi==2026.7.22
cffi==2.1.1
charset-normalizer==3.5.2
click==8.5.0
cloudpickle==3.1.2
coloredlogs==15.0.1
contourpy==1.3.3
cycler==0.12.1
decorator==5.3.1
einops==0.8.2
entrypoints==0.4
faiss-cpu==1.15.1
fastapi==0.99.1
ffmpeg-python==0.2.0
ffmpy==1.0.0
filelock==4.1.1
flatbuffers==25.12.19
fonttools==4.66.1
FreeSimpleGUI==5.1.1
frozenlist==1.8.0
fsspec==2026.9.0
future==1.0.0
gradio==3.14.0
grpcio==1.84.0
h11==0.14.0
hf-xet==1.7.0
httpcore==0.16.3
httpx==0.23.3
huggingface_hub==0.36.2
humanfriendly==10.0
hyper-connections==0.4.2
idna==3.20
Jinja2==3.1.6
joblib==1.6.0
jsonschema==4.26.0
jsonschema-specifications==2025.9.1
kiwisolver==1.5.1
lazy-loader==0.6
librosa==0.10.2.post1
linkify-it-py==2.2.0
llvmlite==0.50.0
local-attention==1.11.2
Markdown==3.11
markdown-it-py==2.2.0
MarkupSafe==3.0.4
matplotlib==3.11.2
mdit-py-plugins==0.3.5
mdurl==0.1.2
mpmath==1.3.0
msgpack==1.2.3
multidict==7.1.0
narwhals==2.27.1
networkx==3.7
numba==0.68.0
numpy==1.26.4
onnxruntime==1.31.0
opencv-python-headless==4.11.0.86
orjson==3.13.0
packaging==26.3
pandas==3.0.6
pillow==12.3.0
pip==25.0.1
platformdirs==4.13.0
pooch==1.9.0
praat-parselmouth==0.4.7
propcache==0.5.4
protobuf==7.36.2
pycparser==3.11
pycryptodome==3.24.1
pydantic==1.10.26
pydub==0.25.1
pyparsing==3.0.9
python-dateutil==2.9.0.post0
python-multipart==0.0.32
PyYAML==6.0.3
referencing==0.37.0
regex==2026.9.29
requests==2.34.2
rfc3986==1.5.0
rpds-py==2026.9.1
safetensors==0.8.0
scikit-learn==1.9.1
scipy==1.17.1
setuptools==80.10.2
six==1.17.0
sniffio==1.3.1
sounddevice==0.5.6
soundfile==0.14.0
soxr==1.1.0
starlette==0.27.0
sympy==1.14.0
tensorboard==2.21.0
tensorboard-data-server==0.7.2
threadpoolctl==3.7.0
tokenizers==0.21.4
toolz==1.2.0
torch==2.4.1+cpu
torchaudio==2.4.1+cpu
torchfcpe==0.0.4
torchvision==0.19.1+cpu
tqdm==4.70.1
transformers==4.49.0
typing_extensions==4.16.0
urllib3==2.8.0
uvicorn==0.22.0
websockets==10.4
Werkzeug==3.1.9
wheel==0.48.0
yarl==1.25.1

View File

@@ -1,111 +0,0 @@
import os
import pathlib
import signal
import shutil
import subprocess
import sys
import time
import urllib.request
app = os.environ["APP"]
os.chdir("/opt/app")
if sys.argv[1:] == ["verify"]:
os.execv(sys.executable, [sys.executable, "/opt/verify.py"])
if sys.argv[1:2] == ["ffmpeg"]:
os.execv("/usr/bin/ffmpeg", ["ffmpeg", *sys.argv[2:]])
if sys.argv[1:2] == ["cli"]:
if app != "facefusion":
raise SystemExit("CLI is available for FaceFusion only")
os.execv(sys.executable, [sys.executable, "facefusion.py", *sys.argv[2:]])
if app == "facefusion":
command = [
sys.executable, "facefusion.py", "run",
"--execution-providers", "cpu", "--processors", "face_swapper",
"--temp-path", "/work/state/tmp", "--jobs-path", "/work/state",
"--output-path", "/work/output",
]
port = 7860
else:
pathlib.Path("/tmp/rvc-temp").mkdir(exist_ok=True)
weights = pathlib.Path("/work/state/weights")
weights.mkdir(exist_ok=True)
for source in pathlib.Path("/work/models/weights").glob("*.pth"):
target = weights / source.name
if not target.exists() and not target.is_symlink():
target.symlink_to(source)
fixture = pathlib.Path("/opt/training-fixture/mute")
for source in fixture.rglob("*"):
target = pathlib.Path("/work/state/mute") / source.relative_to(fixture)
if source.is_dir():
target.mkdir(parents=True, exist_ok=True)
elif not target.exists():
shutil.copyfile(source, target)
os.environ.update(
weight_root="/work/state/weights",
outside_index_root="/work/models/indices",
index_root="/work/state",
weight_pymss_root="/opt/app/assets/pymss_weights",
)
command = [sys.executable, "webui.py", "--noautoopen", "--port", "7865"]
port = 7865
server = subprocess.Popen(command)
browser = None
profile = pathlib.Path("/tmp/browser")
profile.mkdir(exist_ok=True)
(profile / "user.js").write_text('''
user_pref("browser.download.folderList", 2);
user_pref("browser.download.dir", "/work/output");
user_pref("browser.download.useDownloadDir", true);
user_pref("widget.use-xdg-desktop-portal.file-picker", 0);
user_pref("browser.shell.checkDefaultBrowser", false);
user_pref("browser.aboutwelcome.enabled", false);
user_pref("datareporting.policy.dataSubmissionEnabled", false);
user_pref("toolkit.telemetry.enabled", false);
''')
bookmarks = pathlib.Path.home() / ".config/gtk-3.0/bookmarks"
bookmarks.parent.mkdir(parents=True, exist_ok=True)
bookmarks.write_text("file:///work/input Input\nfile:///work/output Output\nfile:///work/models Models\n")
def stop(*_):
if browser is not None and browser.poll() is None:
browser.terminate()
if server.poll() is None:
server.terminate()
signal.signal(signal.SIGTERM, stop)
signal.signal(signal.SIGINT, stop)
try:
url = f"http://127.0.0.1:{port}"
for _ in range(180):
if server.poll() is not None:
raise RuntimeError(f"{app} exited: {server.returncode}")
try:
with urllib.request.urlopen(url, timeout=1) as response:
if response.status == 200:
break
except OSError:
time.sleep(1)
else:
raise RuntimeError("Offline WebUI did not become ready")
print(f"{app}: offline WebUI ready", flush=True)
if sys.argv[1:] == ["smoke"]:
subprocess.run([
"firefox-esr", "--headless", "--no-remote", "--profile", "/tmp/browser",
"--screenshot", "/tmp/offline-ui.png", url,
], check=True, timeout=90)
assert pathlib.Path("/tmp/offline-ui.png").stat().st_size > 1000
raise SystemExit(0)
browser = subprocess.Popen([
"firefox-esr", "--no-remote", "--profile", "/tmp/browser", url,
])
while browser.poll() is None:
if server.poll() is not None:
raise RuntimeError("WebUI terminated unexpectedly")
time.sleep(1)
finally:
stop()
if browser is not None:
browser.wait(timeout=15)
server.wait(timeout=15)

View File

@@ -1,139 +0,0 @@
import os
import gc
import pathlib
import socket
import subprocess
import sys
import tempfile
interfaces = {p.name for p in pathlib.Path("/sys/class/net").iterdir()}
assert interfaces == {"lo"}, interfaces
for family, address in (
(socket.AF_INET, ("1.1.1.1", 443)),
(socket.AF_INET6, ("2606:4700:4700::1111", 443, 0, 0)),
):
with socket.socket(family, socket.SOCK_STREAM) as connection:
connection.settimeout(2)
try:
connection.connect(address)
except OSError:
pass
else:
raise RuntimeError("External networking is available")
subprocess.run(["sha256sum", "--quiet", "--check", "/opt/model-checksums.sha256"], check=True)
if os.environ["APP"] == "facefusion":
sys.path.insert(0, "/opt/app")
from facefusion import state_manager
from facefusion.args import apply_args
from facefusion.program import create_program
from facefusion.core import common_pre_check, processors_pre_check
args = vars(create_program().parse_args([
"run", "--execution-providers", "cpu", "--processors", "face_swapper",
]))
apply_args(args, state_manager.init_item)
assert common_pre_check() and processors_pre_check()
import numpy as np
import onnxruntime as ort
options = ort.SessionOptions()
options.intra_op_num_threads = 4
options.inter_op_num_threads = 1
model = ort.InferenceSession(
"/opt/app/.assets/models/hyperswap_1a_256.onnx",
sess_options=options, providers=["CPUExecutionProvider"],
)
feeds = {}
for argument in model.get_inputs():
assert argument.type == "tensor(float)"
shape = [size if isinstance(size, int) and size > 0 else 1 for size in argument.shape]
feeds[argument.name] = np.full(shape, 0.01, dtype=np.float32)
assert all(np.isfinite(result).all() for result in model.run(None, feeds))
else:
sys.path.insert(0, "/opt/app")
import numpy as np
import torch
import transformers
import onnxruntime
assert not torch.cuda.is_available()
torch.set_num_threads(4)
from infer.hubert import load_hubert_model, extract_hubert_features
from infer.rmvpe import RMVPE
with torch.inference_mode():
hubert = load_hubert_model("cpu", False)
features = extract_hubert_features(hubert, torch.zeros(1, 16000), "v2")
assert torch.isfinite(features).all()
del hubert, features
pitch = RMVPE("/opt/app/assets/rmvpe/rmvpe.pt", False, "cpu")
result = pitch.infer_from_audio(np.zeros(16000, dtype=np.float32))
assert len(result) > 0 and np.isfinite(result).all()
del pitch
gc.collect()
# Exercise the exact WebUI subprocess entrypoint, not only in-process imports.
from scipy.io import wavfile
with tempfile.TemporaryDirectory(prefix="rvc-slicing-") as temporary:
directory = pathlib.Path(temporary)
dataset = directory / "input"
experiment = directory / "experiment"
dataset.mkdir()
experiment.mkdir()
samples = np.arange(4 * 40000, dtype=np.float32) / 40000
waveform = (0.2 * np.sin(2 * np.pi * 220 * samples)).astype(np.float32)
wavfile.write(dataset / "synthetic.wav", 40000, waveform)
subprocess.run([
sys.executable, "train/preprocess.py", str(dataset), "40000", "1",
str(experiment), "False", "3.7",
], check=True, timeout=120)
assert list((experiment / "0_gt_wavs").glob("*.wav"))
assert list((experiment / "1_16k_wavs").glob("*.wav"))
print("rvc: synthetic data slicing subprocess verified", flush=True)
# Check the v2/40k training baseline and writable inference-model export.
from train.utils import get_hparams_from_file
from train.process_ckpt import savee
hps = get_hparams_from_file("configs/v1/40k.json")
checkpoint = torch.load("assets/pretrained_v2/f0G40k.pth", map_location="cpu")
assert checkpoint["model"]
pathlib.Path("/work/state/weights").mkdir(exist_ok=True)
savee(checkpoint["model"], "40k", 1, "offline-readiness", 0, "v2", hps)
exported = pathlib.Path("assets/weights/offline-readiness.pth")
assert exported.is_file()
exported.unlink()
del checkpoint
checkpoint = torch.load("assets/pretrained_v2/f0D40k.pth", map_location="cpu")
assert checkpoint["model"]
del checkpoint
assert pathlib.Path("/opt/training-fixture/mute/0_gt_wavs/mute40k.wav").is_file()
print("rvc: v2/40k training assets and model export verified", flush=True)
# Exercise the WebUI's real worker and encoder on a synthetic stereo mix.
with tempfile.TemporaryDirectory(prefix="rvc-separation-") as temporary:
directory = pathlib.Path(temporary)
sample_rate = 44100
time_axis = np.arange(2 * sample_rate, dtype=np.float32) / sample_rate
left = 0.1 * np.sin(2 * np.pi * 220 * time_axis)
right = 0.1 * np.sin(2 * np.pi * 330 * time_axis)
mix = np.stack((left, right), axis=1).astype(np.float32)
wavfile.write(directory / "synthetic.wav", sample_rate, mix)
subprocess.run([
sys.executable, "-c",
"import sys; from pathlib import Path; p=Path(sys.argv[1]); sys.argv=sys.argv[:1]; "
"from tools.pymss_webui import pymss_separate, resolve_model, PYMSS_MODEL_CHOICES; "
"assert PYMSS_MODEL_CHOICES == [resolve_model('vocals-bs-roformer-368').label]; "
"list(pymss_separate('vocals-bs-roformer-368', str(p/'synthetic.wav'), "
"str(p/'vocals'), None, str(p/'instrumental'), 'wav'))",
str(directory),
], check=True, timeout=600, env={
**os.environ, "OMP_NUM_THREADS": "4", "MKL_NUM_THREADS": "4",
})
import soundfile as sf
stems = []
for name in ("vocals", "instrumental"):
files = list((directory / name).glob("*.wav"))
assert len(files) == 1, (name, files)
data, rate = sf.read(files[0], dtype="float32", always_2d=True)
assert rate == sample_rate and data.shape == mix.shape
assert np.isfinite(data).all()
stems.append(data)
assert np.allclose(stems[0] + stems[1], mix, atol=1e-4)
print("rvc: offline stereo vocal/instrumental separation verified", flush=True)
gc.collect()
subprocess.run([sys.executable, "/opt/session.py", "smoke"], check=True)
print(os.environ["APP"] + ": models verified, offline UI ready, IPv4/IPv6 egress blocked")

View File

@@ -1,4 +0,0 @@
---
- name: Reload systemd units
ansible.builtin.systemd_service:
daemon_reload: true

View File

@@ -1,343 +0,0 @@
---
- name: Configure on-demand external ai-media storage
become: true
when: desktop_ai_media_external_storage_enabled | bool
tags: [ai_media, ai_media_storage]
block:
- name: Validate external ai-media storage paths
ansible.builtin.assert:
that:
- desktop_ai_media_external_mountpoint is match('^/run/media/[^/]+/[^/]+$')
- >-
not desktop_ai_media_external_luks_uuid or
desktop_ai_media_external_luks_uuid is match('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')
- desktop_ai_media_external_source.startswith(desktop_ai_media_external_mountpoint + '/')
- desktop_ai_media_external_source != desktop_ai_media_external_mountpoint
- desktop_ai_media_root.startswith(user_home + '/')
- desktop_ai_media_root != user_home
- name: Derive external source mount unit name
ansible.builtin.command:
argv:
- systemd-escape
- -p
- --suffix=mount
- "{{ desktop_ai_media_external_mountpoint }}"
register: desktop_ai_media_external_source_mount_unit
changed_when: false
check_mode: false
- name: Derive ai-media bind mount unit name
ansible.builtin.command:
argv:
- systemd-escape
- -p
- --suffix=mount
- "{{ desktop_ai_media_root }}"
register: desktop_ai_media_bind_mount_unit
changed_when: false
check_mode: false
- name: Derive ai-media bind automount unit name
ansible.builtin.command:
argv:
- systemd-escape
- -p
- --suffix=automount
- "{{ desktop_ai_media_root }}"
register: desktop_ai_media_bind_automount_unit
changed_when: false
check_mode: false
- name: Create ai-media mount destination in the user home
ansible.builtin.file:
path: "{{ desktop_ai_media_root }}"
state: directory
owner: "{{ username }}"
group: "{{ username }}"
mode: "0700"
- name: Install ai-media bind mount unit
ansible.builtin.template:
src: ai-media-bind.mount.j2
dest: "/etc/systemd/system/{{ desktop_ai_media_bind_mount_unit.stdout }}"
owner: root
group: root
mode: "0644"
notify: Reload systemd units
- name: Install ai-media bind automount unit
ansible.builtin.template:
src: ai-media-bind.automount.j2
dest: "/etc/systemd/system/{{ desktop_ai_media_bind_automount_unit.stdout }}"
owner: root
group: root
mode: "0644"
notify: Reload systemd units
- name: Install ai-media bind automount failure restarter
ansible.builtin.template:
src: ai-media-bind-restarter.service.j2
dest: /etc/systemd/system/ai-media-bind-restarter.service
owner: root
group: root
mode: "0644"
notify: Reload systemd units
- name: Flush systemd unit changes
ansible.builtin.meta: flush_handlers
- name: Stop a stale ai-media bind mount when the Backup source is absent
ansible.builtin.systemd_service:
name: "{{ desktop_ai_media_bind_mount_unit.stdout }}"
state: stopped
when:
- desktop_ai_media_root in (ansible_facts['mounts'] | default([]) | selectattr('fstype', 'ne', 'autofs') | map(attribute='mount') | list)
- desktop_ai_media_external_mountpoint not in (ansible_facts['mounts'] | default([]) | map(attribute='mount') | list)
- name: Enable and start ai-media bind automount
ansible.builtin.systemd_service:
name: "{{ desktop_ai_media_bind_automount_unit.stdout }}"
enabled: true
state: started
- name: Configure isolated desktop media tools as the desktop user
become: false
block:
- name: Determine whether the ai-media storage source is currently available
ansible.builtin.set_fact:
desktop_ai_media_external_available: >-
{{ (not (desktop_ai_media_external_storage_enabled | bool)) or
(desktop_ai_media_external_mountpoint in
(ansible_facts['mounts'] | default([]) | map(attribute='mount') | list)) }}
- name: Load pinned public model manifest
ansible.builtin.include_vars: models.yml
- name: Identify unprivileged desktop user
ansible.builtin.command:
argv: [id, -un]
register: desktop_ai_media_user
changed_when: false
check_mode: false
- name: Verify local Fedora desktop scope
ansible.builtin.assert:
that:
- "'platform_fedora' in group_names"
- "'desktop_gnome' in group_names"
- ansible_connection == 'local'
- desktop_ai_media_user.stdout == username
- ansible_facts.architecture == 'x86_64'
- desktop_ai_media_root.startswith(user_home + '/')
- desktop_ai_media_root != user_home
- desktop_ai_media_build_root != desktop_ai_media_root
- desktop_ai_media_facefusion_revision is match('^[0-9a-f]{40}$')
- desktop_ai_media_rvc_revision is match('^[0-9a-f]{40}$')
- "'@sha256:' in desktop_ai_media_base_image"
- desktop_ai_media_debian_snapshot is match('^[0-9]{8}T[0-9]{6}Z$')
- desktop_ai_media_public_models | length > 0
- >-
desktop_ai_media_apps | difference(
desktop_ai_media_public_models | map(attribute='app') | list) | length == 0
- name: Verify existing rootless Podman runtime
ansible.builtin.command:
argv: [podman, --remote=false, info, --format, "{{ '{{.Host.Security.Rootless}}' }}"]
register: desktop_ai_media_podman
changed_when: false
check_mode: false
- name: Require rootless containers
ansible.builtin.assert:
that: desktop_ai_media_podman.stdout == 'true'
- name: Reject remote or synchronized media storage before provisioning
ansible.builtin.command:
argv: [python3, "-", "{{ desktop_ai_media_root }}"]
stdin: "{{ lookup('ansible.builtin.file', role_path + '/files/check_storage.py') }}"
changed_when: false
check_mode: false
when: desktop_ai_media_external_available | bool
- name: Create the data-free local build context
ansible.builtin.file:
path: "{{ desktop_ai_media_build_root }}"
state: directory
mode: "0700"
- name: Create private application and media directories on mounted media storage
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: "0700"
loop:
- "{{ desktop_ai_media_root }}"
- "{{ desktop_ai_media_root }}/input"
- "{{ desktop_ai_media_root }}/input/voice"
- "{{ desktop_ai_media_root }}/output"
- "{{ desktop_ai_media_root }}/models"
- "{{ desktop_ai_media_root }}/models/weights"
- "{{ desktop_ai_media_root }}/models/indices"
- "{{ desktop_ai_media_root }}/state"
- "{{ desktop_ai_media_root }}/state/facefusion"
- "{{ desktop_ai_media_root }}/state/rvc"
when: desktop_ai_media_external_available | bool
- name: Ensure user launcher directories exist without changing existing permissions
ansible.builtin.file:
path: "{{ item }}"
state: directory
loop:
- "{{ user_home }}/.local/bin"
- "{{ user_home }}/.local/share/applications"
- name: Install runtime and model preparation code into the data-free build context
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ desktop_ai_media_build_root }}/{{ item }}"
mode: "0644"
loop: [session.py, prepare.py, verify.py, check_storage.py]
register: desktop_ai_media_support
- name: Install host-side offline preset workers without rebuilding images
tags: [ai_media_presets]
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ desktop_ai_media_build_root }}/{{ item }}"
mode: "0644"
loop: [preset.py, preset_rvc.py]
- name: Create public model cache directories
ansible.builtin.file:
path: "{{ desktop_ai_media_build_root }}/models/{{ item.app }}/{{ item.path | dirname }}"
state: directory
mode: "0700"
loop: "{{ desktop_ai_media_public_models }}"
loop_control:
label: "{{ item.app }}/{{ item.path }}"
- name: Cache public models using pinned SHA256 checksums without personal data
ansible.builtin.get_url:
url: "{{ item.url }}"
dest: "{{ desktop_ai_media_build_root }}/models/{{ item.app }}/{{ item.path }}"
checksum: "sha256:{{ item.sha256 }}"
mode: "0644"
timeout: 60
use_netrc: false
use_proxy: false
loop: "{{ desktop_ai_media_public_models }}"
loop_control:
label: "{{ item.app }}/{{ item.path }}"
register: desktop_ai_media_model_cache
- name: Install complete Python dependency locks
ansible.builtin.copy:
src: "requirements-{{ item }}.lock"
dest: "{{ desktop_ai_media_build_root }}/requirements-{{ item }}.lock"
mode: "0644"
loop: "{{ desktop_ai_media_apps }}"
register: desktop_ai_media_locks
- name: Restrict the build context to code and checksum-pinned public models
ansible.builtin.template:
src: containerignore.j2
dest: "{{ desktop_ai_media_build_root }}/.containerignore"
mode: "0644"
register: desktop_ai_media_ignore
- name: Render separate pinned application builds
ansible.builtin.template:
src: Containerfile.j2
dest: "{{ desktop_ai_media_build_root }}/Containerfile.{{ item }}"
mode: "0644"
loop: "{{ desktop_ai_media_apps }}"
register: desktop_ai_media_containerfiles
- name: Fingerprint the complete application build specification
ansible.builtin.set_fact:
desktop_ai_media_build_keys: >-
{{ desktop_ai_media_build_keys | default({}) | combine({
item: (
lookup('ansible.builtin.template', role_path + '/templates/Containerfile.j2')
+ lookup('ansible.builtin.file', role_path + '/files/prepare.py')
+ lookup('ansible.builtin.file', role_path + '/files/session.py')
+ lookup('ansible.builtin.file', role_path + '/files/verify.py')
+ lookup('ansible.builtin.file', role_path + '/files/requirements-' + item + '.lock')
+ lookup('ansible.builtin.file', role_path + '/templates/containerignore.j2')
) | hash('sha256')
}) }}
loop: "{{ desktop_ai_media_apps }}"
- name: Inspect installed media images
ansible.builtin.command:
argv: [podman, --remote=false, image, exists, "localhost/ai-media-{{ item }}:managed"]
loop: "{{ desktop_ai_media_apps }}"
register: desktop_ai_media_images
failed_when: desktop_ai_media_images.rc not in [0, 1]
changed_when: false
check_mode: false
- name: Inspect committed image build fingerprints
ansible.builtin.command:
argv:
- podman
- --remote=false
- image
- inspect
- --format
- "{{ '{{ index .Labels \"io.fscotto.ai-media.build-key\" }}' }}"
- "localhost/ai-media-{{ item.item }}:managed"
loop: "{{ desktop_ai_media_images.results }}"
loop_control:
label: "{{ item.item }}"
when: item.rc == 0
register: desktop_ai_media_image_keys
changed_when: false
check_mode: false
- name: Build media images without mounting personal data
ansible.builtin.command:
argv:
- podman
- --remote=false
- build
- --http-proxy=false
- --pull=missing
- --label
- "io.fscotto.ai-media.build-key={{ desktop_ai_media_build_keys[item.item] }}"
- --tag
- "localhost/ai-media-{{ item.item }}:managed"
- --file
- "{{ desktop_ai_media_build_root }}/Containerfile.{{ item.item }}"
- "{{ desktop_ai_media_build_root }}"
loop: "{{ desktop_ai_media_images.results }}"
loop_control:
label: "{{ item.item }}"
when: >-
item.rc != 0 or
desktop_ai_media_image_keys.results[desktop_ai_media_apps.index(item.item)].stdout | default('') !=
desktop_ai_media_build_keys[item.item]
changed_when: true
timeout: 3600
- name: Install offline launcher
tags: [ai_media_launcher]
ansible.builtin.template:
src: ai-media.j2
dest: "{{ user_home }}/.local/bin/ai-media"
mode: "0755"
validate: /usr/bin/bash -n %s
- name: Install manual offline desktop entries
ansible.builtin.template:
src: application.desktop.j2
dest: "{{ user_home }}/.local/share/applications/ai-media-{{ item }}.desktop"
mode: "0644"
loop: "{{ desktop_ai_media_apps }}"
- name: Verify offline networking and application readiness without personal files
ansible.builtin.command:
argv: ["{{ user_home }}/.local/bin/ai-media", verify]
changed_when: false
when: not ansible_check_mode

View File

@@ -1,40 +0,0 @@
FROM {{ desktop_ai_media_base_image }}
LABEL io.fscotto.ai-media.models="{{ desktop_ai_media_public_models | selectattr('app', 'equalto', item) | list | to_json | hash('sha256') }}"
ENV DEBIAN_FRONTEND=noninteractive PIP_DISABLE_PIP_VERSION_CHECK=1
RUN sed -i \
-e 's|http://deb.debian.org/debian$|https://snapshot.debian.org/archive/debian/{{ desktop_ai_media_debian_snapshot }}/|' \
-e 's|http://deb.debian.org/debian-security$|https://snapshot.debian.org/archive/debian-security/{{ desktop_ai_media_debian_snapshot }}/|' \
/etc/apt/sources.list.d/debian.sources \
&& apt-get -o Acquire::Check-Valid-Until=false update \
&& apt-get install -y --no-install-recommends \
ca-certificates curl git ffmpeg firefox-esr fonts-dejavu-core libgl1 libglib2.0-0 libportaudio2 \
&& rm -rf /var/lib/apt/lists/*
COPY requirements-{{ item }}.lock /opt/requirements.lock
WORKDIR /opt/app
{% if item == 'facefusion' %}
RUN git init . && git remote add origin https://github.com/facefusion/facefusion.git \
&& git fetch --depth 1 origin {{ desktop_ai_media_facefusion_revision }} \
&& git checkout --detach FETCH_HEAD && rm -rf .git \
&& pip install --no-cache-dir -r /opt/requirements.lock
{% else %}
RUN git init . && git remote add origin https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git \
&& git fetch --depth 1 origin {{ desktop_ai_media_rvc_revision }} \
&& git checkout --detach FETCH_HEAD && rm -rf .git \
&& pip install --no-cache-dir -r /opt/requirements.lock
{% endif %}
{% for model in desktop_ai_media_public_models if model.app == item %}
COPY models/{{ model.app }}/{{ model.path }} /opt/app/{{ model.path }}
{% endfor %}
COPY prepare.py /opt/
RUN python /opt/prepare.py {{ item }} \
&& pip freeze --all > /opt/python-requirements.lock \
&& test -s /opt/model-checksums.sha256
COPY session.py verify.py /opt/
RUN mkdir -p /work/input /work/output /work/state /work/models /home/media
ENV GRADIO_ANALYTICS_ENABLED=False HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 \
HF_HUB_DISABLE_TELEMETRY=1 DO_NOT_TRACK=1 HOME=/home/media \
XDG_RUNTIME_DIR=/run/media MOZ_ENABLE_WAYLAND=1 GTK_USE_PORTAL=0 \
LIBGL_ALWAYS_SOFTWARE=1 GRADIO_SERVER_NAME=127.0.0.1 GRADIO_SERVER_PORT=7860 \
PYTHONPATH=/opt/app PYTHONSAFEPATH=1 PYTHONDONTWRITEBYTECODE=1 NUMBA_CACHE_DIR=/tmp/numba MPLCONFIGDIR=/tmp/matplotlib \
GRADIO_TEMP_DIR=/tmp/gradio APP={{ item }}
ENTRYPOINT ["python", "/opt/session.py"]

View File

@@ -1,7 +0,0 @@
[Unit]
Description=Recover the ai-media bind automount after an unavailable Backup volume
[Service]
Type=oneshot
ExecStartPre=/usr/bin/sleep 3
ExecStart=/usr/bin/bash -c '/usr/bin/systemctl restart "$(/usr/bin/systemd-escape -p --suffix=automount {{ desktop_ai_media_root }})"'

View File

@@ -1,11 +0,0 @@
[Unit]
Description=On-demand ai-media bind mount from the Backup LUKS volume
ConditionPathIsDirectory={{ desktop_ai_media_root }}
OnFailure=ai-media-bind-restarter.service
[Automount]
Where={{ desktop_ai_media_root }}
TimeoutIdleSec=5min
[Install]
WantedBy=multi-user.target

View File

@@ -1,12 +0,0 @@
[Unit]
Description=Bind mount ai-media from the Backup LUKS volume
RequiresMountsFor={{ desktop_ai_media_external_mountpoint }}
After={{ desktop_ai_media_external_source_mount_unit.stdout }}
BindsTo={{ desktop_ai_media_external_source_mount_unit.stdout }}
ConditionPathIsMountPoint={{ desktop_ai_media_external_mountpoint }}
ConditionPathIsDirectory={{ desktop_ai_media_external_source }}
[Mount]
What={{ desktop_ai_media_external_source }}
Where={{ desktop_ai_media_root }}
Options=bind

View File

@@ -1,193 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
root={{ desktop_ai_media_root | quote }}
build_root={{ desktop_ai_media_build_root | quote }}
{% set manage_luks = desktop_ai_media_external_storage_enabled | default(false) and desktop_ai_media_external_luks_uuid | default('') %}
{% if manage_luks %}
encrypted={{ ('/dev/disk/by-uuid/' + desktop_ai_media_external_luks_uuid) | quote }}
external_mount={{ desktop_ai_media_external_mountpoint | quote }}
bind_fsroot={{ (desktop_ai_media_external_source | replace(desktop_ai_media_external_mountpoint, '', 1)) | quote }}
fail() { echo "$*" >&2; exit 1; }
read_mapper() {
local devices mapping
devices=$(lsblk -nrpo NAME,TYPE,MAJ:MIN -- "$encrypted") ||
fail "The configured LUKS volume is not available: $encrypted"
mapping=$(awk '$2 == "crypt" {print $1, $3}' <<< "$devices")
[[ "$mapping" != *$'\n'* ]] || fail "Multiple mappings for $encrypted; refusing to continue"
read -r mapper mapper_id <<< "$mapping"
}
mount_info() {
# Inspect the kernel mount table without following the automount path.
findmnt -krnC --mountpoint "$1" --types noautofs --output MAJ:MIN,FSROOT || [[ $? == 1 ]]
}
volume_mounts() {
[[ -n "$mapper_id" ]] || return 0
findmnt -krnC --source "$mapper_id" --output TARGET || [[ $? == 1 ]]
}
require_external_bind() {
read_mapper
[[ -n "$mapper_id" && "$(mount_info "$root")" == "$mapper_id $bind_fsroot" ]] ||
fail "Encrypted media storage is not mounted; run ai-media mount first"
}
manage_volume() {
local action=$1 mapper mapper_id bind_unit automount_unit mounted bind jobs containers
[[ $# == 1 ]] || fail "Usage: ai-media $action"
bind_unit=$(systemd-escape -p --suffix=mount -- "$root")
automount_unit=$(systemd-escape -p --suffix=automount -- "$root")
read_mapper
mounted=$(mount_info "$external_mount")
bind=$(mount_info "$root")
[[ -z "$mounted" || "$mounted" == "$mapper_id /" ]] ||
fail "Unexpected filesystem at $external_mount; refusing to continue"
[[ -z "$bind" || "$bind" == "$mapper_id $bind_fsroot" ]] ||
fail "Unexpected filesystem at $root; refusing to continue"
if [[ "$action" == mount ]]; then
if [[ -z "$mapper" ]]; then
udisksctl unlock --block-device "$encrypted"
read_mapper
[[ -n "$mapper" ]] || fail "No decrypted block device found after unlock"
fi
if [[ -z "$mounted" ]]; then
[[ -z "$(volume_mounts)" ]] || fail "The LUKS volume is already mounted elsewhere"
udisksctl mount --block-device "$mapper"
fi
[[ "$(mount_info "$external_mount")" == "$mapper_id /" ]] ||
fail "The LUKS volume is not mounted at the expected path: $external_mount"
sudo systemctl start "$automount_unit" "$bind_unit"
require_external_bind
echo "Encrypted media storage mounted at $root"
else
jobs=$(systemctl --user list-units --type=service --state=active,activating,deactivating \
--no-legend --no-pager 'ai-media-*.service')
containers=$(podman --remote=false ps -q \
--filter ancestor=localhost/ai-media-facefusion:managed \
--filter ancestor=localhost/ai-media-rvc:managed)
[[ -z "$jobs" && -z "$containers" ]] ||
fail "Stop the running ai-media jobs and applications before unmounting"
sudo systemctl stop ai-media-bind-restarter.service "$automount_unit" "$bind_unit"
[[ -z "$(mount_info "$root")" ]] || fail "The media bind mount is still in use"
mounted=$(volume_mounts)
if [[ -n "$mounted" ]]; then
[[ "$mounted" == "$external_mount" && "$(mount_info "$external_mount")" == "$mapper_id /" ]] ||
fail "The LUKS volume has other mounts; refusing to unmount or lock it"
udisksctl unmount --block-device "$mapper"
fi
if [[ -n "$mapper" ]]; then
[[ -z "$(volume_mounts)" ]] || fail "The LUKS volume is still mounted"
udisksctl lock --block-device "$encrypted"
fi
echo "Encrypted media storage unmounted and locked"
fi
}
{% endif %}
app="${1:-}"
case "$app" in
{% if manage_luks %}
mount|umount) manage_volume "$@"; exit ;;
{% endif %}
facefusion|rvc) shift ;;
ffmpeg) app=facefusion; shift; set -- ffmpeg "$@" ;;
preset)
shift
for path in "$root" "$root/input" "$root/output"; do
[[ -d "$path" && "$(realpath -- "$path")" == "$path" ]] || {
echo "Unsafe or missing media directory: $path" >&2; exit 1;
}
done
{% if manage_luks %}
require_external_bind
{% endif %}
python3 "$build_root/check_storage.py" "$root"
exec python3 "$build_root/preset.py" "$root" "$(realpath -- "$0")" "$@" ;;
verify)
for tool in facefusion rvc; do
podman --remote=false run --rm --pull=never --network=none --read-only \
--cap-drop=ALL --cap-add=SYS_CHROOT \
--security-opt=no-new-privileges --userns=keep-id --http-proxy=false \
--tmpfs "/tmp:rw,nosuid,nodev,size=4g,mode=1777" \
--tmpfs "/home/media:rw,nosuid,nodev,size=128m,mode=1777" \
--tmpfs "/work/state:rw,nosuid,nodev,size=128m,mode=1777" \
--tmpfs "/work/models:rw,nosuid,nodev,size=128m,mode=1777" \
"localhost/ai-media-$tool:managed" verify
done
exit 0 ;;
*) echo "Usage: ai-media {facefusion|rvc|ffmpeg|preset|verify{% if manage_luks %}|mount|umount{% endif %}} [args ...]" >&2; exit 2 ;;
esac
# Fail closed if an existing data path was replaced by a symlink.
for path in "$root" "$root/input" "$root/output" "$root/models" "$root/state/$app"; do
[[ -d "$path" && "$(realpath -- "$path")" == "$path" ]] || {
echo "Unsafe or missing media directory: $path" >&2; exit 1;
}
done
{% if manage_luks %}
require_external_bind
{% endif %}
python3 {{ (desktop_ai_media_build_root + "/check_storage.py") | quote }} "$root"
# Run interactive sessions under the user manager, not the launching terminal.
# No autostart or automatic restart: recovering a training run remains explicit.
if [[ "$app" == rvc || "$app" == facefusion ]] && [[ $# -eq 0 ]]; then
: "${XDG_RUNTIME_DIR:?Run this launcher from the GNOME Wayland session}"
: "${WAYLAND_DISPLAY:?A Wayland session is required}"
[[ "$WAYLAND_DISPLAY" != */* && -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]] || exit 1
active=$(podman --remote=false ps --filter "ancestor=localhost/ai-media-$app:managed" --format '{{ '{{.ID}}' }}')
if [[ -n "$active" ]]; then
echo "$app is already running; leave its training session open." >&2
exit 1
fi
exec systemd-run --user --collect --unit="ai-media-$app" \
--property=Type=exec --property=Restart=no --property=Delegate=yes \
--setenv="XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" --setenv="WAYLAND_DISPLAY=$WAYLAND_DISPLAY" \
-- /usr/bin/bash "$(realpath -- "$0")" "$app" --foreground
fi
if [[ "${1:-}" == --foreground ]]; then
shift
fi
if [[ "$app" == rvc && "${1:-}" == cli ]]; then
shift
rvc_cli=1
set -- /opt/preset_rvc.py "$@"
else
rvc_cli=0
fi
args=(
run --rm --pull=never --network=none --read-only --userns=keep-id --http-proxy=false
--cap-drop=ALL --security-opt=no-new-privileges
--tmpfs "/tmp:rw,nosuid,nodev,size=8g,mode=1777"
--tmpfs "/home/media:rw,nosuid,nodev,size=128m,mode=1777"
--shm-size=512m
--volume "$root/input:/work/input:ro,Z"
--volume "$root/output:/work/output:rw,Z"
--volume "$root/models:/work/models:ro,Z"
--volume "$root/state/$app:/work/state:rw,Z"
)
if [[ "$rvc_cli" == 1 ]]; then
args+=(--volume "$build_root/preset_rvc.py:/opt/preset_rvc.py:ro,Z" --entrypoint python)
fi
if [[ "$rvc_cli" != 1 && "${1:-}" != cli && "${1:-}" != ffmpeg ]]; then
: "${XDG_RUNTIME_DIR:?Run this launcher from the GNOME Wayland session}"
: "${WAYLAND_DISPLAY:?A Wayland session is required}"
[[ "$WAYLAND_DISPLAY" != */* && -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]] || exit 1
# Share only the display socket, never the runtime directory, D-Bus, home
# directory or host browser. Do not relabel the compositor's socket.
args+=(
--cap-add=SYS_CHROOT
--security-opt label=disable
--tmpfs "/run/media:rw,nosuid,nodev,size=1m,mode=1777"
--volume "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/run/media/wayland-0:ro"
--env WAYLAND_DISPLAY=wayland-0
)
if [[ -S "$XDG_RUNTIME_DIR/pulse/native" ]]; then
args+=(
--volume "$XDG_RUNTIME_DIR/pulse/native:/run/media/pulse-native:ro"
--env PULSE_SERVER=unix:/run/media/pulse-native
)
fi
fi
exec podman --remote=false "${args[@]}" "localhost/ai-media-$app:managed" "$@"

View File

@@ -1,7 +0,0 @@
[Desktop Entry]
Type=Application
Name={{ 'FaceFusion' if item == 'facefusion' else 'RVC Voice Conversion' }} (offline)
Exec={{ user_home }}/.local/bin/ai-media {{ item }}
Terminal=false
Categories=AudioVideo;
StartupNotify=false

View File

@@ -1,15 +0,0 @@
*
!Containerfile.*
!prepare.py
!session.py
!verify.py
!requirements-facefusion.lock
!requirements-rvc.lock
!models/
{% for model in desktop_ai_media_public_models %}
!models/{{ model.app }}/
{% for depth in range(1, model.path.split('/') | length) %}
!models/{{ model.app }}/{{ model.path.split('/')[:depth] | join('/') }}/
{% endfor %}
!models/{{ model.app }}/{{ model.path }}
{% endfor %}

View File

@@ -1,584 +0,0 @@
import json
import os
from pathlib import Path
import socket
import subprocess
import tempfile
import unittest
import wave
import struct
from jinja2 import Environment
import shlex
ROLE = Path(__file__).resolve().parents[1]
class LauncherTest(unittest.TestCase):
def setUp(self):
self.temp = tempfile.TemporaryDirectory()
self.addCleanup(self.temp.cleanup)
self.root = Path(self.temp.name)
self.media = self.root / '.local/share/ai-media'
for directory in ('input', 'output', 'models', 'state/facefusion', 'state/rvc'):
(self.media / directory).mkdir(parents=True)
environment = Environment()
environment.filters['quote'] = shlex.quote
self.launcher = self.root / 'ai-media'
self.launcher.write_text(environment.from_string(
(ROLE / 'templates/ai-media.j2').read_text()
).render(desktop_ai_media_root=str(self.media), desktop_ai_media_build_root=str(self.root)))
(self.root / 'check_storage.py').write_text((ROLE / 'files/check_storage.py').read_text())
for name in ('preset.py', 'preset_rvc.py'):
(self.root / name).write_text((ROLE / 'files' / name).read_text())
self.log = self.root / 'podman.json'
podman = self.root / 'podman'
podman.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
podman.chmod(0o755)
self.env = dict(os.environ, PATH=str(self.root) + ':' + os.environ['PATH'],
TEST_LOG=str(self.log), HOME=str(self.root))
def launch(self, *args):
return subprocess.run(['bash', str(self.launcher), *args], env=self.env,
capture_output=True, text=True)
def fake_media_launcher(self):
fake = self.root / 'fake-ai-media'
fake.write_text('''#!/usr/bin/python3
import os
from pathlib import Path
import shutil
import sys
root = Path(os.environ["TEST_MEDIA"])
def host(path):
return str(path).replace("/work/input/", str(root / "input") + "/").replace(
"/work/output/", str(root / "output") + "/")
tool = sys.argv[1]
args = sys.argv[2:]
if tool == "ffmpeg":
os.execvp("ffmpeg", ["ffmpeg", *[host(arg) for arg in args]])
if tool == "facefusion":
(root / "facefusion-args.json").write_text(__import__("json").dumps(args))
shutil.copyfile(host(args[args.index("--target-path") + 1]),
host(args[args.index("--output-path") + 1]))
raise SystemExit(0)
if tool == "rvc":
(root / "rvc-args.json").write_text(__import__("json").dumps(args))
source = Path(host(args[1]))
job = Path(host(args[2]))
if "--convert-only" not in args:
(job / "instrumental").mkdir()
shutil.copyfile(source, job / "instrumental/stem.wav")
if "--separate-only" in args:
(job / "vocals").mkdir()
shutil.copyfile(source, job / "vocals/stem.wav")
else:
shutil.copyfile(source, job / "vocals-mia_voce.wav")
raise SystemExit(0)
raise SystemExit("Unexpected tool: " + tool)
''')
fake.chmod(0o755)
return fake
def fake_downloader(self, fixture):
downloader = self.root / 'yt-dlp'
downloader.write_text('''#!/usr/bin/python3
import json
import os
from pathlib import Path
import shutil
import sys
args = sys.argv[1:]
Path(os.environ["TEST_LOG"]).write_text(json.dumps(args))
destination = args[args.index("--output") + 1].replace("%(ext)s", "mp4")
shutil.copyfile(os.environ["TEST_DOWNLOAD_FIXTURE"], destination)
''')
downloader.chmod(0o755)
self.env['TEST_DOWNLOAD_FIXTURE'] = str(fixture)
return downloader
def run_preset(self, fake, *args, job_id='test'):
return subprocess.run(['python3', str(self.root / 'preset.py'),
str(self.media), str(fake), '--run', '--job-id', job_id, *args],
env={**self.env, 'TEST_MEDIA': str(self.media)},
capture_output=True, text=True)
def create_video(self, *, audio=False):
video = self.media / 'input/video1.mp4'
command = ['ffmpeg', '-hide_banner', '-loglevel', 'error', '-f', 'lavfi',
'-i', 'color=c=black:s=64x64:d=1']
if audio:
command += ['-f', 'lavfi', '-i', 'sine=frequency=440:duration=1']
command += ['-c:v', 'mpeg4']
if audio:
command += ['-c:a', 'aac', '-shortest']
subprocess.run([*command, str(video)], check=True)
return video
def stream_types(self, path):
probe = subprocess.check_output(['ffprobe', '-v', 'error', '-show_entries',
'stream=codec_type', '-of', 'json', str(path)])
return {stream['codec_type'] for stream in json.loads(probe)['streams']}
def create_audio(self, relative, sample=1000, seconds=1):
path = self.media / relative
path.parent.mkdir(parents=True, exist_ok=True)
with wave.open(str(path), 'wb') as audio:
audio.setparams((1, 2, 8000, 0, 'NONE', 'not compressed'))
audio.writeframes(struct.pack('<h', sample) * (8000 * seconds))
return path
def test_mix_sums_stems_and_preserves_longest_duration(self):
vocals = self.create_audio('output/video1-split-stems/vocals.wav')
instrumental = self.create_audio('output/video1-split-stems/instrumental.wav',
sample=2000, seconds=2)
before = [path.read_bytes() for path in (vocals, instrumental)]
result = self.run_preset(self.fake_media_launcher(), 'mix',
'video1-split-stems/vocals.wav',
'video1-split-stems/instrumental.wav', '--output', 'song.wav')
self.assertEqual(result.returncode, 0, result.stderr)
output = self.media / 'output/song.wav'
self.assertEqual(self.stream_types(output), {'audio'})
with wave.open(str(output), 'rb') as audio:
self.assertEqual(audio.getnframes(), 16000)
samples = struct.unpack('<16000h', audio.readframes(16000))
self.assertAlmostEqual(samples[4000], 3000, delta=1)
self.assertAlmostEqual(samples[12000], 2000, delta=1)
self.assertEqual([path.read_bytes() for path in (vocals, instrumental)], before)
def test_voice_convert_audio_skips_separation_and_preserves_input(self):
source = self.create_audio('output/video1-split-stems/vocals.wav')
before = source.read_bytes()
result = self.run_preset(self.fake_media_launcher(), 'voice-convert',
'video1-split-stems/vocals.wav')
self.assertEqual(result.returncode, 0, result.stderr)
output = self.media / 'output/vocals-mia_voce.wav'
self.assertEqual(self.stream_types(output), {'audio'})
args = json.loads((self.media / 'rvc-args.json').read_text())
self.assertIn('--convert-only', args)
self.assertFalse(list((self.media / 'output').rglob('instrumental')))
self.assertFalse((self.media / 'facefusion-args.json').exists())
self.assertEqual(source.read_bytes(), before)
repeated = self.run_preset(self.fake_media_launcher(), 'voice-convert',
'video1-split-stems/vocals.wav')
self.assertNotEqual(repeated.returncode, 0)
def test_voice_convert_dispatches_with_custom_output(self):
self.create_audio('input/voice.wav')
runner = self.root / 'systemd-run'
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
runner.chmod(0o755)
result = self.launch('preset', 'voice-convert', 'voice.wav', '--output', 'mine.wav')
self.assertEqual(result.returncode, 0, result.stderr)
args = json.loads(self.log.read_text())
self.assertIn('--user', args)
self.assertEqual(args[-4:], ['voice-convert', 'voice.wav', '--output', 'mine.wav'])
def test_voice_convert_rejects_invalid_audio_and_output(self):
self.create_audio('input/voice.wav')
for name in ('missing.wav', '../voice.wav', 'https://example.org/audio.wav'):
self.assertNotEqual(self.launch('preset', 'voice-convert', name).returncode, 0)
for name in ('../mine.wav', 'mine.mp3'):
self.assertNotEqual(self.launch('preset', 'voice-convert', 'voice.wav',
'--output', name).returncode, 0)
self.create_audio('output/voice.wav')
self.assertNotEqual(self.launch('preset', 'voice-convert', 'voice.wav').returncode, 0)
self.assertFalse(self.log.exists())
def test_mix_default_output_and_no_overwrite(self):
self.create_audio('input/voice.wav')
self.create_audio('output/instrumental.wav')
args = ('mix', 'voice.wav', 'instrumental.wav')
result = self.run_preset(self.fake_media_launcher(), *args)
self.assertEqual(result.returncode, 0, result.stderr)
target = self.media / 'output/voice-mix.wav'
original = target.read_bytes()
result = self.run_preset(self.fake_media_launcher(), *args)
self.assertNotEqual(result.returncode, 0)
self.assertEqual(target.read_bytes(), original)
def test_mix_dispatches_audio_only_background_job(self):
self.create_audio('input/voice.wav')
self.create_audio('output/instrumental.wav')
runner = self.root / 'systemd-run'
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
runner.chmod(0o755)
result = self.launch('preset', 'mix', 'voice.wav', 'instrumental.wav',
'--output', 'song.wav')
self.assertEqual(result.returncode, 0, result.stderr)
args = json.loads(self.log.read_text())
self.assertIn('--user', args)
self.assertEqual(args[-5:], ['mix', 'voice.wav', 'instrumental.wav',
'--output', 'song.wav'])
self.assertFalse((self.media / 'output/song.wav').exists())
def test_mix_rejects_unsafe_paths_and_ambiguous_audio(self):
self.create_audio('input/voice.wav')
self.create_audio('output/instrumental.wav')
for unsafe in ('../voice.wav', '/tmp/voice.wav', 'https://example.org/voice.wav'):
result = self.launch('preset', 'mix', unsafe, 'instrumental.wav')
self.assertNotEqual(result.returncode, 0)
for unsafe in ('../song.wav', '/tmp/song.wav', 'song.mp3'):
result = self.launch('preset', 'mix', 'voice.wav', 'instrumental.wav',
'--output', unsafe)
self.assertNotEqual(result.returncode, 0)
(self.media / 'output/linked').symlink_to(self.media / 'input', target_is_directory=True)
self.assertNotEqual(self.launch('preset', 'mix', 'linked/voice.wav',
'instrumental.wav').returncode, 0)
self.create_audio('output/voice.wav')
self.assertNotEqual(self.launch('preset', 'mix', 'voice.wav',
'instrumental.wav').returncode, 0)
self.assertFalse(self.log.exists())
def test_mix_rejects_missing_audio_stream(self):
video = self.create_video()
self.create_audio('output/instrumental.wav')
result = self.run_preset(self.fake_media_launcher(), 'mix', video.name,
'instrumental.wav')
self.assertNotEqual(result.returncode, 0)
self.assertFalse((self.media / 'output/video1-mix.wav').exists())
def test_cli_has_no_network_or_host_home(self):
result = self.launch('facefusion', 'cli', '--help')
self.assertEqual(result.returncode, 0, result.stderr)
args = json.loads(self.log.read_text())
for flag in ('--network=none', '--pull=never', '--read-only',
'--security-opt=no-new-privileges', '--cap-drop=ALL'):
self.assertIn(flag, args)
self.assertIn(str(self.media / 'input') + ':/work/input:ro,Z', args)
self.assertNotIn('--privileged', args)
self.assertNotIn('--security-opt', args)
self.assertNotIn('label=disable', args)
def test_gui_exposes_only_wayland_socket(self):
self.env.update(XDG_RUNTIME_DIR=str(self.root), WAYLAND_DISPLAY='wayland-0')
with socket.socket(socket.AF_UNIX) as sock:
sock.bind(str(self.root / 'wayland-0'))
result = self.launch('rvc', '--foreground')
self.assertEqual(result.returncode, 0, result.stderr)
args = json.loads(self.log.read_text())
self.assertIn('--network=none', args)
self.assertIn(str(self.root / 'wayland-0') + ':/run/media/wayland-0:ro', args)
self.assertIn('/run/media:rw,nosuid,nodev,size=1m,mode=1777', args)
self.assertFalse(any('uid=' in arg or 'gid=' in arg for arg in args))
self.assertNotIn('--publish', args)
self.assertFalse(any('dbus' in arg for arg in args))
def test_rvc_cli_is_offline_and_mounts_only_preset_code(self):
result = self.launch('rvc', 'cli', '/work/output/job/audio.wav', '/work/output/job')
self.assertEqual(result.returncode, 0, result.stderr)
args = json.loads(self.log.read_text())
self.assertIn('--network=none', args)
self.assertIn('--entrypoint', args)
self.assertIn('python', args)
self.assertIn(str(self.root / 'preset_rvc.py') + ':/opt/preset_rvc.py:ro,Z', args)
self.assertIn('/opt/preset_rvc.py', args)
self.assertNotIn('label=disable', args)
def test_voice_preset_dispatches_to_user_service(self):
(self.media / 'input/video1.mp4').write_bytes(b'not processed in dispatch')
runner = self.root / 'systemd-run'
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
runner.chmod(0o755)
result = self.launch('preset', 'audio-convert', 'video1.mp4')
self.assertEqual(result.returncode, 0, result.stderr)
args = json.loads(self.log.read_text())
self.assertIn('--user', args)
self.assertIn('--property=Restart=no', args)
self.assertIn('audio-convert', args)
self.assertIn('video1.mp4', args)
def test_face_preset_requires_all_sources(self):
(self.media / 'input/video1.mp4').write_bytes(b'video')
self.assertNotEqual(self.launch('preset', 'video-convert', 'video1.mp4').returncode, 0)
self.assertFalse(self.log.exists())
def test_complete_preset_rejects_local_url(self):
result = self.launch('preset', 'convert', 'file:///tmp/video.mp4')
self.assertNotEqual(result.returncode, 0)
self.assertFalse(self.log.exists())
def test_old_preset_names_are_rejected(self):
for name in ('voce', 'volti', 'unisci', 'completo'):
with self.subTest(name=name):
self.assertEqual(self.launch('preset', name, 'video1.mp4').returncode, 2)
def test_all_url_presets_dispatch_one_background_job(self):
for number in range(11, 19):
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
runner = self.root / 'systemd-run'
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
runner.chmod(0o755)
(self.media / 'input/audio.wav').write_bytes(b'audio')
for preset in ('audio-convert', 'video-convert', 'merge', 'split',
'split-stems', 'convert'):
with self.subTest(preset=preset):
extra = ['audio.wav'] if preset == 'merge' else []
result = self.launch('preset', preset, 'https://example.org/video', *extra)
self.assertEqual(result.returncode, 0, result.stderr)
args = json.loads(self.log.read_text())
self.assertIn('--user', args)
self.assertIn(preset, args)
self.assertIn('https://example.org/video', args)
if extra:
self.assertEqual(args[-1], 'audio.wav')
self.assertFalse(list((self.media / 'input').glob('download-*')))
def test_mux_preset_rejects_ambiguous_audio(self):
(self.media / 'input/video1.mp4').write_bytes(b'video')
(self.media / 'input/audio.wav').write_bytes(b'audio')
(self.media / 'output/audio.wav').write_bytes(b'audio')
self.assertNotEqual(self.launch('preset', 'merge', 'video1.mp4', 'audio.wav').returncode, 0)
self.assertFalse(self.log.exists())
def test_mux_preset_creates_audio_video_with_streams(self):
if subprocess.run(['bash', '-c', 'command -v ffmpeg && command -v ffprobe'],
capture_output=True).returncode != 0:
self.skipTest('ffmpeg and ffprobe required')
self.create_video()
audio = self.media / 'input/audio.wav'
subprocess.run(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-f', 'lavfi',
'-i', 'sine=frequency=440:duration=1', str(audio)], check=True)
result = self.run_preset(self.fake_media_launcher(), 'merge', 'video1.mp4', 'audio.wav')
self.assertEqual(result.returncode, 0, result.stderr)
output = self.media / 'output/video1-unito.mp4'
self.assertTrue(output.is_file())
self.assertEqual(self.stream_types(output), {'video', 'audio'})
def test_voice_preset_outputs_audio_only(self):
self.create_video(audio=True)
result = self.run_preset(self.fake_media_launcher(), 'audio-convert', 'video1.mp4')
self.assertEqual(result.returncode, 0, result.stderr)
output = self.media / 'output/video1-mia_voce.wav'
self.assertEqual(self.stream_types(output), {'audio'})
self.assertFalse((self.media / 'output/video1-mia_voce.mp4').exists())
def test_split_presets_output_separate_streams_without_conversion(self):
original = self.create_video(audio=True).read_bytes()
for preset in ('split', 'split-stems'):
with self.subTest(preset=preset):
result = self.run_preset(self.fake_media_launcher(), preset, 'video1.mp4')
self.assertEqual(result.returncode, 0, result.stderr)
output = self.media / 'output' / f'video1-{preset}'
expected = {'video.mp4', 'audio.wav'}
if preset == 'split-stems':
expected |= {'vocals.wav', 'instrumental.wav'}
args = json.loads((self.media / 'rvc-args.json').read_text())
self.assertIn('--separate-only', args)
else:
self.assertFalse((self.media / 'rvc-args.json').exists())
self.assertEqual({p.name for p in output.iterdir()}, expected)
for name in expected:
self.assertEqual(self.stream_types(output / name),
{'video'} if name == 'video.mp4' else {'audio'})
self.assertEqual((self.media / 'input/video1.mp4').read_bytes(), original)
self.assertFalse(list((self.media / 'output').rglob('*mia_voce*')))
before = {p.name: p.read_bytes() for p in output.iterdir()}
repeated = self.run_preset(self.fake_media_launcher(), preset, 'video1.mp4',
job_id='repeat')
self.assertNotEqual(repeated.returncode, 0)
self.assertEqual({p.name: p.read_bytes() for p in output.iterdir()}, before)
def test_split_presets_reject_video_without_audio(self):
self.create_video()
for preset in ('split', 'split-stems'):
result = self.run_preset(self.fake_media_launcher(), preset, 'video1.mp4')
self.assertNotEqual(result.returncode, 0)
self.assertFalse(list((self.media / 'output').iterdir()))
def test_face_preset_preserves_audio_only_when_present(self):
for audio in (False, True):
with self.subTest(audio=audio):
video = self.media / 'input/video1.mp4'
if video.exists():
video.unlink()
self.create_video(audio=audio)
for number in range(11, 19):
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
output = self.media / 'output/video1-facefusion.mp4'
if output.exists():
output.unlink()
result = self.run_preset(self.fake_media_launcher(), 'video-convert', 'video1.mp4',
job_id=f'test-{audio}')
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(self.stream_types(output),
{'video', 'audio'} if audio else {'video'})
def test_face_preset_uses_requested_options(self):
self.create_video(audio=True)
for number in range(11, 19):
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
result = self.run_preset(self.fake_media_launcher(), 'video-convert', 'video1.mp4')
self.assertEqual(result.returncode, 0, result.stderr)
args = json.loads((self.media / 'facefusion-args.json').read_text())
source_start = args.index('--source-paths') + 1
self.assertEqual(args[source_start:source_start + 8],
[f'/work/input/source{number}.jpg' for number in range(11, 19)])
expected = {
'--processors': ['face_swapper'],
'--face-swapper-model': ['hyperswap_1a_256'],
'--face-swapper-pixel-boost': ['256x256'],
'--face-swapper-weight': ['0.5'],
'--face-detector-model': ['yolo_face'],
'--face-detector-size': ['640x640'],
'--face-detector-angles': ['0', '90', '180', '270'],
'--face-detector-score': ['0.5'],
'--face-selector-mode': ['one'],
'--face-selector-order': ['large-small'],
'--face-selector-gender': ['female'],
'--face-selector-race': ['white'],
'--face-mask-types': ['occlusion', 'region', 'area', 'box'],
'--face-occluder-model': ['xseg_1'],
'--face-parser-model': ['bisenet_resnet_34'],
'--face-mask-blur': ['0.3'],
'--output-video-encoder': ['libx264'],
'--output-video-preset': ['veryfast'],
'--output-video-quality': ['80'],
'--output-video-fps': ['30'],
'--execution-providers': ['cpu'],
'--output-audio-encoder': ['aac'],
'--jobs-path': ['/work/state'],
'--temp-path': ['/work/state/tmp'],
}
for flag, values in expected.items():
with self.subTest(flag=flag):
start = args.index(flag) + 1
self.assertEqual(args[start:start + len(values)], values)
def test_complete_preset_downloads_and_combines_both_results(self):
fixture = self.create_video(audio=True)
for number in range(11, 19):
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
self.fake_downloader(fixture)
result = self.run_preset(self.fake_media_launcher(), 'convert',
'https://example.org/video', job_id='test')
self.assertEqual(result.returncode, 0, result.stderr)
self.assertTrue((self.media / 'input/download-test.mp4').is_file())
self.assertEqual(self.stream_types(self.media / 'output/download-test-mia_voce.wav'),
{'audio'})
self.assertEqual(self.stream_types(self.media / 'output/download-test-facefusion.mp4'),
{'video', 'audio'})
self.assertEqual(self.stream_types(self.media / 'output/download-test-completo.mp4'),
{'video', 'audio'})
face_args = json.loads((self.media / 'facefusion-args.json').read_text())
self.assertEqual(face_args[face_args.index('--face-selector-gender') + 1], 'female')
self.assertEqual(face_args[face_args.index('--output-video-fps') + 1], '30')
downloader_args = json.loads(self.log.read_text())
self.assertIn('--ignore-config', downloader_args)
self.assertIn('--no-playlist', downloader_args)
def test_default_gui_uses_independent_user_service(self):
self.env.update(XDG_RUNTIME_DIR=str(self.root), WAYLAND_DISPLAY='wayland-0')
runner = self.root / 'systemd-run'
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
runner.chmod(0o755)
with socket.socket(socket.AF_UNIX) as sock:
sock.bind(str(self.root / 'wayland-0'))
result = self.launch('rvc')
self.assertEqual(result.returncode, 0, result.stderr)
args = json.loads(self.log.read_text())
self.assertIn('--user', args)
self.assertIn('--unit=ai-media-rvc', args)
self.assertIn('--property=Restart=no', args)
self.assertIn('--foreground', args)
self.assertNotIn('--scope', args)
self.assertNotIn('--pty', args)
self.assertNotIn('--wait', args)
def test_all_presets_download_url_before_processing(self):
fixture = self.create_video(audio=True)
self.fake_downloader(fixture)
for number in range(11, 19):
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
audio = self.media / 'input/audio.wav'
subprocess.run(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-i',
str(fixture), '-vn', str(audio)], check=True)
outputs = {
'audio-convert': 'mia_voce.wav', 'video-convert': 'facefusion.mp4',
'merge': 'unito.mp4', 'split': 'split', 'split-stems': 'split-stems',
'convert': 'completo.mp4',
}
for preset, suffix in outputs.items():
with self.subTest(preset=preset):
extra = ['audio.wav'] if preset == 'merge' else []
result = self.run_preset(self.fake_media_launcher(), preset,
'https://example.org/video?a=1&b=2', *extra,
job_id=preset)
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.count('Downloading one video'), 1)
self.assertTrue((self.media / f'input/download-{preset}.mp4').is_file())
output = self.media / f'output/download-{preset}-{suffix}'
self.assertTrue(output.exists())
if preset in ('split', 'split-stems'):
self.assertEqual(self.stream_types(output / 'video.mp4'), {'video'})
self.assertEqual(self.stream_types(output / 'audio.wav'), {'audio'})
else:
self.assertEqual(self.stream_types(output), {'audio'} if
preset == 'audio-convert' else {'video', 'audio'})
download_args = json.loads(self.log.read_text())
self.assertEqual(download_args[-1], 'https://example.org/video?a=1&b=2')
for flag in ('--ignore-config', '--no-playlist', '--no-overwrites'):
self.assertIn(flag, download_args)
def test_convert_also_accepts_local_video_without_download(self):
fixture = self.create_video(audio=True)
self.fake_downloader(fixture)
for number in range(11, 19):
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
result = self.run_preset(self.fake_media_launcher(), 'convert', fixture.name)
self.assertEqual(result.returncode, 0, result.stderr)
self.assertFalse(self.log.exists())
self.assertEqual(self.stream_types(self.media / 'output/video1-completo.mp4'),
{'video', 'audio'})
def test_all_presets_reject_invalid_urls_before_dispatch(self):
for preset in ('split', 'split-stems', 'audio-convert', 'video-convert',
'merge', 'convert'):
for url in ('file:///tmp/video.mp4', 'https://localhost/video',
'http://192.168.1.1/video', 'https://user:password@example.org/video'):
with self.subTest(preset=preset, url=url):
extra = ['audio.wav'] if preset == 'merge' else []
result = self.launch('preset', preset, url, *extra)
self.assertNotEqual(result.returncode, 0)
self.assertFalse(self.log.exists())
def test_failed_url_download_does_not_start_processing(self):
downloader = self.root / 'yt-dlp'
downloader.write_text('#!/bin/sh\nexit 1\n')
downloader.chmod(0o755)
result = self.run_preset(self.fake_media_launcher(), 'split',
'https://example.org/video')
self.assertNotEqual(result.returncode, 0)
self.assertFalse(list((self.media / 'output').iterdir()))
def test_symlinked_input_is_rejected(self):
(self.media / 'input').rmdir()
(self.media / 'input').symlink_to(self.root)
self.assertNotEqual(self.launch('facefusion', 'cli', '--help').returncode, 0)
self.assertFalse(self.log.exists())
def test_synced_storage_is_rejected(self):
directory = self.root / '.config/Nextcloud'
directory.mkdir(parents=True)
(directory / 'nextcloud.cfg').write_text(
'[Accounts]\n0\\Folders\\1\\localPath=' + str(self.media) + '\n'
)
self.assertNotEqual(self.launch('facefusion', 'cli', '--help').returncode, 0)
self.assertFalse(self.log.exists())
def test_invalid_tool_is_rejected(self):
self.assertEqual(self.launch('--network=host').returncode, 2)
self.assertFalse(self.log.exists())
if __name__ == '__main__':
unittest.main()

View File

@@ -1,93 +0,0 @@
import importlib.util
import os
from pathlib import Path
import sys
import tempfile
from types import ModuleType
import unittest
from unittest.mock import Mock, patch
class SeparationWorkerTest(unittest.TestCase):
def test_convert_only_applies_mia_voce_without_importing_separator(self):
spec = importlib.util.spec_from_file_location(
'preset_rvc', Path(__file__).resolve().parents[1] / 'files/preset_rvc.py')
worker = importlib.util.module_from_spec(spec)
spec.loader.exec_module(worker)
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
output = root / 'output'
job = output / 'job'
job.mkdir(parents=True)
source = job / 'audio.wav'
source.write_bytes(b'audio')
weights = root / 'state/weights/mia_voce.pth'
index = root / 'state/mia_voce/added_IVF256_Flat_nprobe_1_mia_voce_v2.index'
for path in (weights, index):
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(b'model')
def mapped_path(value):
return root / str(value).removeprefix('/work/') if str(value).startswith(
'/work/') else Path(value)
config = ModuleType('configs.config')
config.Config = Mock()
vc = ModuleType('infer.vc.modules')
voice = Mock()
voice.vc_single.return_value = ('Success', (40000, [0.1, 0.2]))
vc.VC = Mock(return_value=voice)
sf = ModuleType('soundfile')
sf.write = Mock(side_effect=lambda path, data, rate: path.write_bytes(b'converted'))
modules = {'configs.config': config, 'infer.vc.modules': vc,
'soundfile': sf, 'tools.pymss_webui': None}
with patch.object(worker, 'Path', mapped_path), \
patch.object(sys, 'argv', ['preset_rvc.py', str(source), str(job),
'--convert-only']), \
patch.dict(sys.modules, modules), patch.dict(os.environ):
worker.main()
voice.get_vc.assert_called_once_with('mia_voce.pth')
self.assertEqual(voice.vc_single.call_args.args[1], str(source))
self.assertEqual(voice.vc_single.call_args.args[4], str(index))
self.assertEqual((job / 'vocals-mia_voce.wav').read_bytes(), b'converted')
self.assertFalse((job / 'vocals').exists())
self.assertFalse((job / 'instrumental').exists())
def test_separate_only_does_not_require_personal_voice_weights(self):
spec = importlib.util.spec_from_file_location(
'preset_rvc', Path(__file__).resolve().parents[1] / 'files/preset_rvc.py')
worker = importlib.util.module_from_spec(spec)
spec.loader.exec_module(worker)
with tempfile.TemporaryDirectory() as directory:
output = Path(directory)
job = output / 'job'
job.mkdir()
source = job / 'audio.wav'
source.write_bytes(b'fixture')
separator = ModuleType('tools.pymss_webui')
def separate(model, audio, vocals, unused, instrumental, fmt, **kwargs):
self.assertEqual(model, 'vocals-bs-roformer-368')
self.assertEqual(audio, str(source))
(Path(vocals) / 'stem.wav').write_bytes(b'vocals')
(Path(instrumental) / 'stem.wav').write_bytes(b'instrumental')
yield 'Separated'
separator.pymss_separate = separate
def mapped_path(value):
return output if str(value) == '/work/output' else Path(value)
with patch.object(worker, 'Path', mapped_path), \
patch.object(sys, 'argv', ['preset_rvc.py', str(source), str(job),
'--separate-only']), \
patch.dict(sys.modules, {'tools.pymss_webui': separator}), \
patch.dict(os.environ):
worker.main()
self.assertTrue((job / 'vocals/stem.wav').is_file())
self.assertTrue((job / 'instrumental/stem.wav').is_file())
self.assertFalse((job / 'vocals-mia_voce.wav').exists())
if __name__ == '__main__':
unittest.main()

View File

@@ -1,183 +0,0 @@
import json
import os
from pathlib import Path
import shlex
import subprocess
import tempfile
import unittest
from jinja2 import Environment
TEMPLATE = Path(__file__).resolve().parents[1] / "templates/ai-media.j2"
UUID = "6948c504-2d60-4cc8-9e7f-3ccdf28e80d7"
class StorageCommandsTest(unittest.TestCase):
def setUp(self):
temp = tempfile.TemporaryDirectory()
self.addCleanup(temp.cleanup)
self.root = Path(temp.name)
self.media = self.root / "media"
for directory in ("input", "output"):
(self.media / directory).mkdir(parents=True)
env = Environment()
env.filters["quote"] = shlex.quote
self.launcher = self.root / "ai-media"
self.launcher.write_text(env.from_string(TEMPLATE.read_text()).render(
desktop_ai_media_root=str(self.media),
desktop_ai_media_build_root=str(self.root),
desktop_ai_media_external_storage_enabled=True,
desktop_ai_media_external_luks_uuid=UUID,
desktop_ai_media_external_mountpoint="/run/media/test/Backup",
desktop_ai_media_external_source="/run/media/test/Backup/ai-media",
))
self.state = self.root / "state.json"
self.log = self.root / "commands.jsonl"
mock = self.root / "mock"
mock.write_text('''#!/usr/bin/env python3
import json
import os
from pathlib import Path
import sys
cmd = Path(sys.argv[0]).name
args = sys.argv[1:]
state_file = Path(os.environ["STORAGE_TEST_STATE"])
state = json.loads(state_file.read_text())
root = os.environ["STORAGE_TEST_ROOT"]
external = "/run/media/test/Backup"
with open(os.environ["STORAGE_TEST_LOG"], "a") as log:
log.write(json.dumps([cmd, *args]) + "\\n")
if cmd == "sudo":
os.execvp(args[0], args)
elif cmd == "lsblk":
if state.get("missing"):
sys.exit(1)
print("/dev/sda1 part 8:1")
if state.get("unlocked"):
print("/dev/dm-0 crypt 252:0")
elif cmd == "findmnt":
if "--mountpoint" in args:
target = args[args.index("--mountpoint") + 1]
match = state.get("bind" if target == root else "mounted")
if not match:
sys.exit(1)
print(match)
elif "--source" in args:
assert args[args.index("--source") + 1] == "252:0"
mounts = ([external] if state.get("mounted") else []) + (
[root] if state.get("bind") else []) + state.get("other_mounts", [])
if not mounts:
sys.exit(1)
print(*mounts, sep="\\n")
else:
sys.exit(2)
elif cmd == "systemctl":
if args[0] == "--user":
if state.get("running"):
print("ai-media-preset-test.service loaded active running")
elif args[0] == "start":
state["bind"] = "252:0 /ai-media"
elif args[0] == "stop":
state.pop("bind", None)
elif cmd == "podman":
assert args[:3] == ["--remote=false", "ps", "-q"]
if state.get("container"):
print("abcdef")
elif cmd == "udisksctl":
if args[0] == "unlock":
state["unlocked"] = True
elif args[0] == "mount":
state["mounted"] = "252:0 /"
elif args[0] == "unmount":
if state.get("busy"):
sys.exit("Device is busy")
state.pop("mounted", None)
elif args[0] == "lock":
assert not state.get("mounted")
state.pop("unlocked")
state_file.write_text(json.dumps(state))
''')
mock.chmod(0o755)
for command in ("lsblk", "findmnt", "systemctl", "podman", "udisksctl", "sudo"):
(self.root / command).symlink_to(mock)
self.env = dict(os.environ, PATH=f"{self.root}:{os.environ['PATH']}",
STORAGE_TEST_STATE=str(self.state), STORAGE_TEST_LOG=str(self.log),
STORAGE_TEST_ROOT=str(self.media))
def units(self):
return [subprocess.check_output(["systemd-escape", "-p", "--suffix=" + suffix, "--", str(self.media)], text=True).strip()
for suffix in ("automount", "mount")]
def launch(self, *args, **state):
self.state.write_text(json.dumps(state))
self.log.write_text("")
result = subprocess.run(["bash", str(self.launcher), *args], env=self.env,
capture_output=True, text=True, timeout=10)
operations = [row[:2] if row[0] == "systemctl" else row
for line in self.log.read_text().splitlines()
if (row := json.loads(line))[0] in ("udisksctl", "systemctl", "sudo")]
return result, operations
def test_mount_unlocks_only_the_configured_volume_then_starts_bind(self):
result, operations = self.launch("mount")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(operations, [
["udisksctl", "unlock", "--block-device", f"/dev/disk/by-uuid/{UUID}"],
["udisksctl", "mount", "--block-device", "/dev/dm-0"],
["sudo", "systemctl", "start", *self.units()],
["systemctl", "start"],
])
def test_mount_does_not_reopen_already_mounted_volume(self):
result, operations = self.launch("mount", unlocked=True, mounted="252:0 /")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(operations, [["sudo", "systemctl", "start", *self.units()], ["systemctl", "start"]])
def test_umount_stops_bind_before_unmount_and_lock(self):
result, operations = self.launch("umount", unlocked=True, mounted="252:0 /",
bind="252:0 /ai-media")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(operations, [
["systemctl", "--user"], ["sudo", "systemctl", "stop", "ai-media-bind-restarter.service", *self.units()], ["systemctl", "stop"],
["udisksctl", "unmount", "--block-device", "/dev/dm-0"],
["udisksctl", "lock", "--block-device", f"/dev/disk/by-uuid/{UUID}"],
])
def test_umount_refuses_running_jobs_and_containers(self):
for condition in ("running", "container"):
with self.subTest(condition=condition):
result, operations = self.launch("umount", **{condition: True})
self.assertNotEqual(result.returncode, 0)
self.assertIn("running ai-media jobs", result.stderr)
self.assertEqual(operations, [["systemctl", "--user"]])
def test_umount_does_not_lock_if_busy(self):
result, operations = self.launch("umount", unlocked=True, mounted="252:0 /", busy=True)
self.assertNotEqual(result.returncode, 0)
self.assertEqual(operations[-1][:2], ["udisksctl", "unmount"])
def test_umount_does_not_touch_other_mounts(self):
result, operations = self.launch("umount", unlocked=True, mounted="252:0 /",
other_mounts=["/mnt/other"])
self.assertNotEqual(result.returncode, 0)
self.assertEqual(operations, [["systemctl", "--user"], ["sudo", "systemctl", "stop", "ai-media-bind-restarter.service", *self.units()], ["systemctl", "stop"]])
def test_rejects_foreign_mount_missing_device_and_extra_arguments(self):
for args, state in [
(("mount",), {"mounted": "8:2 /"}),
(("umount",), {"bind": "8:2 /ai-media"}),
(("mount",), {"missing": True}),
(("umount", "/dev/sdb"), {}),
]:
with self.subTest(args=args, state=state):
result, operations = self.launch(*args, **state)
self.assertNotEqual(result.returncode, 0)
self.assertEqual(operations, [])
def test_preset_refuses_local_fallback_when_bind_is_stopped(self):
result, operations = self.launch("preset", "split", "test.mp4")
self.assertNotEqual(result.returncode, 0)
self.assertIn("run ai-media mount first", result.stderr)
self.assertEqual(operations, [])

View File

@@ -1,134 +0,0 @@
---
desktop_ai_media_public_models:
- app: facefusion
path: .assets/models/2dfan4.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/2dfan4.hash
sha256: e6a6ef99b10b9fdb790c790879ca201f7afbe52560e4379248922324a9d503e8
- app: facefusion
path: .assets/models/2dfan4.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/2dfan4.onnx
sha256: 678c6fa539d52335a31c980feefdf4a6e02d781d83dce00af8a894f114557285
- app: facefusion
path: .assets/models/arcface_w600k_r50.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/arcface_w600k_r50.hash
sha256: e3a6d709939a81fe09e71c7d36f96d54a0deede904e31a38c191a1904e808371
- app: facefusion
path: .assets/models/arcface_w600k_r50.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/arcface_w600k_r50.onnx
sha256: f1f79dc3b0b79a69f94799af1fffebff09fbd78fd96a275fd8f0cbbea23270d1
- app: facefusion
path: .assets/models/bisenet_resnet_34.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/bisenet_resnet_34.hash
sha256: bfca5e43ca55110701ab691d864cacfddccad324dc42043aea8c001a949ce1f8
- app: facefusion
path: .assets/models/bisenet_resnet_34.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/bisenet_resnet_34.onnx
sha256: 4a0b8c958a3c938913bd06a8365dbb3c8761afba6ecbf0d14b3b1f77eb230c96
- app: facefusion
path: .assets/models/fairface.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/fairface.hash
sha256: e232c933114a6c9ce446195e4a96bf1c3327dd31c13165849cd00f9f19a2ea62
- app: facefusion
path: .assets/models/fairface.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/fairface.onnx
sha256: b176b1e4b0739496e7943af7ba4ff306271fecf837bca5ec5d9a48201959db37
- app: facefusion
path: .assets/models/fan_68_5.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/fan_68_5.hash
sha256: 092d902410959b3ce01294d7c1ad157f1c602e3918238117e7ef87157be9534e
- app: facefusion
path: .assets/models/fan_68_5.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/fan_68_5.onnx
sha256: ea05f7d9d014ae1d9cdc6e9c72643d8f00d198b5db3fdd384148ddff499a613e
- app: facefusion
path: .assets/models/hyperswap_1a_256.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.3.0/hyperswap_1a_256.hash
sha256: 70b33d0a9d6044847d9b29f9d08ce7afc140a2cada5b4b5f532bbd6440ba48c1
- app: facefusion
path: .assets/models/hyperswap_1a_256.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.3.0/hyperswap_1a_256.onnx
sha256: c0e98a8a03a238f461ed3d2570e426b49f46745ee400854a60dceeb70c246add
- app: facefusion
path: .assets/models/kim_vocal_2.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/kim_vocal_2.hash
sha256: fcd81ca30adf430b697fe58d60183031173c8ab0ca82efef308d652b1afb4197
- app: facefusion
path: .assets/models/kim_vocal_2.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/kim_vocal_2.onnx
sha256: fbde1fd7d35a6b1785add2225ce03255a01ccef6c8a5fb7b2ccd4e0c1e9097f7
- app: facefusion
path: .assets/models/nsfw_1.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.3.0/nsfw_1.hash
sha256: 48c61a15ffcda1ae9e6d4c790224072c8e5648d4ba2f767cf4cfe0be7e282853
- app: facefusion
path: .assets/models/nsfw_1.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.3.0/nsfw_1.onnx
sha256: 3debfd72763bc931dd308f57d1e9299ae13bb309d14ddbdc17ce8f1fd42f96af
- app: facefusion
path: .assets/models/nsfw_2.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.3.0/nsfw_2.hash
sha256: 64cbc0c1a4d72e181fae364281b6d2130be3b87d5784909c5a29adf436f09a01
- app: facefusion
path: .assets/models/nsfw_2.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.3.0/nsfw_2.onnx
sha256: 5aae1806ce44e3c27fab0a7d44eed581dd25ca71a4387ff809a191c98239c1be
- app: facefusion
path: .assets/models/nsfw_3.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.3.0/nsfw_3.hash
sha256: b15c591d8177511959174a0c6761827e3bf9c0aa1d63aaa79645d9fc9a4e774b
- app: facefusion
path: .assets/models/nsfw_3.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.3.0/nsfw_3.onnx
sha256: 778139fb930240ac39812a1480295bfc5dc2cec8a8e46ee6b453481d600c0fa2
- app: facefusion
path: .assets/models/xseg_1.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.1.0/xseg_1.hash
sha256: da3648ccecaa79f3be5ca0e1c3713f775504dd5c5dff716c095925132c02b08e
- app: facefusion
path: .assets/models/xseg_1.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.1.0/xseg_1.onnx
sha256: c4d1498b8a03b5fe2a3a5d2ef2a0402ab03bd51edaf5b2d8d5fb764702a97dd3
- app: facefusion
path: .assets/models/yoloface_8n.hash
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/yoloface_8n.hash
sha256: 7a4bd7e1a8cd938db2234dba41d4a8b7719bedbf7496d35510927cbd4b71683f
- app: facefusion
path: .assets/models/yoloface_8n.onnx
url: https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/yoloface_8n.onnx
sha256: 821cdbb1e65fbbabdde7dd0933f754797a343e56fd962729c61ffcefcd135929
- app: rvc
path: assets/hubert_base/config.json
url: https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/e6d0c1a17da07c33557852f9dfa2bd44cc75737d/hubert_base/config.json
sha256: 0346950779dfb7f9316fa74ed846e2b8a22a08eedfdc5387b73f327cb1a4a7cf
- app: rvc
path: assets/hubert_base/preprocessor_config.json
url: https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/e6d0c1a17da07c33557852f9dfa2bd44cc75737d/hubert_base/preprocessor_config.json
sha256: 7c1976a680fb7acc757cd36fb08eef878fa36c70b4c9d2d595df9c608bbbbf0e
- app: rvc
path: assets/hubert_base/pytorch_model.bin
url: https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/e6d0c1a17da07c33557852f9dfa2bd44cc75737d/hubert_base/pytorch_model.bin
sha256: cc8c20f4b90a520757260197a3ff2505705a7adbd20ad9eeaa4e1a9b38442ef5
- app: rvc
path: assets/rmvpe/rmvpe.pt
url: https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/e6d0c1a17da07c33557852f9dfa2bd44cc75737d/rmvpe.pt
sha256: 6d62215f4306e3ca278246188607209f09af3dc77ed4232efdd069798c4ec193
- app: rvc
path: assets/mute.zip
url: https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/e6d0c1a17da07c33557852f9dfa2bd44cc75737d/mute.zip
sha256: ee948e85213e4ed2f2ba2f8dfcee810bfd0b63131d91450e920bbe1cbd0321d0
- app: rvc
path: assets/pretrained_v2/f0D40k.pth
url: https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/e6d0c1a17da07c33557852f9dfa2bd44cc75737d/pretrained_v2/f0D40k.pth
sha256: 6b6ab091e70801b28e3f41f335f2fc5f3f35c75b39ae2628d419644ec2b0fa09
- app: rvc
path: assets/pretrained_v2/f0G40k.pth
url: https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/e6d0c1a17da07c33557852f9dfa2bd44cc75737d/pretrained_v2/f0G40k.pth
sha256: 3b2c44035e782c4b14ddc0bede9e2f4a724d025cd073f736d4f43708453adfcb
- app: rvc
path: assets/pymss_weights/model_bs_roformer_ep_368_sdr_12.9628.ckpt
url: https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/e6d0c1a17da07c33557852f9dfa2bd44cc75737d/pymss_weights/model_bs_roformer_ep_368_sdr_12.9628.ckpt
sha256: 97c9e1011924ff647d147b474638c161b80586fd5b9e83fab59cbbb70014bf62
- app: rvc
path: assets/pymss_weights/model_bs_roformer_ep_368_sdr_12.9628.yaml
url: https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/e6d0c1a17da07c33557852f9dfa2bd44cc75737d/pymss_weights/model_bs_roformer_ep_368_sdr_12.9628.yaml
sha256: 105fd8e6a1ef1b038db2aa657a9f9696283d506dbc815bd7134a57aa80ec9f10

View File

@@ -1,4 +0,0 @@
---
devcontainer_generator_go_binary: /usr/bin/go
devcontainer_generator_install_go: true
devcontainer_generator_build_dir: "{{ user_home }}/.cache/infra/devcontainer-generator"

View File

@@ -1,64 +0,0 @@
---
- name: Install Go compiler for the devcontainer generator
ansible.builtin.dnf:
name: golang
state: present
when: devcontainer_generator_install_go | bool
- name: Ensure devcontainer generator directories exist
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "0755"
loop:
- "{{ user_home }}/.local/bin"
- "{{ devcontainer_generator_build_dir }}"
- name: Copy devcontainer generator sources
ansible.builtin.copy:
src: "{{ playbook_dir }}/../cmd/devcontainer/"
dest: "{{ devcontainer_generator_build_dir }}/src/"
owner: "{{ username }}"
group: "{{ user_group }}"
mode: preserve
- name: Build devcontainer generator for the target host
ansible.builtin.command:
argv:
- "{{ devcontainer_generator_go_binary }}"
- build
- -trimpath
- -buildvcs=false
- -o
- "{{ devcontainer_generator_build_dir }}/devcontainer"
- .
chdir: "{{ devcontainer_generator_build_dir }}/src"
become_user: "{{ username }}"
environment:
GOCACHE: "{{ devcontainer_generator_build_dir }}/go-cache"
GOTOOLCHAIN: local
GOPROXY: "off"
GOSUMDB: "off"
CGO_ENABLED: "0"
# Compilation refreshes a cached artifact; copy below reports installation changes.
changed_when: false
when: not ansible_check_mode
- name: Install devcontainer generator in the user PATH
ansible.builtin.copy:
src: "{{ devcontainer_generator_build_dir }}/devcontainer"
remote_src: true
dest: "{{ user_home }}/.local/bin/devcontainer"
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "0755"
when: not ansible_check_mode
- name: Explain devcontainer generator check-mode behavior
ansible.builtin.debug:
msg: >-
Check mode validates package and source deployment only. Compilation and
installation of {{ user_home }}/.local/bin/devcontainer require a normal run.
when: ansible_check_mode

View File

@@ -23,52 +23,8 @@
dest: "{{ effective_user_home }}/Templates"
owner: "{{ effective_username }}"
group: "{{ effective_user_group }}"
creates: "{{ effective_user_home }}/Templates/code/main.c"
when: "'desktop' in group_names"
- name: Ensure Emacs authoring directories exist
tags: [dotfiles, dotfiles:common, emacs]
ansible.builtin.file:
path: "{{ effective_user_home }}/{{ item }}"
state: directory
owner: "{{ effective_username }}"
group: "{{ effective_user_group }}"
mode: "0755"
loop: "{{ emacs_authoring_directories | default([]) }}"
when:
- emacs_enabled | default(false) | bool
- not (workstation_is_wsl | default(false) | bool)
- name: Deploy the shared Emacs authoring configuration
tags: [dotfiles, dotfiles:common, emacs]
ansible.builtin.copy:
src: "{{ playbook_dir }}/../dotfiles/desktop/{{ item.src }}"
dest: "{{ effective_user_home }}/{{ item.dest }}"
owner: "{{ effective_username }}"
group: "{{ effective_user_group }}"
mode: "{{ item.mode }}"
loop: "{{ emacs_dotfiles | default([]) }}"
loop_control:
label: "{{ item.dest }}"
when:
- emacs_enabled | default(false) | bool
- not (workstation_is_wsl | default(false) | bool)
- name: Deploy Emacs authoring assets
tags: [dotfiles, dotfiles:common, emacs]
ansible.builtin.copy:
src: "{{ playbook_dir }}/../dotfiles/desktop/{{ item.src }}"
dest: "{{ effective_user_home }}/{{ item.dest }}"
owner: "{{ effective_username }}"
group: "{{ effective_user_group }}"
mode: "{{ item.mode }}"
loop: "{{ emacs_authoring_files | default([]) }}"
loop_control:
label: "{{ item.dest }}"
when:
- emacs_enabled | default(false) | bool
- not (workstation_is_wsl | default(false) | bool)
- name: Ensure SSH socket directory exists
tags: [dotfiles, dotfiles:common]
ansible.builtin.file:
@@ -87,88 +43,15 @@
group: "{{ effective_user_group }}"
mode: "{{ item.mode }}"
loop: >-
{{ common_dotfiles | default([]) }}
{{
(common_dotfiles | default([]))
+ ((ai_agents_dotfiles | default([])) if (ai_agents_enabled | default(false)) else [])
}}
loop_control:
label: "{{ item.dest }}"
- name: Ensure AI coding-agent dotfile parent directories exist
tags: [dotfiles, dotfiles:common, ai_agents]
ansible.builtin.file:
path: "{{ (effective_user_home ~ '/' ~ item.dest) | dirname }}"
state: directory
owner: "{{ effective_username }}"
group: "{{ effective_user_group }}"
mode: "0755"
loop: "{{ ai_agents_dotfiles | default([]) }}"
loop_control:
label: "{{ item.dest }}"
when:
- (item.agents | intersect(ai_agents_deploy_enabled_names)) | length > 0
- name: Deploy AI coding-agent dotfiles
tags: [dotfiles, dotfiles:common, ai_agents]
ansible.builtin.copy:
src: "{{ playbook_dir }}/../dotfiles/common/{{ item.src }}"
dest: "{{ effective_user_home }}/{{ item.dest }}"
owner: "{{ effective_username }}"
group: "{{ effective_user_group }}"
mode: "{{ item.mode }}"
loop: "{{ ai_agents_dotfiles | default([]) }}"
loop_control:
label: "{{ item.dest }}"
when:
- (item.agents | intersect(ai_agents_deploy_enabled_names)) | length > 0
- (ai_agents_dotfiles | default([])) | length > 0
- name: Install distro packages for Vim plugins
tags: [packages, vim, fzf]
ansible.builtin.package:
name: "{{ vim_plugin_distro_packages | default([]) }}"
state: present
when:
- vim_plugins_enabled | default(false)
- (vim_plugin_distro_packages | default([])) | length > 0
- name: Ensure git package is installed for source Vim plugins
tags: [packages, vim, fzf]
ansible.builtin.package:
name: git
state: present
when:
- vim_plugins_enabled | default(false)
- (vim_plugin_source_plugins | default([])) | length > 0
- name: Ensure Vim plugin pack directory exists
tags: [dotfiles, dotfiles:common, vim, fzf]
ansible.builtin.file:
path: "{{ effective_user_home }}/.vim/pack/plugins/opt"
state: directory
owner: "{{ effective_username }}"
group: "{{ effective_user_group }}"
mode: "0755"
when:
- vim_plugins_enabled | default(false)
- (vim_plugin_source_plugins | default([])) | length > 0
- name: Install source Vim plugins
tags: [dotfiles, dotfiles:common, vim, fzf]
ansible.builtin.git:
repo: "{{ item.repo }}"
dest: "{{ effective_user_home }}/.vim/pack/plugins/opt/{{ item.name }}"
version: "{{ item.version }}"
update: false
become_user: "{{ effective_username }}"
environment:
HOME: "{{ effective_user_home }}"
loop: "{{ vim_plugin_source_plugins | default([]) }}"
loop_control:
label: "{{ item.name }}"
when:
- vim_plugins_enabled | default(false)
- (vim_plugin_source_plugins | default([])) | length > 0
- name: Ensure AI config directories exist
tags: [dotfiles, dotfiles:common, ai_agents]
tags: [dotfiles, dotfiles:common]
ansible.builtin.file:
path: "{{ effective_user_home }}/{{ item }}"
state: directory
@@ -178,11 +61,11 @@
loop:
- .codex
when:
- "'codex' in ai_agents_deploy_enabled_names"
- ai_agents_enabled | default(false)
- (ai_agents_templates | default([])) | length > 0
- name: Render AI coding-agent templates
tags: [dotfiles, dotfiles:common, ai_agents]
- name: Render AI agent templates
tags: [dotfiles, dotfiles:common]
ansible.builtin.template:
src: "{{ playbook_dir }}/../dotfiles/common/{{ item.src }}"
dest: "{{ effective_user_home }}/{{ item.dest }}"
@@ -192,9 +75,7 @@
loop: "{{ ai_agents_templates | default([]) }}"
loop_control:
label: "{{ item.dest }}"
when:
- (item.agents | intersect(ai_agents_deploy_enabled_names)) | length > 0
- (ai_agents_templates | default([])) | length > 0
when: ai_agents_enabled | default(false)
- name: Refresh bat cache
tags: [dotfiles, dotfiles:common]

View File

@@ -1,28 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGpypFUBEACi1Vvzq9pIpA6lj7chbqELuxJtVuzUzxrasa6ZU0yF4yhq7jf8
3YkJRHwbezBKeQyzJ5lkX0EhXS8aXxUhMAm3PFpAlwcInfKzmV7atJwvaxIw6Rmd
GYe9fBWKjTN/SmPIjtyxrTznZY97+TfD1AeGZpLaJ8fsnhrC+HkiN2TACiTocgpe
hFiP0OWK7mWZeTWnY2scpIYXP1Ro7nQv4KacmY4JacTQ7m/HM0Qej/3olhuEv2Cw
lMVWw57/oHhmTllfLDQOogFQyIVqaaR98y/Eu6cAabSfcsqAAZ2A8vfHYD27z28J
vLO2PZEJd5ThlnX4Zqv0eIpZdBj//8Sl/MSqTshFZ1NDsRoqwdqw284X5MpnOJ4k
4Sc2Se8tJxt/nCeibH3dJ504Fb1X/mnOqhCAQ6pVJz4RB5HRlFPSkxVPyag1v1m/
7T4vie+OR4eqFQNz6mudrOoMmeVIfyL5fbe4cOr4fk/FyvEE2xMgkFatPqXn7vM9
og+zremPCfwRAFpBPyX74VowFY7llcdaj/w8K5T8PzM14Hb3E4ZKizMluKmTvTq9
WE1/eSQJLLQqXD5VmtmdUaC/VyE/1ZlIxcA1LWqvEQ327UXREvX/nHsrkKrl956W
jzkiHFUTsD1NJ0dMfs+csOt8Furb5jZj+HsMmCm9jLdfz5b/4WKLPbvxIwARAQAB
tBZDb2RleCBMaW51eCBSZXBvc2l0b3J5iQJRBBMBCgA7FiEEO/oOSui4zBai2bpo
SjtKVmxGYOQFAmpypFUCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQ
SjtKVmxGYORlCQ/9FyikZo8HQcJBP9E/oXVPds/fQnIFB2qJR2z3DrfYEonNt/ev
SAySkPPq4/mEOjaI0pFlDDGSaps+FTcJFgoVRTasBIF7JJivvjW9ap8iWEbhhVLe
IrFLbMLpUcTRntUx7R4fVMJ/1/cGn+NWZmNwS9ORorzSyCH0IAgCw1Xc3ZrjuMbF
VjdToMC1TiXXCEmlYpQakmQ3Ay1cH0FHC2BBNn1MNVkJdPhpZIZCdhaMPHfYFpyo
pg8wFvZ5iIcvlbMgyuy8CPJVRWUcYy2dOhEOGnYJnXRPkE3E1hf8YOHNzRlduH89
6lT9qcEK2+fpLfrVGoc4zscLZ+Ey+Ko6iQRdVE1j67+wNR3hX8ukue574v1N/xxu
i575jumSE19lEj1sH4+P4gFHOtTbF0JhKKzLctbga0IAwTPKhnt3qzj1U5Yj/MZS
uEVjrLhdRauOuFBXUclgyVf2w/lE85UUOdlcollsYA6Huq7xDamqf8SslZQGre3E
I+lhpqJR1cOwDMUzzcl40uTyhrxXXd/bk4QSlhZbwHR25Pnt+ZMtWavlQWS0eDEV
8djuXAURCmx5WOqAFB/TJe1mn5EvyWg4VFzrY/NVNOpzgY5+Xp7J28z7f637r712
Eu9j4imVcdPigwS+jf/0f81i2o9b82Y26TN8+EtDLCY841MJ1lrjDrX/dno=
=Y+3h
-----END PGP PUBLIC KEY BLOCK-----

View File

@@ -1,92 +0,0 @@
---
# ChatGPT desktop is installed from OpenAI's signed RPM repository; removal
# must clean up the package, the managed repository and its signing key.
- name: Validate ChatGPT desktop architecture on Fedora
tags: [packages, chatgpt]
ansible.builtin.assert:
that:
- ansible_facts['architecture'] in chatgpt_desktop_supported_architectures
- ansible_facts['distribution_major_version'] in chatgpt_desktop_supported_fedora_versions
fail_msg: >-
ChatGPT desktop supports Fedora {{ chatgpt_desktop_supported_fedora_versions | join(' and ') }}
on x86_64 or aarch64; detected Fedora {{ ansible_facts['distribution_major_version'] }}
on {{ ansible_facts['architecture'] }}.
when: chatgpt_desktop_install_enabled | default(false) | bool
- name: Install ChatGPT desktop RPM signing key
tags: [packages, chatgpt]
ansible.builtin.copy:
src: "{{ chatgpt_desktop_rpm_gpg_key }}"
dest: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
owner: root
group: root
mode: "0644"
when: chatgpt_desktop_install_enabled | default(false) | bool
- name: Import ChatGPT desktop RPM signing key
tags: [packages, chatgpt]
ansible.builtin.rpm_key:
state: present
key: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
when: chatgpt_desktop_install_enabled | default(false) | bool
- name: Configure ChatGPT desktop RPM repository
tags: [packages, chatgpt]
ansible.builtin.yum_repository:
name: openai-chatgpt
description: ChatGPT
baseurl: "{{ chatgpt_desktop_rpm_repository }}"
enabled: true
gpgcheck: true
repo_gpgcheck: true
gpgkey: "file:///etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
state: present
when: chatgpt_desktop_install_enabled | default(false) | bool
- name: Install ChatGPT desktop on selected Fedora hosts
tags: [packages, chatgpt]
ansible.builtin.dnf:
name: chatgpt
state: latest
update_cache: true
when: chatgpt_desktop_install_enabled | default(false) | bool
- name: Check for the installed ChatGPT desktop signing key
tags: [packages, chatgpt]
ansible.builtin.stat:
path: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
get_checksum: false
register: chatgpt_desktop_signing_key
when: chatgpt_desktop_uninstall_enabled | default(false) | bool
- name: Remove ChatGPT desktop from selected Fedora hosts
tags: [packages, chatgpt]
ansible.builtin.dnf:
name: chatgpt
state: absent
when: chatgpt_desktop_uninstall_enabled | default(false) | bool
- name: Remove ChatGPT desktop RPM repository
tags: [packages, chatgpt]
ansible.builtin.yum_repository:
name: openai-chatgpt
state: absent
when: chatgpt_desktop_uninstall_enabled | default(false) | bool
# rpm_key reads the identifier from the key file, so only remove the key from
# the RPM database while the deployed file is still present.
- name: Remove ChatGPT desktop RPM signing key from the RPM database
tags: [packages, chatgpt]
ansible.builtin.rpm_key:
state: absent
key: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
when:
- chatgpt_desktop_uninstall_enabled | default(false) | bool
- chatgpt_desktop_signing_key.stat.exists | default(false)
- name: Remove ChatGPT desktop RPM signing key file
tags: [packages, chatgpt]
ansible.builtin.file:
path: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
state: absent
when: chatgpt_desktop_uninstall_enabled | default(false) | bool

View File

@@ -1,78 +0,0 @@
---
# Cline Desktop ships unsigned RPMs from its GitHub releases; only the
# checksum-verified download makes the local installation trustworthy.
- name: Validate Cline Desktop architecture on Fedora
ansible.builtin.assert:
that:
- ansible_facts['architecture'] in cline_desktop_rpm_checksums
fail_msg: "No verified Cline Desktop RPM for {{ ansible_facts['architecture'] }}."
when: cline_desktop_install_enabled | default(false) | bool
# Runs for both flows so the register below is always valid.
- name: Check for cached Cline Desktop RPM
ansible.builtin.stat:
path: "{{ cline_desktop_rpm_path }}"
get_checksum: false
register: cline_desktop_rpm_cache
- name: Download verified Cline Desktop RPM
ansible.builtin.get_url:
url: "{{ cline_desktop_rpm_url }}"
dest: "{{ cline_desktop_rpm_path }}"
checksum: "{{ cline_desktop_rpm_checksums[ansible_facts['architecture']] }}"
owner: root
group: root
mode: "0644"
# get_url only sends HEAD in check mode and cannot populate a cold cache.
when:
- cline_desktop_install_enabled | default(false) | bool
- not ansible_check_mode
- name: Install Cline Desktop on Fedora
ansible.builtin.dnf:
name: "{{ cline_desktop_rpm_path }}"
state: present
# Upstream ships an unsigned RPM. The download above verifies its pinned
# SHA-256; do not disable signature checks in system repository settings.
disable_gpg_check: true
when:
- cline_desktop_install_enabled | default(false) | bool
- not ansible_check_mode
or cline_desktop_rpm_cache.stat.exists
- name: Explain Cline Desktop cold-cache check-mode limitation
ansible.builtin.debug:
msg: >-
A real run will download and SHA-256 verify Cline Desktop
{{ cline_desktop_version }} before ensuring it is installed.
The RPM is not cached, so this dry run cannot validate DNF dependencies.
when:
- cline_desktop_install_enabled | default(false) | bool
- ansible_check_mode
- not cline_desktop_rpm_cache.stat.exists
# The `cline` RPM package name is verified from the pinned release header;
# removal never touches the npm-managed cline CLI or user data.
- name: Remove Cline Desktop from Fedora
ansible.builtin.dnf:
name: cline
state: absent
when: cline_desktop_uninstall_enabled | default(false) | bool
# Clean every cached download so retirement also removes outdated pins.
- name: Find cached Cline Desktop RPM downloads
ansible.builtin.find:
paths: /var/cache
patterns: "cline-desktop-*.rpm"
file_type: file
register: cline_desktop_cached_rpms
when: cline_desktop_uninstall_enabled | default(false) | bool
- name: Remove cached Cline Desktop RPM downloads
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ cline_desktop_cached_rpms.files | default([]) }}"
loop_control:
label: "{{ item.path }}"
when: cline_desktop_uninstall_enabled | default(false) | bool

View File

@@ -1,4 +1,9 @@
---
- name: Gather installed package facts
tags: [packages]
ansible.builtin.package_facts:
manager: auto
- name: Copy Fedora dotfiles
tags: [dotfiles, dotfiles:common]
ansible.builtin.copy:
@@ -21,49 +26,54 @@
gpgcheck: true
gpgkey: https://download.docker.com/linux/fedora/gpg
state: present
when: fedora_manage_docker_repo | default(false)
- name: Configure Google Chrome repository on Fedora
tags: [packages]
ansible.builtin.yum_repository:
name: google-chrome
description: Google Chrome
baseurl: "https://dl.google.com/linux/chrome/rpm/stable/$basearch"
enabled: true
gpgcheck: true
gpgkey: https://dl.google.com/linux/linux_signing_key.pub
state: present
when:
- "'workstation_dev_fedora' in group_names"
- fedora_manage_docker_repo | default(false)
- workstation_manage_google_chrome | default(false)
- fedora_manage_google_chrome_repo | default(false)
- name: Install distribution signing keys for Fedora desktop codecs
tags: [packages, heic]
ansible.builtin.dnf:
name: distribution-gpg-keys
- name: Configure Visual Studio Code repository on Fedora
tags: [packages, vscode]
ansible.builtin.yum_repository:
name: vscode
description: Visual Studio Code
baseurl: https://packages.microsoft.com/yumrepos/vscode
enabled: true
gpgcheck: true
gpgkey: https://packages.microsoft.com/keys/microsoft.asc
state: present
when: "'graphical_desktop' in group_names"
when:
- "'workstation_host_linux' in group_names"
- fedora_manage_vscode_repo | default(false)
- name: Import RPM Fusion Free signing key for Fedora desktop codecs
tags: [packages, heic]
ansible.builtin.rpm_key:
key: /usr/share/distribution-gpg-keys/rpmfusion/RPM-GPG-KEY-rpmfusion-free-fedora-2020
fingerprint: E9A491A3DE247814E7E067EAE06F8ECDD651FF2E
state: present
when: "'graphical_desktop' in group_names"
- name: Enable RPM Fusion Free for Fedora desktop codecs
tags: [packages, heic]
ansible.builtin.dnf:
name: "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ ansible_facts['distribution_major_version'] }}.noarch.rpm"
state: present
when: "'graphical_desktop' in group_names"
- name: Configure IntelliJ IDEA COPR repository on Fedora
tags: [packages]
ansible.builtin.get_url:
url: >-
https://copr.fedorainfracloud.org/coprs/{{ fedora_intellij_copr_owner }}/{{ fedora_intellij_copr_project }}/repo/fedora-{{ ansible_facts['distribution_major_version'] }}/{{ fedora_intellij_copr_owner }}-{{ fedora_intellij_copr_project }}-fedora-{{ ansible_facts['distribution_major_version'] }}.repo
dest: /etc/yum.repos.d/{{ fedora_intellij_copr_owner }}-{{ fedora_intellij_copr_project }}-fedora-{{ ansible_facts['distribution_major_version'] }}.repo
owner: root
group: root
mode: "0644"
when:
- "'workstation_host_linux' in group_names"
- fedora_manage_intellij_repo | default(false)
- name: Refresh dnf package metadata
tags: [packages]
ansible.builtin.dnf:
update_cache: true
- name: Install HEIC decoder when RPM Fusion has a compatible build
tags: [packages, heic]
ansible.builtin.dnf:
name: libheif-freeworld
state: present
update_cache: true
# libheif-freeworld requires the exact libheif build. RPM Fusion can lag
# Fedora Updates, so retry on later runs instead of blocking all desktop
# package convergence while the matching build is unavailable.
skip_broken: true
when: "'graphical_desktop' in group_names"
- name: Install packages on Fedora
tags: [packages]
ansible.builtin.dnf:
@@ -72,188 +82,58 @@
(
(common_packages | default([]))
+ (fedora_packages_base | default([]))
+ (fedora_docker_packages | default([]))
+ (
(fedora_docker_packages | default([]))
if 'workstation_dev_fedora' in group_names
['google-chrome-stable']
if workstation_manage_google_chrome | default(false)
else []
)
+ (profile_packages | default([]))
+ (fedora_workstation_dev_packages | default(workstation_dev_packages | default([])))
+ (
(fedora_desktop_packages | default([]))
if 'graphical_desktop' in group_names
(workstation_host_linux_packages_fedora | default(workstation_host_linux_packages | default([])))
if 'workstation_host_linux' in group_names
else []
)
+ (
(fedora_emacs_packages | default([]))
[fedora_intellij_package_name]
if (
emacs_enabled | default(false) | bool
'workstation_host_linux' in group_names
and fedora_manage_intellij_repo | default(false)
)
else []
)
+ (
(fedora_dev_packages | default([]))
if 'workstation_dev_fedora' in group_names
else []
)
+ (
(workstation_dev_wsl_packages | default([]))
if 'workstation_dev_wsl' in group_names
else []
)
+ (host_packages | default([]))
)
| difference(fedora_excluded_packages | default([]))
| unique
}}
state: present
- name: Remove excluded Fedora packages
tags: [packages]
ansible.builtin.dnf:
name: "{{ fedora_removed_packages | default([]) }}"
state: absent
when: (fedora_removed_packages | default([])) | length > 0
- name: Add user to docker group
tags: [packages]
ansible.builtin.user:
name: "{{ effective_username }}"
groups: docker
append: true
when:
- "'workstation_dev_fedora' in group_names"
- (fedora_docker_packages | default([])) | length > 0
when: (fedora_docker_packages | default([])) | length > 0
- name: Install shared AI coding agents on Fedora
tags: [packages, npm, ai_agents]
community.general.npm:
name: "{{ item.value.npm_package }}"
global: true
state: latest
register: ai_agent_npm_install
retries: "{{ ai_agents_npm_install_retries }}"
delay: "{{ ai_agents_npm_install_retry_delay }}"
until: ai_agent_npm_install is succeeded
loop: "{{ ai_agents | dict2items | selectattr('value.npm_package', 'defined') | list }}"
when:
- item.value.install_enabled | bool
- "'workstation_dev_fedora' not in group_names"
loop_control:
label: "{{ item.key }}"
- name: Uninstall shared AI coding agents on Fedora
tags: [packages, npm, ai_agents]
community.general.npm:
name: "{{ item.value.npm_package }}"
global: true
state: absent
loop: "{{ ai_agents | dict2items | selectattr('value.npm_package', 'defined') | list }}"
when:
- item.value.uninstall_enabled | bool
- "'workstation_dev_fedora' not in group_names"
loop_control:
label: "{{ item.key }}"
- name: Manage ChatGPT desktop lifecycle on Fedora graphical hosts
tags: [packages, chatgpt]
ansible.builtin.import_tasks: chatgpt_desktop.yml
when:
- "'graphical_desktop' in group_names"
- chatgpt_desktop_install_enabled | default(false) | bool
or chatgpt_desktop_uninstall_enabled | default(false) | bool
- name: Manage OpenCode Desktop lifecycle on Fedora graphical hosts
tags: [packages, opencode_desktop]
ansible.builtin.import_tasks: opencode_desktop.yml
when:
- "'graphical_desktop' in group_names"
- opencode_desktop_install_enabled | default(false) | bool
or opencode_desktop_uninstall_enabled | default(false) | bool
- name: Manage Cline Desktop lifecycle on Fedora graphical hosts
tags: [packages, cline_desktop]
ansible.builtin.import_tasks: cline_desktop.yml
when:
- "'graphical_desktop' in group_names"
- cline_desktop_install_enabled | default(false) | bool
or cline_desktop_uninstall_enabled | default(false) | bool
- name: Define Fedora Flatpak applications
tags: [packages]
ansible.builtin.set_fact:
packages_fedora_flatpak_packages: >-
{{
(
(fedora_flatpak_packages | default([]))
+ (host_flatpak_packages | default([]))
)
| unique
}}
- name: Ensure Flathub remote is configured on Fedora
- name: Ensure Flathub remote is configured for Fedora workstation
tags: [packages]
community.general.flatpak_remote:
name: "{{ fedora_flatpak_remote_name | default('flathub') }}"
name: "{{ workstation_flatpak_remote_name | default('flathub') }}"
state: present
flatpakrepo_url: "{{ fedora_flatpak_remote_url | default('https://dl.flathub.org/repo/flathub.flatpakrepo') }}"
when: (packages_fedora_flatpak_packages | default([])) | length > 0
flatpakrepo_url: "{{ workstation_flatpak_remote_url | default('https://dl.flathub.org/repo/flathub.flatpakrepo') }}"
when:
- "'workstation_host_linux' in group_names"
- (workstation_flatpak_packages | default([])) | length > 0
- name: Install Fedora Flatpak applications
- name: Install Fedora workstation Flatpak applications
tags: [packages]
community.general.flatpak:
name: "{{ packages_fedora_flatpak_packages }}"
name: "{{ workstation_flatpak_packages }}"
state: present
remote: "{{ fedora_flatpak_remote_name | default('flathub') }}"
remote: "{{ workstation_flatpak_remote_name | default('flathub') }}"
method: system
when: (packages_fedora_flatpak_packages | default([])) | length > 0
- name: Ensure Fedora Nerd Fonts base directory exists
tags: [packages, fonts]
ansible.builtin.file:
path: /usr/local/share/fonts/nerd-fonts
state: directory
owner: root
group: root
mode: "0755"
when: (fedora_nerd_fonts | default([])) | length > 0
- name: Ensure Fedora per-font Nerd Fonts directories exist
tags: [packages, fonts]
ansible.builtin.file:
path: "/usr/local/share/fonts/nerd-fonts/{{ item }}"
state: directory
owner: root
group: root
mode: "0755"
loop: "{{ fedora_nerd_fonts | default([]) }}"
- name: Download Fedora Nerd Font archives
tags: [packages, fonts]
ansible.builtin.get_url:
url: "https://github.com/ryanoasis/nerd-fonts/releases/download/{{ fedora_nerd_fonts_version }}/{{ item }}.zip"
dest: "/usr/local/share/fonts/nerd-fonts/{{ item }}.zip"
owner: root
group: root
mode: "0644"
loop: "{{ fedora_nerd_fonts | default([]) }}"
loop_control:
label: "{{ item }}"
- name: Extract Fedora Nerd Font archives
tags: [packages, fonts]
ansible.builtin.unarchive:
src: "/usr/local/share/fonts/nerd-fonts/{{ item }}.zip"
dest: "/usr/local/share/fonts/nerd-fonts/{{ item }}"
remote_src: true
owner: root
group: root
loop: "{{ fedora_nerd_fonts | default([]) }}"
loop_control:
label: "{{ item }}"
register: fedora_nerd_fonts_extract
- name: Refresh system font cache after installing Fedora Nerd Fonts
tags: [packages, fonts]
ansible.builtin.command: fc-cache -f
changed_when: false
when: fedora_nerd_fonts_extract is changed
when:
- "'workstation_host_linux' in group_names"
- (workstation_flatpak_packages | default([])) | length > 0

View File

@@ -1,78 +0,0 @@
---
# OpenCode Desktop ships unsigned RPMs from its GitHub releases; only the
# checksum-verified download makes the local installation trustworthy.
- name: Validate OpenCode Desktop architecture on Fedora
ansible.builtin.assert:
that:
- ansible_facts['architecture'] in opencode_desktop_rpm_checksums
fail_msg: "No verified OpenCode Desktop RPM for {{ ansible_facts['architecture'] }}."
when: opencode_desktop_install_enabled | default(false) | bool
# Runs for both flows so the register below is always valid.
- name: Check for cached OpenCode Desktop RPM
ansible.builtin.stat:
path: "{{ opencode_desktop_rpm_path }}"
get_checksum: false
register: opencode_desktop_rpm_cache
- name: Download verified OpenCode Desktop RPM
ansible.builtin.get_url:
url: "{{ opencode_desktop_rpm_url }}"
dest: "{{ opencode_desktop_rpm_path }}"
checksum: "{{ opencode_desktop_rpm_checksums[ansible_facts['architecture']] }}"
owner: root
group: root
mode: "0644"
# get_url only sends HEAD in check mode and cannot populate a cold cache.
when:
- opencode_desktop_install_enabled | default(false) | bool
- not ansible_check_mode
- name: Install OpenCode Desktop on Fedora
ansible.builtin.dnf:
name: "{{ opencode_desktop_rpm_path }}"
state: present
# Upstream ships an unsigned RPM. The download above verifies its pinned
# SHA-256; do not disable signature checks in system repository settings.
disable_gpg_check: true
when:
- opencode_desktop_install_enabled | default(false) | bool
- not ansible_check_mode
or opencode_desktop_rpm_cache.stat.exists
- name: Explain OpenCode Desktop cold-cache check-mode limitation
ansible.builtin.debug:
msg: >-
A real run will download and SHA-256 verify OpenCode Desktop
{{ opencode_desktop_version }} before ensuring it is installed.
The RPM is not cached, so this dry run cannot validate DNF dependencies.
when:
- opencode_desktop_install_enabled | default(false) | bool
- ansible_check_mode
- not opencode_desktop_rpm_cache.stat.exists
# The `opencode` RPM package name is verified from the pinned release header;
# removal never touches the npm-managed opencode-ai CLI or user data.
- name: Remove OpenCode Desktop from Fedora
ansible.builtin.dnf:
name: opencode
state: absent
when: opencode_desktop_uninstall_enabled | default(false) | bool
# Clean every cached download so retirement also removes outdated pins.
- name: Find cached OpenCode Desktop RPM downloads
ansible.builtin.find:
paths: /var/cache
patterns: "opencode-desktop-*.rpm"
file_type: file
register: opencode_desktop_cached_rpms
when: opencode_desktop_uninstall_enabled | default(false) | bool
- name: Remove cached OpenCode Desktop RPM downloads
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ opencode_desktop_cached_rpms.files | default([]) }}"
loop_control:
label: "{{ item.path }}"
when: opencode_desktop_uninstall_enabled | default(false) | bool

View File

@@ -1,196 +0,0 @@
---
- name: Require Rocky Linux 9
tags: [packages]
ansible.builtin.assert:
that:
- ansible_facts['distribution'] == 'Rocky'
- ansible_facts['distribution_major_version'] == '9'
fail_msg: This platform role supports Rocky Linux 9 only.
- name: Install DNF configuration plugin
tags: [packages]
ansible.builtin.dnf:
name: dnf-plugins-core
state: present
- name: Enable Rocky CodeReady Builder repository
tags: [packages]
community.general.dnf_config_manager:
name:
- crb
state: enabled
when: rocky_enable_crb | default(true) | bool
- name: Install EPEL repository package
tags: [packages]
ansible.builtin.dnf:
name: epel-release
state: present
- name: Import official OpenZFS EL9+ signing key
tags: [packages, storage]
ansible.builtin.rpm_key:
state: present
key: "{{ rocky_openzfs_gpg_key_url }}"
fingerprint: "{{ rocky_openzfs_gpg_key_fingerprint }}"
when: rocky_manage_openzfs_repo | bool
- name: Install official OpenZFS repository package
tags: [packages, storage]
ansible.builtin.dnf:
name: "{{ rocky_openzfs_release_rpm }}"
state: present
when: rocky_manage_openzfs_repo | bool
- name: Disable OpenZFS DKMS repository
tags: [packages, storage]
community.general.dnf_config_manager:
name:
- zfs
state: disabled
when: rocky_manage_openzfs_repo | bool
- name: Enable OpenZFS kmod repository
tags: [packages, storage]
community.general.dnf_config_manager:
name:
- zfs-kmod
state: enabled
when: rocky_manage_openzfs_repo | bool
- name: Configure official GitHub CLI RPM repository
tags: [packages]
ansible.builtin.get_url:
url: "{{ rocky_github_cli_repo_url }}"
dest: "{{ rocky_github_cli_repo_file }}"
owner: root
group: root
mode: "0644"
when: rocky_manage_github_cli_repo | bool
- name: Refresh Rocky package metadata
tags: [packages]
ansible.builtin.dnf:
update_cache: true
- name: Install packages on Rocky Linux
tags: [packages]
ansible.builtin.dnf:
name: >-
{{
(
(rocky_common_packages | default([]))
+ (rocky_packages_base | default([]))
+ (rocky_profile_packages | default([]))
+ (rocky_podman_packages | default([]))
+ (host_packages | default([]))
) | unique
}}
state: present
- name: Ensure Podman runtime socket directory exists
tags: [packages, podman]
ansible.builtin.file:
path: /run/podman
state: directory
owner: root
group: root
mode: "0700"
when: rocky_manage_podman | bool
- name: Require supported architecture for Syncthing
tags: [packages, syncthing]
ansible.builtin.assert:
that:
- ansible_facts['architecture'] == 'x86_64'
fail_msg: The pinned Atlas Syncthing binary currently supports x86_64 only.
when: rocky_manage_syncthing_binary | bool
- name: Read installed Syncthing version
tags: [packages, syncthing]
ansible.builtin.command:
argv:
- /usr/local/bin/syncthing
- --version
register: rocky_syncthing_version_check
changed_when: false
failed_when: false
check_mode: false
when: rocky_manage_syncthing_binary | bool
- name: Determine whether Syncthing must be installed
tags: [packages, syncthing]
ansible.builtin.set_fact:
rocky_syncthing_install_required: >-
{{
('syncthing v' ~ rocky_syncthing_version ~ ' ')
not in (rocky_syncthing_version_check.stdout | default(''))
}}
when: rocky_manage_syncthing_binary | bool
- name: Create temporary Syncthing extraction directory
tags: [packages, syncthing]
ansible.builtin.file:
path: "/tmp/syncthing-{{ rocky_syncthing_version }}"
state: directory
owner: root
group: root
mode: "0755"
when:
- rocky_manage_syncthing_binary | bool
- rocky_syncthing_install_required | bool
- name: Download pinned Syncthing release
tags: [packages, syncthing]
ansible.builtin.get_url:
url: "{{ rocky_syncthing_archive_url }}"
dest: "/tmp/syncthing-{{ rocky_syncthing_version }}.tar.gz"
checksum: "{{ rocky_syncthing_archive_checksum }}"
owner: root
group: root
mode: "0644"
when:
- rocky_manage_syncthing_binary | bool
- rocky_syncthing_install_required | bool
- name: Extract pinned Syncthing release
tags: [packages, syncthing]
ansible.builtin.unarchive:
src: "/tmp/syncthing-{{ rocky_syncthing_version }}.tar.gz"
dest: "/tmp/syncthing-{{ rocky_syncthing_version }}"
remote_src: true
when:
- rocky_manage_syncthing_binary | bool
- rocky_syncthing_install_required | bool
- name: Install pinned Syncthing binary
tags: [packages, syncthing]
ansible.builtin.copy:
src: >-
{{
'/tmp/syncthing-' ~ rocky_syncthing_version
~ '/syncthing-linux-amd64-v' ~ rocky_syncthing_version
~ '/syncthing'
}}
dest: /usr/local/bin/syncthing
remote_src: true
owner: root
group: root
mode: "0755"
when:
- rocky_manage_syncthing_binary | bool
- rocky_syncthing_install_required | bool
- name: Remove Syncthing release archive
tags: [packages, syncthing]
ansible.builtin.file:
path: "/tmp/syncthing-{{ rocky_syncthing_version }}.tar.gz"
state: absent
when: rocky_manage_syncthing_binary | bool
- name: Remove Syncthing extraction directory
tags: [packages, syncthing]
ansible.builtin.file:
path: "/tmp/syncthing-{{ rocky_syncthing_version }}"
state: absent
when: rocky_manage_syncthing_binary | bool

View File

@@ -0,0 +1,162 @@
---
- name: Gather installed package facts
tags: [packages]
ansible.builtin.package_facts:
manager: auto
- name: Copy Ubuntu dotfiles
tags: [dotfiles, dotfiles:common]
ansible.builtin.copy:
src: "{{ playbook_dir }}/../dotfiles/ubuntu/{{ item.src }}"
dest: "{{ effective_user_home }}/{{ item.dest }}"
owner: "{{ effective_username }}"
group: "{{ effective_user_group }}"
mode: "{{ item.mode }}"
loop: "{{ ubuntu_dotfiles | default([]) }}"
loop_control:
label: "{{ item.dest }}"
- name: Ensure architecture is supported for Google Chrome
tags: [packages]
ansible.builtin.fail:
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for Google Chrome stable package"
when:
- workstation_manage_google_chrome | default(false)
- ansible_facts['architecture'] != 'x86_64'
- name: Download Google Chrome Debian package
tags: [packages]
ansible.builtin.get_url:
url: https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dest: /tmp/google-chrome-stable_current_amd64.deb
mode: "0644"
when:
- workstation_manage_google_chrome | default(false)
- "'google-chrome-stable' not in (ansible_facts.packages | default({}))"
- name: Install Google Chrome from downloaded Debian package
tags: [packages]
ansible.builtin.apt:
deb: /tmp/google-chrome-stable_current_amd64.deb
state: present
when:
- workstation_manage_google_chrome | default(false)
- "'google-chrome-stable' not in (ansible_facts.packages | default({}))"
- name: Remove downloaded Google Chrome Debian package
tags: [packages]
ansible.builtin.file:
path: /tmp/google-chrome-stable_current_amd64.deb
state: absent
when:
- workstation_manage_google_chrome | default(false)
- "'google-chrome-stable' not in (ansible_facts.packages | default({}))"
- name: Ensure Docker apt keyrings directory exists
tags: [packages]
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory
owner: root
group: root
mode: "0755"
when: ubuntu_manage_docker_repo | default(false)
- name: Download Docker apt repository signing key
tags: [packages]
ansible.builtin.get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /etc/apt/keyrings/docker.asc
owner: root
group: root
mode: "0644"
when: ubuntu_manage_docker_repo | default(false)
- name: Configure Docker apt repository
tags: [packages]
ansible.builtin.apt_repository:
repo: >-
deb [arch={{ 'amd64' if ansible_facts['architecture'] == 'x86_64'
else 'arm64' if ansible_facts['architecture'] in ['aarch64', 'arm64']
else ansible_facts['architecture'] }}
signed-by=/etc/apt/keyrings/docker.asc]
https://download.docker.com/linux/ubuntu
{{ ansible_facts['distribution_release'] }} stable
filename: docker
state: present
update_cache: true
when: ubuntu_manage_docker_repo | default(false)
- name: Refresh apt package cache
tags: [packages]
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
- name: Install packages on Ubuntu
tags: [packages]
ansible.builtin.apt:
name: >-
{{
(
(common_packages | default([]))
+ (ubuntu_packages_base | default([]))
+ (ubuntu_docker_packages | default([]))
+ (profile_packages | default([]))
+ (workstation_dev_packages | default([]))
+ (
(workstation_host_linux_packages | default([]))
if 'workstation_host_linux' in group_names
else []
)
+ (
(workstation_dev_wsl_packages | default([]))
if 'workstation_dev_wsl' in group_names
else []
)
+ (desktop_common_packages | default([]))
+ (
(desktop_i3_packages | default([]))
if 'i3' in (desktop_sessions_enabled | default([]))
else []
)
+ (host_packages | default([]))
)
| difference(
(workstation_dev_wsl_excluded_packages | default([]))
if 'workstation_dev_wsl' in group_names
else []
)
| unique
}}
state: present
- name: Add user to docker group
tags: [packages]
ansible.builtin.user:
name: "{{ effective_username }}"
groups: docker
append: true
when: (ubuntu_docker_packages | default([])) | length > 0
- name: Remove workstation snap packages
tags: [packages]
community.general.snap:
name: "{{ item }}"
state: absent
loop: "{{ workstation_removed_snap_packages | default([]) }}"
loop_control:
label: "{{ item }}"
when: (workstation_removed_snap_packages | default([])) | length > 0
- name: Install workstation snap packages
tags: [packages]
community.general.snap:
name: "{{ item.name }}"
classic: "{{ item.classic | default(false) }}"
channel: "{{ item.channel | default(omit) }}"
state: present
loop: "{{ workstation_snap_packages | default([]) }}"
loop_control:
label: "{{ item.name }}"
when: (workstation_snap_packages | default([])) | length > 0

View File

@@ -5,9 +5,9 @@
path: /etc/xbps.d
state: directory
mode: "0755"
when: (void_xbps_repositories | default([]) + host_xbps_repositories | default([])) | length > 0
when: (host_xbps_repositories | default([])) | length > 0
- name: Configure Void XBPS repositories
- name: Configure host-specific XBPS repositories
tags: [packages]
ansible.builtin.copy:
dest: "/etc/xbps.d/{{ item.name }}.conf"
@@ -16,11 +16,11 @@
owner: root
group: root
mode: "0644"
loop: "{{ void_xbps_repositories | default([]) + host_xbps_repositories | default([]) }}"
loop: "{{ host_xbps_repositories | default([]) }}"
loop_control:
label: "{{ item.name }}"
register: packages_void_xbps_repository_configs
when: (void_xbps_repositories | default([]) + host_xbps_repositories | default([])) | length > 0
register: host_xbps_repository_configs
when: (host_xbps_repositories | default([])) | length > 0
- name: Install Void nonfree repository if needed
tags: [packages]
@@ -28,7 +28,7 @@
name: void-repo-nonfree
state: present
update_cache: false
register: packages_void_nonfree_repository
register: void_nonfree_repository
when: "'void-repo-nonfree' in (host_packages | default([]) + void_packages_base | default([]))"
- name: Refresh XBPS cache after configuring repositories
@@ -37,8 +37,8 @@
update_cache: true
accept_pubkey: true
when: >-
(void_xbps_repositories | default([]) + host_xbps_repositories | default([])) | length > 0
or (packages_void_nonfree_repository is defined and packages_void_nonfree_repository is changed)
(host_xbps_repositories | default([])) | length > 0
or (void_nonfree_repository is defined and void_nonfree_repository is changed)
- name: Synchronize and upgrade Void Linux packages
tags: [packages]
@@ -46,46 +46,6 @@
update_cache: false
upgrade: true
- name: Select packages for the configured desktop environment
tags: [packages]
ansible.builtin.set_fact:
packages_void_selected_desktop_packages: >-
{{
(desktop_minimal_packages | default([]))
+ (
(desktop_sway_packages | default([]))
if (
(desktop_environment | default('minimal')) == 'minimal'
and 'sway' in (desktop_sessions_enabled | default([]))
)
else []
)
+ (
(desktop_niri_packages | default([]))
if (
(desktop_environment | default('minimal')) == 'minimal'
and 'niri' in (desktop_sessions_enabled | default([]))
)
else []
)
| unique
}}
- name: Calculate packages owned only by inactive desktop environments
tags: [packages]
ansible.builtin.set_fact:
packages_void_inactive_desktop_packages: >-
{{
(
(desktop_minimal_packages | default([]))
+ (desktop_sway_packages | default([]))
+ (desktop_niri_packages | default([]))
)
| unique
| difference(packages_void_selected_desktop_packages)
| difference(['emptty'])
}}
- name: Install packages on Void Linux
tags: [packages]
community.general.xbps:
@@ -95,10 +55,17 @@
(common_packages | default([]))
+ (void_packages_base | default([]))
+ (profile_packages | default([]))
+ ((profile_emacs_packages | default([])) if (emacs_enabled | default(false) | bool) else [])
+ (desktop_common_packages | default([]))
+ ((desktop_emacs_packages | default([])) if (emacs_enabled | default(false) | bool) else [])
+ (packages_void_selected_desktop_packages | default([]))
+ (
(desktop_i3_packages | default([]))
if 'i3' in (desktop_sessions_enabled | default([]))
else []
)
+ (
(desktop_sway_packages | default([]))
if 'sway' in (desktop_sessions_enabled | default([]))
else []
)
+ (host_packages | default([]))
)
| unique
@@ -106,33 +73,9 @@
state: present
update_cache: false
- name: Remove excluded packages on Void Linux
tags: [packages]
community.general.xbps:
name: "{{ void_removed_packages | default([]) }}"
state: absent
update_cache: false
when: (void_removed_packages | default([])) | length > 0
- name: Check whether the selected display manager is active
tags: [packages, display-manager]
ansible.builtin.stat:
path: /var/service/emptty
register: packages_void_selected_display_manager
- name: Remove packages managed by the inactive desktop environment
tags: [packages]
community.general.xbps:
name: "{{ packages_void_inactive_desktop_packages }}"
state: absent
update_cache: false
when:
- (packages_void_inactive_desktop_packages | default([])) | length > 0
- packages_void_selected_display_manager.stat.exists
- name: Remove host-absent packages on Void Linux
tags: [packages]
community.general.xbps:
name: "{{ host_packages_absent | default([]) }}"
state: absent
when: (host_packages_absent | default([])) | length > 0
when: (host_packages_absent | default([])) | length > 0

View File

@@ -1,20 +0,0 @@
---
aegis_hostname: aegis
aegis_layered_packages:
- nfs-utils
- wireguard-tools
aegis_network_connection_name: ""
aegis_network_connection_uuid: ""
aegis_host_dns_servers: []
aegis_host_dns_search_domains: []
aegis_adguard_image: docker.io/adguard/adguardhome:latest
aegis_ikaros_mac_address: aa:bb:cc:dd:ee:ff
aegis_wol_port: 9
aegis_lan_subnet: CHANGEME_LAN_SUBNET
aegis_firewalld_zone: public
aegis_adguard_web_port: 80
aegis_ssh_allowed_users:
- "{{ ansible_user }}"
aegis_ssh_user_home: "/var/home/{{ ansible_user }}"
aegis_ssh_authorized_keys: []

View File

@@ -1,20 +0,0 @@
---
- name: Restart Aegis systemd-resolved
ansible.builtin.systemd:
name: systemd-resolved.service
state: restarted
- name: Reload Aegis SSH
ansible.builtin.systemd:
name: sshd.service
state: reloaded
- name: Restart Aegis AdGuard Quadlet
ansible.builtin.systemd:
name: "{{ item }}"
state: restarted
daemon_reload: true
loop:
- adguardhome.service
loop_control:
label: "{{ item }}"

View File

@@ -1,362 +0,0 @@
---
- name: Manage Aegis layered packages
tags: [aegis, packages, nfs, wireguard]
community.general.rpm_ostree_pkg:
name: "{{ aegis_layered_packages }}"
state: present
register: aegis_layered_packages_result
when: aegis_layered_packages | length > 0
- name: Report reboot required for Aegis layered packages
tags: [aegis, packages, nfs, wireguard]
ansible.builtin.debug:
msg: Reboot Aegis to activate the newly layered packages, then rerun the playbook.
when: aegis_layered_packages_result.needs_reboot | default(false)
- name: Require completed Aegis network placeholders
tags: [aegis, dns, firewall, network, services]
ansible.builtin.assert:
that:
- aegis_lan_subnet != 'CHANGEME_LAN_SUBNET'
- aegis_firewalld_zone | length > 0
- aegis_adguard_web_port | int > 0
- aegis_adguard_web_port | int < 65536
- aegis_network_connection_name | length > 0
- aegis_network_connection_uuid | length > 0
- aegis_host_dns_servers | length > 0
- ansible_facts["default_ipv4"]["address"] not in aegis_host_dns_servers
- aegis_ssh_allowed_users | length > 0
fail_msg: >-
Define the Aegis LAN subnet, firewalld zone, AdGuard web port, independent host DNS,
NetworkManager connection, and SSH users. Aegis must not use its own address as upstream DNS.
- name: Verify the declared Aegis NetworkManager connection exists
tags: [aegis, dns, network, services]
ansible.builtin.command:
argv:
- nmcli
- --get-values
- connection.id
- connection
- show
- uuid
- "{{ aegis_network_connection_uuid }}"
register: aegis_network_connection
changed_when: false
failed_when: >-
aegis_network_connection.rc != 0
or aegis_network_connection.stdout != aegis_network_connection_name
- name: Read the current Aegis host DNS configuration
tags: [aegis, dns, network, services]
ansible.builtin.command:
argv:
- nmcli
- --get-values
- ipv4.ignore-auto-dns,ipv4.dns,ipv4.dns-search,ipv6.ignore-auto-dns
- connection
- show
- uuid
- "{{ aegis_network_connection_uuid }}"
register: aegis_host_dns_current
changed_when: false
- name: Configure independent upstream DNS for the Aegis host
tags: [aegis, dns, network, services]
ansible.builtin.command:
argv:
- nmcli
- connection
- modify
- uuid
- "{{ aegis_network_connection_uuid }}"
- ipv4.ignore-auto-dns
- "yes"
- ipv4.dns
- "{{ aegis_host_dns_servers | join(',') }}"
- ipv4.dns-search
- "{{ aegis_host_dns_search_domains | join(',') }}"
- ipv6.ignore-auto-dns
- "yes"
register: aegis_host_dns_profile
when: >-
aegis_host_dns_current.stdout_lines !=
[
'yes',
aegis_host_dns_servers | join(','),
aegis_host_dns_search_domains | join(','),
'yes'
]
changed_when: true
- name: Report Aegis reboot required for host DNS changes
tags: [aegis, dns, network, services]
ansible.builtin.debug:
msg: Reboot Aegis to activate its independent upstream DNS before testing another OS update.
when: aegis_host_dns_profile.changed | default(false)
- name: Set Aegis hostname
tags: [aegis, services]
ansible.builtin.hostname:
name: "{{ aegis_hostname }}"
- name: Create Aegis persistent container directories
tags: [aegis, containers]
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: "0755"
loop:
- /var/lib/adguard/work
- /var/lib/adguard/conf
- name: Create Quadlet configuration directory
tags: [aegis, containers]
ansible.builtin.file:
path: /etc/containers/systemd
state: directory
owner: root
group: root
mode: "0755"
- name: Render Aegis Quadlet units
tags: [aegis, containers]
ansible.builtin.template:
src: "{{ item.src }}"
dest: "/etc/containers/systemd/{{ item.dest }}"
owner: root
group: root
mode: "0644"
loop:
- src: adguardhome.container.j2
dest: adguardhome.container
loop_control:
label: "{{ item.dest }}"
notify: Restart Aegis AdGuard Quadlet
- name: Create Aegis systemd-resolved configuration directory
tags: [aegis, adguard, dns, services]
ansible.builtin.file:
path: /etc/systemd/resolved.conf.d
state: directory
owner: root
group: root
mode: "0755"
- name: Disable Aegis systemd-resolved DNS stub listener
tags: [aegis, adguard, dns, services]
ansible.builtin.template:
src: 10-adguard-dns.conf.j2
dest: /etc/systemd/resolved.conf.d/10-adguard-dns.conf
owner: root
group: root
mode: "0644"
notify:
- Restart Aegis systemd-resolved
- Restart Aegis AdGuard Quadlet
- name: Point Aegis resolver at the full systemd-resolved configuration
tags: [aegis, adguard, dns, services]
ansible.builtin.file:
src: ../run/systemd/resolve/resolv.conf
dest: /etc/resolv.conf
state: link
force: true
notify: Restart Aegis systemd-resolved
- name: Enable Aegis firewalld
tags: [aegis, firewall, services]
ansible.builtin.systemd:
name: firewalld.service
enabled: true
state: started
- name: Render Aegis AdGuard web firewalld service
tags: [aegis, firewall]
ansible.builtin.template:
src: aegis-adguard-web.xml.j2
dest: /etc/firewalld/services/aegis-adguard-web.xml
owner: root
group: root
mode: "0644"
- name: Reload firewalld custom services
tags: [aegis, firewall]
ansible.builtin.command:
argv:
- firewall-cmd
- --reload
changed_when: false
when: not ansible_check_mode
- name: Remove unrestricted Aegis services from firewalld zone
tags: [aegis, firewall]
ansible.posix.firewalld:
service: "{{ item }}"
permanent: true
immediate: true
state: disabled
zone: "{{ aegis_firewalld_zone }}"
loop:
- ssh
- dns
- http
- aegis-adguard-web
loop_control:
label: "{{ item }}"
- name: Remove retired Aegis TLS access rule
tags: [aegis, firewall]
ansible.posix.firewalld:
rich_rule: 'rule family="ipv4" source address="{{ aegis_lan_subnet }}" port port="853" protocol="tcp" accept'
permanent: true
immediate: true
state: disabled
zone: "{{ aegis_firewalld_zone }}"
- name: Allow Aegis services from the LAN only
tags: [aegis, firewall]
ansible.posix.firewalld:
rich_rule: "{{ item }}"
permanent: true
immediate: true
state: enabled
zone: "{{ aegis_firewalld_zone }}"
loop:
- 'rule family="ipv4" source address="{{ aegis_lan_subnet }}" service name="ssh" accept'
- 'rule family="ipv4" source address="{{ aegis_lan_subnet }}" service name="dns" accept'
- 'rule family="ipv4" source address="{{ aegis_lan_subnet }}" service name="aegis-adguard-web" accept'
loop_control:
label: "{{ item }}"
- name: Check the standard Aegis SSH authorized keys file
tags: [aegis, ssh, services]
ansible.builtin.stat:
path: "{{ aegis_ssh_user_home }}/.ssh/authorized_keys"
register: aegis_authorized_keys
- name: Ensure Aegis SSH authorized key fragments directory exists
tags: [aegis, ssh, services]
ansible.builtin.file:
path: "{{ aegis_ssh_user_home }}/.ssh/authorized_keys.d"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "0700"
when: aegis_ssh_authorized_keys | length > 0
- name: Manage Aegis SSH authorized key fragments
tags: [aegis, ssh, services]
ansible.builtin.copy:
content: "{{ item.key }}\n"
dest: "{{ aegis_ssh_user_home }}/.ssh/authorized_keys.d/{{ item.name }}"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "0600"
loop: "{{ aegis_ssh_authorized_keys }}"
loop_control:
label: "{{ item.name }}"
when: aegis_ssh_authorized_keys | length > 0
- name: Find Aegis SSH authorized key fragments
tags: [aegis, ssh, services]
ansible.builtin.find:
paths: "{{ aegis_ssh_user_home }}/.ssh/authorized_keys.d"
file_type: file
recurse: false
register: aegis_authorized_key_fragments
- name: Require an Aegis SSH authorized key before hardening
tags: [aegis, ssh, services]
ansible.builtin.assert:
that:
- >-
(aegis_ssh_authorized_keys | length > 0)
or (aegis_authorized_keys.stat.exists and aegis_authorized_keys.stat.size | int > 0)
or aegis_authorized_key_fragments.matched | int > 0
fail_msg: Add a public key for the Ansible SSH user before disabling password authentication.
- name: Ensure Aegis SSH configuration drop-in directory exists
tags: [aegis, ssh, services]
ansible.builtin.file:
path: /etc/ssh/sshd_config.d
state: directory
owner: root
group: root
mode: "0755"
- name: Ensure Aegis SSH drop-ins are loaded before other settings
tags: [aegis, ssh, services]
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: '^\s*Include\s+/etc/ssh/sshd_config\.d/\*\.conf\s*$'
line: Include /etc/ssh/sshd_config.d/*.conf
insertbefore: BOF
state: present
validate: "sshd -t -f %s"
- name: Render Aegis SSH hardening drop-in
tags: [aegis, ssh, services]
ansible.builtin.template:
src: 00-aegis-hardening.conf.j2
dest: /etc/ssh/sshd_config.d/00-aegis-hardening.conf
owner: root
group: root
mode: "0600"
notify: Reload Aegis SSH
- name: Validate Aegis SSH configuration
tags: [aegis, ssh, services]
ansible.builtin.command:
argv:
- sshd
- -t
changed_when: false
when: not ansible_check_mode
- name: Read effective Aegis SSH daemon configuration
tags: [aegis, ssh, services]
ansible.builtin.command:
argv:
- sshd
- -T
- -C
- "user={{ ansible_user }},host={{ aegis_hostname }},addr=127.0.0.1"
register: aegis_sshd_effective_configuration
changed_when: false
when: not ansible_check_mode
- name: Verify effective Aegis SSH hardening
tags: [aegis, ssh, services]
ansible.builtin.assert:
that:
- "'permitrootlogin no' in aegis_sshd_effective_configuration.stdout_lines"
- "'pubkeyauthentication yes' in aegis_sshd_effective_configuration.stdout_lines"
- "'passwordauthentication no' in aegis_sshd_effective_configuration.stdout_lines"
- "'kbdinteractiveauthentication no' in aegis_sshd_effective_configuration.stdout_lines"
- "'allowusers ' + (aegis_ssh_allowed_users | join(' ')) in aegis_sshd_effective_configuration.stdout_lines"
when: not ansible_check_mode
- name: Install Wake-on-LAN helper for Ikaros
tags: [aegis, wol]
ansible.builtin.template:
src: wake-ikaros.j2
dest: /usr/local/bin/wake-ikaros
owner: root
group: root
mode: "0755"
- name: Enable Aegis AdGuard Quadlet and automatic updates
tags: [aegis, containers, services]
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
state: started
daemon_reload: true
loop:
- adguardhome.service
- podman-auto-update.timer
loop_control:
label: "{{ item }}"

View File

@@ -1,6 +0,0 @@
# Managed by Ansible. Do not edit manually.
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no
KbdInteractiveAuthentication no
AllowUsers {{ aegis_ssh_allowed_users | join(' ') }}

View File

@@ -1,3 +0,0 @@
# Managed by Ansible. Do not edit manually.
[Resolve]
DNSStubListener=no

View File

@@ -1,18 +0,0 @@
# Managed by Ansible. Do not edit manually.
[Unit]
Description=AdGuard Home DNS sinkhole
Wants=network-online.target
After=network-online.target
[Container]
Image={{ aegis_adguard_image }}
Network=host
Volume=/var/lib/adguard/work:/opt/adguardhome/work:Z
Volume=/var/lib/adguard/conf:/opt/adguardhome/conf:Z
AutoUpdate=registry
[Service]
Restart=always
[Install]
WantedBy=multi-user.target

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Aegis AdGuard Home web interface</short>
<description>AdGuard Home administrative web interface on Aegis.</description>
<port protocol="tcp" port="{{ aegis_adguard_web_port }}"/>
</service>

View File

@@ -1,21 +0,0 @@
#!/usr/bin/env bash
# Managed by Ansible. Do not edit manually.
set -euo pipefail
mac='{{ aegis_ikaros_mac_address }}'
port='{{ aegis_wol_port }}'
mac_hex="${mac//:/}"
if [[ ! $mac_hex =~ ^[[:xdigit:]]{12}$ ]]; then
printf 'Indirizzo MAC non valido: %s\n' "$mac" >&2
exit 1
fi
packet='\xFF\xFF\xFF\xFF\xFF\xFF'
for _ in {1..16}; do
packet+="$(printf '\\x%s\\x%s\\x%s\\x%s\\x%s\\x%s' \
"${mac_hex:0:2}" "${mac_hex:2:2}" "${mac_hex:4:2}" \
"${mac_hex:6:2}" "${mac_hex:8:2}" "${mac_hex:10:2}")"
done
printf '%b' "$packet" > "/dev/udp/255.255.255.255/${port}"

View File

@@ -1,359 +0,0 @@
---
atlas_manage_storage: false
atlas_manage_nextcloud: false
atlas_nextcloud_root: "{{ atlas_app_data_mountpoint }}/nextcloud"
atlas_nextcloud_dataset: "{{ atlas_zfs_pool }}/services/data/nextcloud"
atlas_nextcloud_domain: ""
atlas_onlyoffice_domain: ""
atlas_nextcloud_http_port: 8080
atlas_onlyoffice_http_port: 8081
atlas_nextcloud_network_subnet: 10.90.10.0/24
atlas_nextcloud_network_gateway: 10.90.10.1
atlas_nextcloud_quadlet_dir: "{{ atlas_admin_home }}/.config/containers/systemd"
atlas_nextcloud_private_dir: "{{ atlas_admin_home }}/.config/atlas-nextcloud"
atlas_nextcloud_app_cache: "{{ atlas_admin_home }}/.cache/atlas-nextcloud-apps"
atlas_nextcloud_image: ""
atlas_nextcloud_postgres_image: ""
atlas_nextcloud_redis_image: ""
atlas_onlyoffice_image: ""
atlas_nextcloud_backup_root: "{{ atlas_mount_root }}/backup/nextcloud"
atlas_nextcloud_backup_keep: 2
# A structurally complete bundle from an earlier verified run younger than
# this many seconds is reused instead of re-preparing. Keep it below 24h so
# the nightly Borg run, spaced 24h plus its randomized delay, always refreshes
# the bundle; 0 disables reuse.
atlas_nextcloud_backup_reuse_max_seconds: 72000
atlas_nextcloud_admin: admin
atlas_nextcloud_users: []
atlas_nextcloud_apps: []
# Existing Archive directories; never import into the internal data namespace.
atlas_nextcloud_external_mounts: []
atlas_nextcloud_services:
- atlas-nextcloud-db.service
- atlas-nextcloud-redis.service
- atlas-nextcloud.service
- atlas-onlyoffice.service
atlas_manage_sharing: false
# Destructive first-boot action; normally false once the pool exists.
atlas_create_pool: false
atlas_zpool_disks: []
atlas_admin_username: CHANGEME_ATLAS_ADMIN
atlas_admin_group: "{{ atlas_admin_username }}"
atlas_admin_home: "/home/{{ atlas_admin_username }}"
atlas_admin_uid: 1000
atlas_admin_gid: 1000
atlas_admin_ssh_keys: []
atlas_admin_ssh_key_directory: "{{ atlas_admin_home }}/.ssh/authorized_keys.d"
atlas_admin_password_hash: "!"
# Local forwarding permits an administrator to tunnel a private service without allowing remote forwards.
atlas_ssh_allow_tcp_forwarding: local
atlas_immich_username: immich
atlas_immich_group: immich
atlas_immich_uid: 1100
atlas_immich_gid: 1100
atlas_immich_supplementary_groups:
- video
- render
atlas_lan_subnet: CHANGEME_LAN_SUBNET
atlas_aegis_ip: CHANGEME_AEGIS_IP
atlas_manage_firewall: false
atlas_firewalld_zone: public
atlas_hardening_sysctls:
net.ipv4.conf.all.accept_redirects: "0"
net.ipv4.conf.default.accept_redirects: "0"
net.ipv4.conf.all.send_redirects: "0"
net.ipv4.conf.default.send_redirects: "0"
net.ipv4.conf.all.accept_source_route: "0"
net.ipv4.conf.default.accept_source_route: "0"
net.ipv4.conf.all.log_martians: "1"
net.ipv4.conf.default.log_martians: "1"
net.ipv4.conf.all.rp_filter: "2"
net.ipv4.conf.default.rp_filter: "2"
net.ipv4.tcp_syncookies: "1"
net.ipv4.icmp_echo_ignore_broadcasts: "1"
net.ipv4.icmp_ignore_bogus_error_responses: "1"
net.ipv4.ip_forward: "0"
net.ipv6.conf.all.accept_redirects: "0"
net.ipv6.conf.default.accept_redirects: "0"
net.ipv6.conf.all.accept_source_route: "0"
net.ipv6.conf.default.accept_source_route: "0"
atlas_zfs_pool: CHANGEME_ZFS_POOL
atlas_zfs_dataset_archive: archive
atlas_zfs_dataset_services: services
atlas_zfs_dataset_app_data: services/data
atlas_zfs_dataset_navidrome: services/data/navidrome
atlas_zfs_dataset_syncthing: services/data/syncthing
atlas_zfs_dataset_media: media
atlas_zfs_dataset_music: media/music
atlas_zfs_dataset_backup: backup
atlas_zfs_dataset_host_backups: backup/hosts
atlas_zfs_dataset_backup_prometheus: backup/hosts/prometheus
atlas_zfs_backup_reservation: 500G
atlas_zfs_dataset_photobook: media/photobook
atlas_mount_root: /CHANGEME_ATLAS_MOUNT_ROOT
atlas_manage_zfs_snapshots: false
atlas_zfs_snapshot_prefix: atlas-auto
atlas_zfs_snapshot_policies: []
atlas_manage_zfs_scrub: false
atlas_zfs_scrub_calendar: ""
atlas_manage_borg_backup: false
atlas_borg_username: borg
atlas_borg_group: borg
atlas_borg_home: /var/lib/atlas-borg
atlas_borg_repository_host: CHANGEME_BORG_HOST
atlas_borg_repository_user: CHANGEME_BORG_USER
atlas_borg_repository_port: 23
atlas_borg_repository_path: ./borg-data
atlas_borg_remote_path: borg-1.4
atlas_borg_host_key: ""
atlas_borg_ssh_private_key_path: /etc/atlas-borg/id_ed25519
atlas_borg_known_hosts_path: /etc/atlas-borg/known_hosts
atlas_borg_passphrase_path: /etc/atlas-borg/passphrase
atlas_borg_ssh_wrapper_path: /usr/local/libexec/atlas-borg-ssh
atlas_borg_passphrase: "{{ vault_atlas_borg_passphrase | default('') }}"
atlas_borg_encryption_mode: repokey
atlas_borg_archive_prefix: atlas
atlas_borg_snapshot_prefix: atlas-borg
atlas_borg_compression: auto,zstd,3
atlas_borg_backup_calendar: ""
atlas_borg_check_calendar: ""
atlas_borg_randomized_delay: 30m
atlas_borg_keep_daily: 30
atlas_borg_keep_weekly: 8
atlas_borg_keep_monthly: 12
atlas_borg_config_dir: /var/lib/atlas-borg
atlas_borg_cache_dir: /var/cache/atlas-borg
atlas_borg_lock_path: /var/lib/atlas-borg/backup.lock
atlas_borg_recovery_export_path: "{{ playbook_dir }}/../secrets/recovery/atlas-borg-repokey.export"
# Manual-only offline backup. No USB device is formatted or mounted by Ansible.
atlas_manage_usb_backup: false
atlas_usb_backup_luks_uuid: ""
atlas_usb_backup_fs_uuid: ""
atlas_usb_backup_mapper_name: atlas-usb-backup
atlas_usb_backup_min_free_bytes: 10737418240
atlas_usb_backup_snapshot_prefix: atlas-usb
atlas_manage_usb_reminder: false
atlas_usb_reminder_calendar: ""
atlas_usb_reminder_notifier: /opt/45drives/houston/houston-notify
# Read-only health probes and 45Drives Alerts; disabled outside Atlas host vars.
atlas_manage_monitoring: false
atlas_monitor_calendar: "*:0/30"
atlas_monitor_notifier: "{{ atlas_usb_reminder_notifier }}"
atlas_monitor_smart_devices: []
atlas_monitor_timers: []
atlas_monitor_failure_units: []
atlas_monitor_effective_timers: >-
{{ atlas_monitor_timers
+ ([{'name': 'atlas-prometheus-pull.timer', 'max_age_hours': 26}]
if atlas_manage_prometheus_backup_pull | bool and atlas_prometheus_pull_start_timer | bool
else []) }}
atlas_monitor_effective_failure_units: >-
{{ atlas_monitor_failure_units
+ (['atlas-prometheus-pull.service']
if atlas_manage_prometheus_backup_pull | bool else [])
+ (['atlas-nextcloud-backup.service', 'atlas-nextcloud-backup-recovery.service']
if atlas_manage_nextcloud | bool else []) }}
atlas_monitor_remote_capacity: {}
atlas_monitor_pool_warning_percent: 80
atlas_monitor_pool_critical_percent: 90
atlas_monitor_root_warning_percent: 80
atlas_monitor_root_critical_percent: 90
atlas_monitor_snapshot_warning_percent: 10
atlas_monitor_snapshot_critical_percent: 20
atlas_monitor_snapshot_growth_warning_gib_day: 100
atlas_monitor_backup_growth_warning_gib_day: 100
atlas_monitor_cpu_warning_c: 85
atlas_monitor_cpu_critical_c: 95
atlas_monitor_borg_max_runtime_days: 14
# Explicit post-restore relabeling only; never relabel datasets during ordinary runs.
atlas_restorecon_paths: []
atlas_archive_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_archive }}"
atlas_services_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_services }}"
atlas_app_data_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_app_data }}"
atlas_navidrome_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_navidrome }}"
atlas_syncthing_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_syncthing }}"
atlas_media_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_media }}"
atlas_music_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_music }}"
atlas_backup_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_backup }}"
atlas_host_backups_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_host_backups }}"
atlas_backup_prometheus_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_backup_prometheus }}"
atlas_manage_prometheus_backup_pull: false
atlas_prometheus_pull_ssh_dir: /etc/atlas-prometheus-pull
atlas_prometheus_pull_private_key_path: "{{ atlas_prometheus_pull_ssh_dir }}/id_ed25519"
atlas_prometheus_pull_known_hosts_path: "{{ atlas_prometheus_pull_ssh_dir }}/known_hosts"
atlas_prometheus_ssh_host_key: ""
atlas_prometheus_pull_source_user: prometheus-backup
atlas_prometheus_pull_source_port: 22
atlas_prometheus_pull_calendar: "*-*-* 03:00:00 Europe/Rome"
atlas_prometheus_pull_start_timer: false
atlas_prometheus_pull_keep_daily: 30
atlas_prometheus_pull_keep_weekly: 8
atlas_prometheus_pull_keep_monthly: 12
atlas_prometheus_pull_max_age_hours: 24
atlas_photobook_mountpoint: "{{ atlas_mount_root }}/{{ atlas_zfs_dataset_photobook }}"
# Rootless Gitea runs in admin's user manager; the image maps internal gitea to UID/GID 1000.
atlas_manage_gitea: false
atlas_gitea_username: "{{ atlas_admin_username }}"
atlas_gitea_group: "{{ atlas_admin_group }}"
atlas_gitea_uid: "{{ atlas_admin_uid }}"
atlas_gitea_gid: "{{ atlas_admin_gid }}"
atlas_gitea_home: "{{ atlas_admin_home }}"
atlas_gitea_container_uid: 1000
atlas_gitea_container_gid: 1000
atlas_gitea_legacy_username: gitea
atlas_gitea_dataset: "{{ atlas_zfs_pool }}/services/data/gitea"
atlas_gitea_mountpoint: "{{ atlas_app_data_mountpoint }}/gitea"
atlas_gitea_quadlet_dir: "{{ atlas_gitea_home }}/.config/containers/systemd"
atlas_gitea_image: localhost/atlas-gitea:1.25.2-user-gitea-v1
atlas_gitea_image_build_dir: "{{ atlas_gitea_home }}/.local/share/atlas-gitea-image"
atlas_gitea_production_enabled: false
atlas_gitea_public_domain: ""
atlas_gitea_bind_address: "{{ ansible_host }}"
atlas_gitea_http_port: 3000
atlas_gitea_ssh_port: 2222
atlas_gitea_staging_bind_address: 127.0.0.1
atlas_gitea_staging_http_port: 3001
atlas_gitea_staging_ssh_port: 2223
# Declare storage and an inactive Quadlet only. The operator supplies the
# private configuration, handles MFA, and starts the user service manually.
atlas_icloudpd_dataset: "{{ atlas_zfs_pool }}/services/data/icloudpd"
atlas_icloudpd_state_dir: "{{ atlas_app_data_mountpoint }}/icloudpd"
atlas_icloudpd_config_dir: "{{ atlas_icloudpd_state_dir }}/config"
atlas_icloudpd_photos_dir: "{{ atlas_archive_mountpoint }}/Pictures/iCloudPD"
atlas_icloudpd_image: >-
docker.io/boredazfcuk/icloudpd@sha256:9966c31ddf0b5b306ac2410b4edd5d626806d96e80c92b83cbb689972dc9389f
atlas_icloudpd_quadlet_dir: "{{ atlas_admin_home }}/.config/containers/systemd"
atlas_icloudpd_timezone: Europe/Rome
atlas_45drives_repo_url: https://repo.45drives.com/repofiles/rocky/45drives-enterprise.repo
atlas_45drives_repo_file: /etc/yum.repos.d/45drives-enterprise.repo
atlas_45drives_packages:
- cockpit-file-sharing
- cockpit-navigator
- cockpit-identities
- cockpit-zfs
- cockpit-scheduler
atlas_nfs_exports:
- path: "{{ atlas_photobook_mountpoint }}"
client: "{{ atlas_aegis_ip }}"
options:
- rw
- sync
- no_subtree_check
- all_squash
- "anonuid={{ atlas_immich_uid }}"
- "anongid={{ atlas_immich_gid }}"
atlas_samba_share_name: Archive
atlas_samba_workgroup: WORKGROUP
# Keep encryption mandatory unless a verified client-compatibility exception is explicitly required.
atlas_samba_encryption: required
atlas_samba_valid_users: []
atlas_samba_accounts: []
atlas_samba_password_marker_dir: /var/lib/samba/private/ansible-passwords
atlas_firewalld_rich_rules: []
atlas_firewalld_restricted_services:
- ssh
- cockpit
- nfs
- samba
- http
- https
atlas_selinux_booleans:
- samba_export_all_rw
- nfs_export_all_rw
atlas_manage_media_stack: false
atlas_container_quadlet_dir: /etc/containers/systemd
atlas_container_data_root: /var/lib/atlas-containers
atlas_npm_data_dir: "{{ atlas_container_data_root }}/npm/data"
atlas_npm_letsencrypt_dir: "{{ atlas_container_data_root }}/npm/letsencrypt"
atlas_npm_admin_bind_address: 127.0.0.1
atlas_timezone: Europe/Rome
atlas_immich_upload_dir: "{{ atlas_container_data_root }}/immich/upload"
atlas_immich_model_cache_dir: "{{ atlas_container_data_root }}/immich/model-cache"
atlas_immich_machine_learning_config_dir: "{{ atlas_container_data_root }}/immich/machine-learning-config"
atlas_immich_machine_learning_cache_dir: "{{ atlas_container_data_root }}/immich/machine-learning-cache"
atlas_immich_redis_data_dir: "{{ atlas_container_data_root }}/immich/redis"
atlas_immich_postgres_data_dir: "{{ atlas_container_data_root }}/immich/postgres"
atlas_npm_image: docker.io/jc21/nginx-proxy-manager:latest
atlas_immich_version: release
atlas_immich_server_image: "ghcr.io/immich-app/immich-server:{{ atlas_immich_version }}"
atlas_immich_machine_learning_image: "ghcr.io/immich-app/immich-machine-learning:{{ atlas_immich_version }}-openvino"
atlas_immich_redis_image: docker.io/valkey/valkey:9
atlas_immich_postgres_image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
atlas_immich_db_username: postgres
atlas_immich_db_name: immich
atlas_immich_db_password: "{{ vault_atlas_immich_db_password | default('') }}"
atlas_media_quadlet_services:
- atlas-immich-redis.service
- atlas-immich-postgres.service
- atlas-immich-machine-learning.service
- atlas-immich-server.service
- atlas-npm.service
atlas_manage_qbittorrent: false
atlas_qbittorrent_image: CHANGEME_PINNED_QBITTORRENT_IMAGE
atlas_qbittorrent_state_dir: "{{ atlas_app_data_mountpoint }}/qbittorrent"
atlas_qbittorrent_downloads_dir: "{{ atlas_archive_mountpoint }}/Downloads"
atlas_qbittorrent_web_port: 8090
atlas_qbittorrent_reverse_proxy_enabled: false
atlas_qbittorrent_public_domain: CHANGEME_QBITTORRENT_DOMAIN
atlas_qbittorrent_web_settings:
- {key: 'WebUI\ServerDomains', value: "{{ atlas_qbittorrent_public_domain }}"}
- {key: 'WebUI\ReverseProxySupportEnabled', value: "true"}
- {key: 'WebUI\TrustedReverseProxiesList', value: "{{ atlas_aegis_ip }}"}
- {key: 'WebUI\HostHeaderValidation', value: "true"}
- {key: 'WebUI\CSRFProtection', value: "true"}
- {key: 'WebUI\LocalHostAuth', value: "true"}
- {key: 'WebUI\AuthSubnetWhitelistEnabled', value: "false"}
atlas_manage_aria2: false
atlas_aria2_gateway_enabled: false
atlas_aria2_gateway_port: 8092
atlas_aria2_public_domain: CHANGEME_ARIA2_DOMAIN
atlas_aria2_state_dir: "{{ atlas_app_data_mountpoint }}/aria2"
atlas_aria2_downloads_dir: "{{ atlas_archive_mountpoint }}/Downloads"
atlas_aria2_rpc_port: 6800
atlas_ariang_web_port: 8091
atlas_aria2_image: CHANGEME_PINNED_ARIA2_IMAGE
atlas_ariang_image: CHANGEME_PINNED_ARIANG_IMAGE
# Rootless Paperless-ngx document management. Secrets live only in the encrypted Vault.
atlas_manage_paperless: false
atlas_paperless_dataset: "{{ atlas_zfs_pool }}/services/data/paperless"
atlas_paperless_root: "{{ atlas_app_data_mountpoint }}/paperless"
atlas_paperless_private_dir: "{{ atlas_admin_home }}/.config/atlas-paperless"
atlas_paperless_quadlet_dir: "{{ atlas_admin_home }}/.config/containers/systemd"
atlas_paperless_domain: ""
atlas_paperless_http_port: 8002
atlas_paperless_network_subnet: 10.90.11.0/24
atlas_paperless_network_gateway: 10.90.11.1
atlas_paperless_ocr_language: ita+eng
atlas_paperless_image: ""
atlas_paperless_postgres_image: ""
atlas_paperless_valkey_image: ""
atlas_paperless_tika_image: ""
atlas_paperless_gotenberg_image: ""
atlas_paperless_ollama_image: ""
atlas_paperless_llm_model: qwen2.5:1.5b-instruct-q4_K_M
atlas_paperless_embedding_model: nomic-embed-text:v1.5
atlas_paperless_services:
- atlas-paperless-db.service
- atlas-paperless-valkey.service
- atlas-paperless-tika.service
- atlas-paperless-gotenberg.service
- atlas-paperless-ollama.service
- atlas-paperless.service

View File

@@ -1,10 +0,0 @@
FROM docker.gitea.com/gitea@sha256:f1943db2d2f1e447e857b3f0aee4ebb7b184500f86e5b80eae110fd435435906
# Preserve the official image's UID/GID, paths and entrypoint; change only the
# internal Unix identity. The host-side rootless owner is Atlas admin.
USER 0
RUN sed -i 's/^git:x:1000:1000:/gitea:x:1000:1000:/' /etc/passwd \
&& sed -i 's/^git:x:1000:/gitea:x:1000:/' /etc/group \
&& grep -q '^gitea:x:1000:1000:' /etc/passwd \
&& grep -q '^gitea:x:1000:' /etc/group
USER 1000:1000

View File

@@ -1,131 +0,0 @@
#!/usr/bin/python3
"""Private NPM-only JSON-RPC adapter. Never serves the secret to browsers."""
import argparse
import copy
import http.client
import json
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
import threading
MAX_BODY = 2 * 1024 * 1024
def inject(request, token, depth=0):
if depth > 4 or not isinstance(request, dict):
raise ValueError('Invalid RPC request')
result = copy.deepcopy(request)
method = result.get('method', result.get('methodName'))
params = result.setdefault('params', [])
if not isinstance(method, str) or not isinstance(params, list):
raise ValueError('Invalid RPC method or params')
if method == 'system.multicall':
if len(params) != 1 or not isinstance(params[0], list) or len(params[0]) > 128:
raise ValueError('Invalid multicall')
result['params'] = [[inject(item, token, depth + 1) for item in params[0]]]
elif method.startswith('aria2.'):
if params and isinstance(params[0], str) and params[0].startswith('token:'):
params.pop(0)
# Keep RPC security configuration owned by Ansible, not remote callers.
if method in ('aria2.changeGlobalOption', 'aria2.changeOption'):
for value in params:
if isinstance(value, dict) and any(key.startswith('rpc-') for key in value):
raise ValueError('RPC security options are not editable')
params.insert(0, 'token:' + token)
elif method not in ('system.listMethods', 'system.listNotifications'):
raise ValueError('Unsupported RPC method')
return result
def sanitize(value, token):
if isinstance(value, dict):
return {key: sanitize(item, token) for key, item in value.items()
if key not in ('rpc-secret', 'rpc-passwd', 'rpc-user')}
if isinstance(value, list):
return [sanitize(item, token) for item in value]
if isinstance(value, str):
return value.replace(token, '[redacted]')
return value
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--listen', required=True)
parser.add_argument('--port', type=int, required=True)
parser.add_argument('--upstream-port', type=int, required=True)
parser.add_argument('--peer', required=True)
parser.add_argument('--domain', required=True)
parser.add_argument('--secret-file', required=True)
args = parser.parse_args()
token = Path(args.secret_file).read_text().strip()
if len(token) != 64 or any(char not in '0123456789abcdef' for char in token):
raise ValueError('Invalid private RPC secret')
slots = threading.BoundedSemaphore(16)
class Handler(BaseHTTPRequestHandler):
def setup(self):
super().setup()
self.connection.settimeout(15)
def log_message(self, *_):
pass # No credentials, download URLs or request payloads in logs.
def reply(self, status, value):
body = json.dumps(value).encode()
self.send_response(status)
self.send_header('Content-Type', 'application/json')
self.send_header('Cache-Control', 'no-store')
self.send_header('Content-Length', str(len(body)))
self.end_headers()
self.wfile.write(body)
def do_POST(self):
if self.client_address[0] not in (args.peer, args.listen):
return self.reply(403, {'error': 'Forbidden'})
if self.path != '/jsonrpc' or self.headers.get('Host') not in (args.domain, args.domain + ':443'):
return self.reply(403, {'error': 'Forbidden'})
origin = self.headers.get('Origin')
if origin and origin != 'https://' + args.domain:
return self.reply(403, {'error': 'Forbidden origin'})
if self.headers.get('Transfer-Encoding') or self.headers.get('Content-Type', '').split(';')[0].strip() not in ('application/json', 'application/json-rpc'):
return self.reply(415, {'error': 'JSON POST required'})
if not slots.acquire(blocking=False):
return self.reply(503, {'error': 'Busy'})
connection = None
try:
length = int(self.headers.get('Content-Length', '0'))
if not 0 < length <= MAX_BODY:
return self.reply(413, {'error': 'Invalid request size'})
request = json.loads(self.rfile.read(length))
if isinstance(request, list):
if not 0 < len(request) <= 128:
raise ValueError('Invalid batch')
request = [inject(item, token) for item in request]
else:
request = inject(request, token)
body = json.dumps(request).encode()
if len(body) > MAX_BODY:
return self.reply(413, {'error': 'Request too large'})
connection = http.client.HTTPConnection(args.listen, args.upstream_port, timeout=30)
connection.request('POST', '/jsonrpc', body, {'Content-Type': 'application/json'})
response = connection.getresponse()
payload = response.read(MAX_BODY + 1)
if len(payload) > MAX_BODY:
return self.reply(502, {'error': 'Upstream response too large'})
self.reply(response.status, sanitize(json.loads(payload), token))
except (ValueError, TypeError, KeyError):
self.reply(400, {'error': 'Invalid RPC request'})
except (OSError, http.client.HTTPException):
self.reply(502, {'error': 'RPC upstream unavailable'})
finally:
if connection:
connection.close()
slots.release()
server = ThreadingHTTPServer((args.listen, args.port), Handler)
server.daemon_threads = True
server.serve_forever()
if __name__ == '__main__':
main()

View File

@@ -1,59 +0,0 @@
#!/usr/bin/env python3
"""Turn Borg's JSON progress stream into bounded, readable journal entries."""
import argparse
import json
import sys
import time
def size(value):
if not isinstance(value, (int, float)):
return "unknown"
return f"{value / (1024 ** 3):.2f} GiB"
parser = argparse.ArgumentParser()
parser.add_argument("--estimated-total-bytes", type=int, required=True)
args = parser.parse_args()
if args.estimated_total_bytes <= 0:
parser.error("estimated total must be positive")
last_progress = 0.0
for line in sys.stdin:
try:
event = json.loads(line)
except json.JSONDecodeError:
print(line.rstrip(), flush=True)
continue
kind = event.get("type")
if kind == "archive_progress":
now = time.monotonic()
if now - last_progress < 60 and not event.get("finished"):
continue
path = event.get("path") or ""
parts = path.split("/")
dataset = parts[1] if len(parts) > 1 and parts[0] == "source" else "unknown"
original_size = event.get("original_size")
if isinstance(original_size, (int, float)) and original_size >= 0:
percent = original_size / args.estimated_total_bytes * 100
estimated_progress = (
f"{percent:.1f}%" if percent < 100 else ">=100% (ZFS estimate exceeded)"
)
else:
estimated_progress = "unknown"
print(
"Borg create progress: "
f"estimated={estimated_progress} dataset={dataset} "
f"files={event.get('nfiles', 'unknown')} "
f"original={size(original_size)} "
f"compressed={size(event.get('compressed_size'))} "
f"deduplicated={size(event.get('deduplicated_size'))}",
flush=True,
)
last_progress = now
elif kind == "log_message":
print(f"Borg {event.get('levelname', 'INFO')}: {event.get('message', '')}", flush=True)
elif kind == "progress_message" and event.get("message"):
print(f"Borg: {event['message']}", flush=True)

View File

@@ -1,396 +0,0 @@
#!/usr/bin/python3
"""Read-only Atlas health probes with deduplicated 45Drives Alerts."""
import argparse
import fcntl
import json
import os
import re
import subprocess
import sys
import tempfile
import time
from datetime import datetime, timezone
from pathlib import Path
CONFIG_PATH = Path("/etc/atlas-health-monitor.json")
STATE_DIR = Path("/var/lib/atlas-health-monitor")
STATE_PATH = STATE_DIR / "state.json"
GIB = 1024**3
def run(*argv, timeout=40):
return subprocess.run(argv, capture_output=True, text=True, timeout=timeout, check=False)
def issue(issues, key, severity, message):
issues[key] = {"severity": severity, "message": message}
def notify(config, event, severity, subject, message):
now = datetime.now(timezone.utc)
payload = {
"timestamp": now.isoformat(timespec="seconds"),
"unixtime": int(now.timestamp()),
"event": event,
"severity": severity,
"subject": subject,
"email_message": message,
}
result = run(config["notifier"], json.dumps(payload, ensure_ascii=False), timeout=30)
if result.returncode:
raise RuntimeError(f"45Drives notifier exited {result.returncode}: {result.stderr.strip()}")
def parse_fields(text):
return dict(line.split("=", 1) for line in text.splitlines() if "=" in line)
def systemd_fields(unit, *properties):
result = run("systemctl", "show", unit, *(f"-p{item}" for item in properties))
if result.returncode:
raise RuntimeError(f"systemctl show {unit} exited {result.returncode}")
return parse_fields(result.stdout)
def unix_time(text):
if not text or text == "n/a":
return None
result = run("date", "-d", text, "+%s")
if result.returncode:
raise ValueError(f"Cannot parse systemd timestamp: {text}")
return int(result.stdout.strip())
def check_pool(config, issues, measurements):
pool = config["pool"]
listing = run("zpool", "list", "-H", "-p", "-o", "size,alloc,capacity,health", pool)
if listing.returncode:
issue(issues, "pool.probe", "critical", f"Cannot query ZFS pool {pool}")
return
try:
size, alloc, capacity, health = listing.stdout.strip().split("\t")
size, alloc, capacity = int(size), int(alloc), int(capacity)
except (ValueError, TypeError):
issue(issues, "pool.probe", "critical", "Invalid ZFS pool capacity response")
return
measurements.update(pool_size_bytes=size, pool_alloc_bytes=alloc, pool_capacity_percent=capacity)
if health != "ONLINE":
issue(issues, "pool.health", "critical", f"ZFS pool {pool} state is {health}")
if capacity >= config["pool_critical_percent"]:
issue(issues, "pool.capacity", "critical", f"ZFS pool {pool} is {capacity}% full")
elif capacity >= config["pool_warning_percent"]:
issue(issues, "pool.capacity", "warning", f"ZFS pool {pool} is {capacity}% full")
status = run("zpool", "status", "-P", pool)
if status.returncode:
issue(issues, "pool.status", "critical", f"Cannot query detailed ZFS status for {pool}")
return
bad_vdevs = []
for line in status.stdout.splitlines():
match = re.match(r"^\s*(\S+)\s+(ONLINE|DEGRADED|FAULTED|OFFLINE|UNAVAIL|REMOVED)\s+(\d+)\s+(\d+)\s+(\d+)", line)
if match:
name, state, reads, writes, checksums = match.groups()
if state != "ONLINE" or any(int(value) for value in (reads, writes, checksums)):
bad_vdevs.append(f"{name}: {state}, READ={reads}, WRITE={writes}, CKSUM={checksums}")
if bad_vdevs:
issue(issues, "pool.vdevs", "critical", "ZFS vdev errors: " + "; ".join(bad_vdevs))
errors = re.search(r"^errors:\s*(.*)$", status.stdout, re.MULTILINE)
if not errors or errors.group(1).strip() != "No known data errors":
issue(issues, "pool.data_errors", "critical", "ZFS status reports data errors; inspect zpool status -v")
if re.search(r"^\s*scan:\s*resilver in progress", status.stdout, re.MULTILINE | re.IGNORECASE):
issue(issues, "pool.resilver", "warning", "ZFS resilver is in progress; inspect zpool status")
scan = re.search(r"^\s*scan:\s*(.*)$", status.stdout, re.MULTILINE)
if scan and re.search(r"\bwith [1-9][0-9]* errors\b", scan.group(1)):
issue(issues, "pool.scan_errors", "critical", f"ZFS scan reported errors: {scan.group(1)}")
def check_capacity(config, issues, measurements):
pool = config["pool"]
listing = run("zfs", "list", "-H", "-p", "-o", "name,usedbysnapshots", "-r", pool)
if listing.returncode:
issue(issues, "snapshot.probe", "warning", "Cannot query ZFS snapshot space")
else:
try:
snapshots = sum(int(line.split("\t")[1]) for line in listing.stdout.splitlines())
measurements["snapshots_bytes"] = snapshots
size = measurements.get("pool_size_bytes")
if size:
percent = snapshots * 100 // size
measurements["snapshots_percent"] = percent
if percent >= config["snapshot_critical_percent"]:
issue(issues, "snapshot.capacity", "critical", f"Snapshots use {percent}% of pool size")
elif percent >= config["snapshot_warning_percent"]:
issue(issues, "snapshot.capacity", "warning", f"Snapshots use {percent}% of pool size")
except (ValueError, IndexError):
issue(issues, "snapshot.probe", "warning", "Invalid ZFS snapshot-space response")
backup = run("zfs", "list", "-H", "-p", "-o", "used", config["backup_dataset"])
if backup.returncode:
issue(issues, "backup.capacity_probe", "warning", "Cannot query local backup dataset space")
else:
try:
measurements["backup_bytes"] = int(backup.stdout.strip())
except ValueError:
issue(issues, "backup.capacity_probe", "warning", "Invalid local backup space response")
try:
filesystem = os.statvfs("/")
total = filesystem.f_blocks * filesystem.f_frsize
available = filesystem.f_bavail * filesystem.f_frsize
used_percent = (total - available) * 100 // total
measurements["root_capacity_percent"] = used_percent
if used_percent >= config["root_critical_percent"]:
issue(issues, "root.capacity", "critical", f"Atlas system filesystem is {used_percent}% full")
elif used_percent >= config["root_warning_percent"]:
issue(issues, "root.capacity", "warning", f"Atlas system filesystem is {used_percent}% full")
except (OSError, ZeroDivisionError):
issue(issues, "root.capacity_probe", "warning", "Cannot query Atlas system filesystem space")
def check_remote_capacity(config, issues, measurements):
"""Query only the Storage Box quota; do not open or inspect the Borg repository."""
remote = config["remote_capacity"]
try:
result = run("runuser", "-u", remote["run_as"], "--", remote["ssh_wrapper"],
f"{remote['user']}@{remote['host']}", "df", "-m", timeout=65)
if result.returncode:
raise ValueError(f"SSH df exited {result.returncode}")
lines = result.stdout.strip().splitlines()
if len(lines) != 2:
raise ValueError("Unexpected Storage Box df output")
fields = lines[1].split()
if len(fields) < 5:
raise ValueError("Incomplete Storage Box df output")
total_mib, used_mib, available_mib = (int(value) for value in fields[1:4])
percent = int(fields[4].rstrip("%"))
if total_mib <= 0 or not 0 <= percent <= 100 or available_mib < 0:
raise ValueError("Invalid Storage Box quota values")
except (OSError, ValueError, subprocess.TimeoutExpired):
issue(issues, "remote.capacity_probe", "warning", "Cannot query Hetzner Storage Box quota via pinned-key SSH")
return
measurements.update(remote_capacity_percent=percent, remote_bytes=used_mib * 1024**2,
remote_available_bytes=available_mib * 1024**2)
if percent >= remote["critical_percent"]:
issue(issues, "remote.capacity", "critical", f"Hetzner Storage Box quota is {percent}% full")
elif percent >= remote["warning_percent"]:
issue(issues, "remote.capacity", "warning", f"Hetzner Storage Box quota is {percent}% full")
def check_smart(config, issues, measurements):
for device in config["smart_devices"]:
name, path = device["name"], device["path"]
try:
result = run("smartctl", "-j", "-a", path, timeout=60)
data = json.loads(result.stdout)
status = int(data.get("smartctl", {}).get("exit_status", result.returncode))
except (subprocess.TimeoutExpired, json.JSONDecodeError, ValueError) as exc:
issue(issues, f"smart.{name}.probe", "critical", f"SMART probe failed for {name}: {type(exc).__name__}")
continue
if status:
severity = "critical" if status & 0b00001111 else "warning"
issue(issues, f"smart.{name}.status", severity, f"SMART reported exit status {status} for {name}")
passed = data.get("smart_status", {}).get("passed")
if passed is False:
issue(issues, f"smart.{name}.health", "critical", f"SMART self-assessment failed for {name}")
elif passed is None:
issue(issues, f"smart.{name}.health", "warning", f"SMART self-assessment unavailable for {name}")
temperature = data.get("temperature", {}).get("current")
if isinstance(temperature, (int, float)):
measurements[f"smart_{name}_c"] = temperature
if temperature >= device["critical_c"]:
issue(issues, f"smart.{name}.temperature", "critical", f"{name} temperature is {temperature} C")
elif temperature >= device["warning_c"]:
issue(issues, f"smart.{name}.temperature", "warning", f"{name} temperature is {temperature} C")
else:
issue(issues, f"smart.{name}.temperature", "warning", f"Temperature unavailable for {name}")
for attribute in data.get("ata_smart_attributes", {}).get("table", []):
attribute_id = attribute.get("id")
if attribute_id in (5, 187, 197, 198):
raw = attribute.get("raw", {}).get("value", 0)
if isinstance(raw, int) and raw > 0:
severity = "critical" if attribute_id in (197, 198) else "warning"
issue(issues, f"smart.{name}.ata_{attribute_id}", severity,
f"{name} SMART attribute {attribute_id} raw count is {raw}")
nvme = data.get("nvme_smart_health_information_log", {})
if isinstance(nvme, dict):
if int(nvme.get("critical_warning", 0)):
issue(issues, f"smart.{name}.nvme_warning", "critical", f"{name} NVMe critical warning is nonzero")
if int(nvme.get("media_errors", 0)):
issue(issues, f"smart.{name}.nvme_media", "critical", f"{name} NVMe media errors are nonzero")
def check_cpu(config, issues, measurements):
sensors = []
for hwmon in Path("/sys/class/hwmon").glob("hwmon*"):
try:
if (hwmon / "name").read_text().strip() != "coretemp":
continue
sensors.extend(int(path.read_text().strip()) / 1000 for path in hwmon.glob("temp*_input"))
except (OSError, ValueError):
continue
if not sensors:
issue(issues, "cpu.temperature_probe", "warning", "CPU temperature sensors are unavailable")
return
hottest = max(sensors)
measurements["cpu_max_c"] = hottest
if hottest >= config["cpu_critical_c"]:
issue(issues, "cpu.temperature", "critical", f"CPU temperature is {hottest:g} C")
elif hottest >= config["cpu_warning_c"]:
issue(issues, "cpu.temperature", "warning", f"CPU temperature is {hottest:g} C")
def check_jobs(config, issues, measurements, now):
for timer in config["timers"]:
name = timer["name"]
try:
fields = systemd_fields(name, "ActiveState", "UnitFileState", "LastTriggerUSec", "ActiveEnterTimestamp")
if fields.get("ActiveState") != "active" or fields.get("UnitFileState") != "enabled":
issue(issues, f"timer.{name}", "critical", f"Timer {name} is not active and enabled")
max_age = int(timer["max_age_hours"]) * 3600
if max_age:
last = unix_time(fields.get("LastTriggerUSec"))
if last is None:
last = unix_time(fields.get("ActiveEnterTimestamp"))
if last is not None and now - last > max_age:
issue(issues, f"timer.{name}.stale", "warning",
f"Timer {name} has not fired in {int((now-last)/3600)} hours")
except (RuntimeError, ValueError, subprocess.TimeoutExpired):
issue(issues, f"timer.{name}.probe", "warning", f"Cannot query timer {name}")
for unit in config["failure_units"]:
if unit.endswith("@.service"):
continue
try:
fields = systemd_fields(unit, "ActiveState", "Result", "ExecMainStartTimestamp")
state = fields.get("ActiveState")
if state == "failed" or (state == "inactive" and fields.get("Result") not in (None, "", "success")):
issue(issues, f"service.{unit}", "critical", f"Service {unit} failed: {fields.get('Result')}")
if unit == "atlas-borg-backup.service" and fields.get("ActiveState") == "activating":
started = unix_time(fields.get("ExecMainStartTimestamp"))
if started is not None and now - started > config["borg_max_runtime_days"] * 86400:
issue(issues, "backup.borg_long_running", "warning",
"Borg has run longer than its configured limit")
except (RuntimeError, ValueError, subprocess.TimeoutExpired):
issue(issues, f"service.{unit}.probe", "warning", f"Cannot query service {unit}")
def check_growth(config, issues, measurements, samples, now):
previous = [sample for sample in samples if 20 * 3600 <= now - sample.get("time", now) <= 48 * 3600]
if previous:
baseline = min(previous, key=lambda sample: abs(now - sample["time"] - 86400))
days = (now - baseline["time"]) / 86400
for name, threshold in (("snapshots", config["snapshot_growth_warning_gib_day"]),
("backup", config["backup_growth_warning_gib_day"]),
("remote", config["remote_capacity"]["growth_warning_gib_day"])):
current, old = measurements.get(f"{name}_bytes"), baseline.get(f"{name}_bytes")
if isinstance(current, int) and isinstance(old, int) and days > 0:
growth_gib_day = (current - old) / GIB / days
measurements[f"{name}_growth_gib_day"] = round(growth_gib_day, 1)
if growth_gib_day >= threshold:
issue(issues, f"{name}.growth", "warning",
f"Local {name} usage grew {growth_gib_day:.1f} GiB/day over {days:.1f} days")
def allowed_failure_unit(config, unit):
for allowed in config["failure_units"]:
if allowed == unit:
return True
if allowed.endswith("@.service") and unit.startswith(allowed[:-9] + "@") and unit.endswith(".service"):
return True
return False
def load_state():
if not STATE_PATH.exists():
return {"active": {}, "samples": []}
with STATE_PATH.open(encoding="utf-8") as stream:
state = json.load(stream)
if not isinstance(state.get("active"), dict) or not isinstance(state.get("samples"), list):
raise ValueError("Invalid Atlas monitor state; refusing to overwrite it")
return state
def save_state(state):
with tempfile.NamedTemporaryFile("w", dir=STATE_DIR, prefix=".state-", delete=False,
encoding="utf-8") as stream:
path = Path(stream.name)
os.chmod(path, 0o600)
json.dump(state, stream, sort_keys=True)
stream.write("\n")
stream.flush()
os.fsync(stream.fileno())
os.replace(path, STATE_PATH)
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--dry-run", action="store_true", help="probe without notifications or state changes")
parser.add_argument("--test-notification", action="store_true", help="submit a labelled test alert")
parser.add_argument("--job-failed", metavar="UNIT", help="notify about a failed configured service")
args = parser.parse_args()
with CONFIG_PATH.open(encoding="utf-8") as stream:
config = json.load(stream)
if args.test_notification:
notify(config, "atlas_monitor_test", "warning", "Test monitoraggio Atlas",
"Notifica di prova: il monitoraggio Atlas raggiunge 45Drives Alerts. Non conferma l'invio email.")
print("Atlas monitor test submitted to 45Drives Alerts; email delivery is not verified.")
return 0
if args.job_failed:
if not allowed_failure_unit(config, args.job_failed):
raise ValueError("Unconfigured Atlas failure unit")
notify(config, "atlas_job_failed", "critical", f"Job Atlas fallito: {args.job_failed}",
f"Il servizio {args.job_failed} e' fallito. Controlla: "
f"sudo journalctl -u {args.job_failed} -n 100 --no-pager")
print(f"Atlas job failure submitted to 45Drives Alerts: {args.job_failed}")
return 0
now = int(time.time())
issues, measurements = {}, {}
check_pool(config, issues, measurements)
check_capacity(config, issues, measurements)
check_remote_capacity(config, issues, measurements)
check_smart(config, issues, measurements)
check_cpu(config, issues, measurements)
check_jobs(config, issues, measurements, now)
if args.dry_run:
print(json.dumps({"issues": issues, "measurements": measurements}, sort_keys=True))
return 0
STATE_DIR.mkdir(mode=0o700, exist_ok=True)
with (STATE_DIR / "monitor.lock").open("w") as lock:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
state = load_state()
check_growth(config, issues, measurements, state["samples"], now)
active, failed_notifications = state["active"], []
for key, details in issues.items():
old = active.get(key)
if old is None or old.get("severity") != details["severity"]:
try:
notify(config, "atlas_health_issue", details["severity"],
f"Atlas: {key}", details["message"])
active[key] = details
print(f"ALERT {details['severity']} {key}: {details['message']}", flush=True)
except (RuntimeError, subprocess.TimeoutExpired) as exc:
failed_notifications.append(key)
print(f"NOTIFICATION FAILED {key}: {exc}", file=sys.stderr, flush=True)
for key in set(active) - set(issues):
print(f"RECOVERED {key}", flush=True)
del active[key]
state["samples"] = [sample for sample in state["samples"] if now - sample.get("time", 0) < 48 * 3600]
state["samples"].append({"time": now, **{key: value for key, value in measurements.items()
if key in ("snapshots_bytes", "backup_bytes", "remote_bytes")}})
save_state(state)
print(f"Atlas health: issues={len(issues)} notifications_failed={len(failed_notifications)} "
f"pool={measurements.get('pool_capacity_percent', 'unknown')}% "
f"remote={measurements.get('remote_capacity_percent', 'unknown')}% "
f"snapshots={measurements.get('snapshots_bytes', 'unknown')} bytes "
f"backup={measurements.get('backup_bytes', 'unknown')} bytes", flush=True)
return 1 if failed_notifications else 0
if __name__ == "__main__":
try:
sys.exit(main())
except (OSError, RuntimeError, ValueError, subprocess.TimeoutExpired) as error:
print(f"Atlas health monitor failed: {error}", file=sys.stderr)
sys.exit(1)

View File

@@ -1,56 +0,0 @@
#!/usr/bin/env python3
"""Prune only verified, named Prometheus backup versions after publication."""
import datetime as dt
import pathlib
import re
import shutil
import sys
def main() -> None:
if len(sys.argv) != 5:
raise SystemExit("Usage: atlas-prometheus-prune SNAPSHOTS DAILY WEEKLY MONTHLY")
root = pathlib.Path(sys.argv[1])
counts = [int(value) for value in sys.argv[2:]]
if not root.is_dir() or root.is_symlink() or min(counts) < 1:
raise SystemExit("Invalid backup directory or retention counts")
versions = []
for entry in root.iterdir():
if not entry.is_dir() or entry.is_symlink():
continue
if not re.fullmatch(r"[0-9]{8}T[0-9]{6}Z", entry.name):
continue
try:
when = dt.datetime.strptime(entry.name, "%Y%m%dT%H%M%SZ")
except ValueError:
continue
if not all((entry / name).is_file() for name in ("payload.tar", "payload.sha256", "metadata.json")):
continue
versions.append((when, entry))
versions.sort(reverse=True)
if not versions:
raise SystemExit("No published backup versions found; refusing to prune")
keep = {entry for _, entry in versions[: counts[0]]}
for count, key in (
(counts[1], lambda when: when.isocalendar()[:2]),
(counts[2], lambda when: (when.year, when.month)),
):
periods = set()
for when, entry in versions:
period = key(when)
if period in periods:
continue
periods.add(period)
keep.add(entry)
if len(periods) >= count:
break
for _, entry in versions:
if entry not in keep:
shutil.rmtree(entry)
if __name__ == "__main__":
main()

View File

@@ -1,63 +0,0 @@
---
- name: Reload Atlas admin user manager
become_user: "{{ atlas_admin_username }}"
ansible.builtin.systemd:
scope: user
daemon_reload: true
environment:
XDG_RUNTIME_DIR: "/run/user/{{ atlas_admin_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ atlas_admin_uid }}/bus"
when: not ansible_check_mode
- name: Reload SSH service
ansible.builtin.systemd:
name: sshd
state: reloaded
- name: Reload NFS exports
ansible.builtin.command:
argv:
- exportfs
- -ra
changed_when: true
when: not ansible_check_mode
- name: Restart NFS server
ansible.builtin.systemd:
name: nfs-server
state: restarted
- name: Restart NFS mount daemon
ansible.builtin.systemd:
name: nfs-mountd
state: restarted
daemon_reload: true
- name: Restart Samba service
ansible.builtin.systemd:
name: smb
state: restarted
- name: Restart Atlas Borg timers
ansible.builtin.systemd:
name: "{{ item }}"
state: restarted
daemon_reload: true
loop:
- atlas-borg-backup.timer
- atlas-borg-check.timer
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Restart Atlas media Quadlets
ansible.builtin.systemd:
name: "{{ item }}"
state: restarted
daemon_reload: true
loop: "{{ atlas_media_quadlet_services }}"
loop_control:
label: "{{ item }}"
when:
- atlas_manage_media_stack | bool
- not ansible_check_mode

View File

@@ -1,180 +0,0 @@
---
- name: Reject incomplete Atlas account configuration
tags: [atlas, services]
ansible.builtin.assert:
that:
- atlas_admin_username != 'CHANGEME_ATLAS_ADMIN'
- (atlas_admin_ssh_keys | default([])) | length > 0
- atlas_admin_password_hash not in ['', '!', '*']
- atlas_ssh_allow_tcp_forwarding in ['no', 'yes', 'local', 'remote', 'all']
- "'wheel' not in atlas_immich_supplementary_groups"
fail_msg: >-
Define atlas_admin_username, atlas_admin_ssh_keys and vault_atlas_admin_password_hash
before applying the Atlas profile.
no_log: true
- name: Create Atlas administrator group
tags: [atlas, services]
ansible.builtin.group:
name: "{{ atlas_admin_group }}"
gid: "{{ atlas_admin_gid }}"
state: present
- name: Create Atlas administrator account
tags: [atlas, services]
ansible.builtin.user:
name: "{{ atlas_admin_username }}"
uid: "{{ atlas_admin_uid }}"
group: "{{ atlas_admin_group }}"
home: "{{ atlas_admin_home }}"
shell: /bin/bash
password: "{{ atlas_admin_password_hash }}"
create_home: true
state: present
no_log: true
- name: Create Immich primary group
tags: [atlas, accounts, containers, immich]
ansible.builtin.group:
name: "{{ atlas_immich_group }}"
gid: "{{ atlas_immich_gid }}"
state: present
- name: Ensure Immich hardware-access groups exist
tags: [atlas, accounts, containers, immich]
ansible.builtin.group:
name: "{{ item }}"
state: present
loop: "{{ atlas_immich_supplementary_groups }}"
loop_control:
label: "{{ item }}"
- name: Create unprivileged Immich account
tags: [atlas, accounts, containers, immich]
ansible.builtin.user:
name: "{{ atlas_immich_username }}"
uid: "{{ atlas_immich_uid }}"
group: "{{ atlas_immich_group }}"
groups: "{{ atlas_immich_supplementary_groups }}"
append: false
home: /nonexistent
create_home: false
shell: /sbin/nologin
system: true
state: present
- name: Read Immich hardware-access group IDs
tags: [atlas, accounts, containers, immich]
ansible.builtin.getent:
database: group
- name: Grant Atlas administrator passwordless sudo
tags: [atlas, services]
ansible.builtin.copy:
content: "{{ atlas_admin_username }} ALL=(ALL) NOPASSWD: ALL\n"
dest: "/etc/sudoers.d/{{ atlas_admin_username }}"
owner: root
group: root
mode: "0440"
validate: "visudo -cf %s"
- name: Ensure Atlas administrator SSH authorized key fragments directory exists
tags: [atlas, services]
ansible.builtin.file:
path: "{{ atlas_admin_ssh_key_directory }}"
state: directory
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0700"
- name: Manage Atlas administrator SSH authorized key fragments
tags: [atlas, services]
ansible.builtin.copy:
content: "{{ item.key }}\n"
dest: "{{ atlas_admin_ssh_key_directory }}/{{ item.name }}"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0600"
loop: "{{ atlas_admin_ssh_keys }}"
loop_control:
label: "{{ item.name }}"
- name: Check whether the Atlas SSH host key exists
tags: [atlas, services]
ansible.builtin.stat:
path: /etc/ssh/ssh_host_ed25519_key
register: atlas_ssh_host_ed25519_key
- name: Generate missing Atlas SSH host keys
tags: [atlas, services]
ansible.builtin.command:
argv:
- ssh-keygen
- -A
changed_when: true
when: not atlas_ssh_host_ed25519_key.stat.exists
- name: Ensure Atlas SSH configuration drop-in directory exists
tags: [atlas, services]
ansible.builtin.file:
path: /etc/ssh/sshd_config.d
state: directory
owner: root
group: root
mode: "0755"
- name: Ensure Atlas SSH drop-ins are loaded before other settings
tags: [atlas, services]
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: '^\s*Include\s+/etc/ssh/sshd_config\.d/\*\.conf\s*$'
line: Include /etc/ssh/sshd_config.d/*.conf
insertbefore: BOF
state: present
validate: "sshd -t -f %s"
- name: Render Atlas SSH hardening drop-in
tags: [atlas, services]
ansible.builtin.template:
src: 00-atlas-hardening.conf.j2
dest: /etc/ssh/sshd_config.d/00-atlas-hardening.conf
owner: root
group: root
mode: "0600"
notify: Reload SSH service
- name: Read effective Atlas SSH daemon configuration
tags: [atlas, services]
ansible.builtin.command:
argv:
- sshd
- -T
- -C
- "user={{ atlas_admin_username }},host=atlas,addr=127.0.0.1"
register: atlas_sshd_effective_configuration
changed_when: false
when: not ansible_check_mode
- name: Verify effective Atlas SSH hardening
tags: [atlas, services]
ansible.builtin.assert:
that:
- "'permitrootlogin no' in atlas_sshd_effective_configuration.stdout_lines"
- "'pubkeyauthentication yes' in atlas_sshd_effective_configuration.stdout_lines"
- "'passwordauthentication no' in atlas_sshd_effective_configuration.stdout_lines"
- "'kbdinteractiveauthentication no' in atlas_sshd_effective_configuration.stdout_lines"
- "'authenticationmethods publickey' in atlas_sshd_effective_configuration.stdout_lines"
- "'x11forwarding no' in atlas_sshd_effective_configuration.stdout_lines"
- "('allowtcpforwarding ' ~ atlas_ssh_allow_tcp_forwarding) in atlas_sshd_effective_configuration.stdout_lines"
- "'allowagentforwarding no' in atlas_sshd_effective_configuration.stdout_lines"
- "'gatewayports no' in atlas_sshd_effective_configuration.stdout_lines"
- "'permittunnel no' in atlas_sshd_effective_configuration.stdout_lines"
- "'permituserenvironment no' in atlas_sshd_effective_configuration.stdout_lines"
- "'maxauthtries 3' in atlas_sshd_effective_configuration.stdout_lines"
- "'logingracetime 30' in atlas_sshd_effective_configuration.stdout_lines"
- "'clientaliveinterval 300' in atlas_sshd_effective_configuration.stdout_lines"
- "'clientalivecountmax 2' in atlas_sshd_effective_configuration.stdout_lines"
- "'loglevel VERBOSE' in atlas_sshd_effective_configuration.stdout_lines"
- "('allowusers ' ~ atlas_admin_username) in atlas_sshd_effective_configuration.stdout_lines"
fail_msg: The effective Atlas SSH configuration does not match the required hardening.
when: not ansible_check_mode

View File

@@ -1,205 +0,0 @@
---
- name: Manage Atlas LAN HTTP downloader
tags: [atlas, aria2]
when: atlas_manage_aria2 | bool
block:
- name: Require isolated state, shared Downloads and pinned images
ansible.builtin.assert:
that:
- atlas_manage_storage | bool
- atlas_aria2_state_dir == atlas_app_data_mountpoint ~ '/aria2'
- atlas_aria2_downloads_dir == atlas_archive_mountpoint ~ '/Downloads'
- atlas_aria2_image is search('@sha256:[0-9a-f]{64}$')
- atlas_ariang_image is search('@sha256:[0-9a-f]{64}$')
- atlas_aria2_rpc_port != atlas_ariang_web_port
- name: Inspect the existing downloader parent datasets
community.general.zfs_facts:
name: "{{ item.dataset }}"
properties: name,mounted,mountpoint
loop:
- dataset: "{{ atlas_zfs_pool }}/{{ atlas_zfs_dataset_archive }}"
mountpoint: "{{ atlas_archive_mountpoint }}"
- dataset: "{{ atlas_zfs_pool }}/{{ atlas_zfs_dataset_app_data }}"
mountpoint: "{{ atlas_app_data_mountpoint }}"
register: atlas_aria2_parents
- name: Require mounted downloader parent datasets
ansible.builtin.assert:
that:
- item.ansible_facts.ansible_zfs_datasets | length == 1
- item.ansible_facts.ansible_zfs_datasets[0].mounted == 'yes'
- item.ansible_facts.ansible_zfs_datasets[0].mountpoint == item.item.mountpoint
loop: "{{ atlas_aria2_parents.results }}"
loop_control:
label: "{{ item.item.dataset }}"
- name: Inspect shared Downloads without following links
ansible.builtin.stat:
path: "{{ atlas_aria2_downloads_dir }}"
follow: false
register: atlas_aria2_downloads
- name: Refuse unrelated or symlinked Downloads
ansible.builtin.assert:
that:
- >-
not atlas_aria2_downloads.stat.exists or
(atlas_aria2_downloads.stat.isdir | default(false) and
atlas_aria2_downloads.stat.uid | int == atlas_admin_uid | int)
- name: Create the private aria2 dataset
community.general.zfs:
name: "{{ atlas_zfs_pool }}/services/data/aria2"
state: present
extra_zfs_properties:
compression: zstd
mountpoint: "{{ atlas_aria2_state_dir }}"
- name: Prepare state, downloads and Quadlet directories
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "{{ item.mode }}"
loop:
- {path: "{{ atlas_aria2_state_dir }}", mode: "0700"}
- {path: "{{ atlas_aria2_downloads_dir }}", mode: "0770"}
- {path: "{{ atlas_admin_home }}/.config/containers/systemd", mode: "0700"}
- name: Generate a private persistent RPC secret on Atlas only
become_user: "{{ atlas_admin_username }}"
ansible.builtin.command:
argv:
- python3
- -c
- >-
import os, secrets;
fd = os.open('{{ atlas_aria2_state_dir }}/rpc-secret',
os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600);
os.write(fd, (secrets.token_hex(32) + '\n').encode()); os.close(fd)
creates: "{{ atlas_aria2_state_dir }}/rpc-secret"
no_log: true
- name: Read the existing private RPC secret without displaying it
ansible.builtin.slurp:
src: "{{ atlas_aria2_state_dir }}/rpc-secret"
register: atlas_aria2_rpc_secret
no_log: true
when: not ansible_check_mode
- name: Require a strong RPC secret
ansible.builtin.assert:
that:
- atlas_aria2_rpc_secret.content | b64decode | trim is match('^[a-f0-9]{64}$')
no_log: true
when: not ansible_check_mode
- name: Initialize the session file without replacing saved downloads
ansible.builtin.copy:
content: ""
dest: "{{ atlas_aria2_state_dir }}/session"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0600"
force: false
diff: false
no_log: true
- name: Render private aria2 configuration
ansible.builtin.template:
src: atlas-aria2.conf.j2
dest: "{{ atlas_aria2_state_dir }}/aria2.conf"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0600"
register: atlas_aria2_config
no_log: true
diff: false
when: not ansible_check_mode
- name: Allow only the LAN to reach AriaNg and the token-protected API
ansible.posix.firewalld:
zone: "{{ atlas_firewalld_zone }}"
rich_rule: >-
rule family="ipv4" source address="{{ atlas_lan_subnet }}"
port port="{{ item }}" protocol="tcp" accept
permanent: true
immediate: true
state: enabled
loop:
- "{{ atlas_aria2_rpc_port }}"
- "{{ atlas_ariang_web_port }}"
- name: Keep the downloader user manager available at boot
ansible.builtin.command: "loginctl enable-linger {{ atlas_admin_username }}"
args:
creates: "/var/lib/systemd/linger/{{ atlas_admin_username }}"
- name: Render the downloader and static Web UI Quadlets
ansible.builtin.template:
src: "atlas-{{ item }}.container.j2"
dest: "{{ atlas_admin_home }}/.config/containers/systemd/atlas-{{ item }}.container"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0644"
loop: [aria2, ariang]
register: atlas_aria2_quadlets
- name: Reload the user manager after downloader Quadlet changes
become_user: "{{ atlas_admin_username }}"
ansible.builtin.systemd:
scope: user
daemon_reload: true
environment:
XDG_RUNTIME_DIR: "/run/user/{{ atlas_admin_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ atlas_admin_uid }}/bus"
when:
- atlas_aria2_quadlets.changed
- not ansible_check_mode
- name: Start or update only the changed downloader service
become_user: "{{ atlas_admin_username }}"
ansible.builtin.systemd:
scope: user
name: "atlas-{{ item.item }}.service"
state: >-
{{ 'restarted' if item.changed or
(item.item == 'aria2' and atlas_aria2_config.changed | default(false))
else 'started' }}
loop: "{{ atlas_aria2_quadlets.results }}"
loop_control:
label: "atlas-{{ item.item }}.service"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ atlas_admin_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ atlas_admin_uid }}/bus"
when: not ansible_check_mode
- name: Verify the LAN Web UI responds
ansible.builtin.uri:
url: "http://{{ ansible_host }}:{{ atlas_ariang_web_port }}/"
status_code: 200
register: atlas_ariang_http
retries: 15
delay: 2
until: atlas_ariang_http is succeeded
when: not ansible_check_mode
- name: Verify the authenticated RPC API
ansible.builtin.uri:
url: "http://{{ ansible_host }}:{{ atlas_aria2_rpc_port }}/jsonrpc"
method: POST
body_format: json
body:
jsonrpc: "2.0"
id: ansible
method: aria2.getVersion
params: ["token:{{ atlas_aria2_rpc_secret.content | b64decode | trim }}"]
return_content: true
register: atlas_aria2_rpc_probe
retries: 15
delay: 2
until: (atlas_aria2_rpc_probe.content | default('{}') | from_json).result.version is defined
no_log: true
when: not ansible_check_mode

View File

@@ -1,81 +0,0 @@
---
- name: Manage the private NPM aria2 adapter
tags: [atlas, aria2_gateway]
when:
- atlas_manage_aria2 | bool
- atlas_aria2_gateway_enabled | bool
block:
- name: Require a dedicated gateway and explicit public domain
ansible.builtin.assert:
that:
- atlas_aria2_gateway_port not in [atlas_aria2_rpc_port, atlas_ariang_web_port]
- atlas_aria2_public_domain is match('^[a-z0-9][a-z0-9.-]+[.][a-z]{2,}$')
- not atlas_aria2_public_domain.startswith('CHANGEME')
- name: Install the private JSON-RPC adapter
ansible.builtin.copy:
src: atlas-aria2-rpc-gateway.py
dest: "{{ atlas_aria2_state_dir }}/rpc-gateway.py"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0600"
register: atlas_aria2_gateway_script
- name: Prepare the user unit directory
ansible.builtin.file:
path: "{{ atlas_admin_home }}/.config/systemd/user"
state: directory
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0700"
- name: Install the user gateway unit
ansible.builtin.template:
src: atlas-aria2-gateway.service.j2
dest: "{{ atlas_admin_home }}/.config/systemd/user/atlas-aria2-gateway.service"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0644"
register: atlas_aria2_gateway_unit
- name: Allow only Aegis to reach the credential-injecting adapter
ansible.posix.firewalld:
zone: "{{ atlas_firewalld_zone }}"
rich_rule: >-
rule family="ipv4" source address="{{ atlas_aegis_ip }}"
port port="{{ atlas_aria2_gateway_port }}" protocol="tcp" accept
permanent: true
immediate: true
state: enabled
- name: Enable and start the private gateway
become_user: "{{ atlas_admin_username }}"
ansible.builtin.systemd_service:
scope: user
name: atlas-aria2-gateway.service
daemon_reload: "{{ atlas_aria2_gateway_unit.changed }}"
enabled: true
state: "{{ 'restarted' if atlas_aria2_gateway_script.changed or atlas_aria2_gateway_unit.changed else 'started' }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ atlas_admin_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ atlas_admin_uid }}/bus"
when: not ansible_check_mode
- name: Verify token-free requests through the private adapter
ansible.builtin.uri:
url: "http://{{ ansible_host }}:{{ atlas_aria2_gateway_port }}/jsonrpc"
headers:
Host: "{{ atlas_aria2_public_domain }}"
method: POST
body_format: json
body:
jsonrpc: "2.0"
id: ansible-gateway
method: aria2.getVersion
params: []
return_content: true
register: atlas_aria2_gateway_probe
retries: 10
delay: 2
until: atlas_aria2_gateway_probe.json.result.version is defined
when: not ansible_check_mode

View File

@@ -1,538 +0,0 @@
---
- name: Validate Atlas Borg backup configuration
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.assert:
that:
- atlas_manage_storage | bool
- atlas_zfs_pool != 'CHANGEME_ZFS_POOL'
- atlas_mount_root.startswith('/')
- atlas_borg_username is match('^[a-z_][a-z0-9_-]*$')
- atlas_borg_group is match('^[a-z_][a-z0-9_-]*$')
- atlas_borg_username not in ['root', atlas_admin_username]
- atlas_borg_group != 'wheel'
- atlas_borg_home.startswith('/var/lib/')
- atlas_borg_repository_host is match('^[A-Za-z0-9.-]+$')
- atlas_borg_repository_user is match('^[A-Za-z0-9_-]+$')
- atlas_borg_repository_port | int > 0
- atlas_borg_repository_port | int < 65536
- atlas_borg_repository_path is match('^\./[A-Za-z0-9][A-Za-z0-9._/-]*$')
- "'/../' not in ('/' ~ atlas_borg_repository_path ~ '/')"
- atlas_borg_remote_path is match('^borg-[0-9]+\.[0-9]+$')
- atlas_borg_host_key.startswith(
'[' ~ atlas_borg_repository_host ~ ']:' ~ (atlas_borg_repository_port | string) ~ ' ssh-ed25519 '
)
- atlas_borg_ssh_private_key_path.startswith('/etc/atlas-borg/')
- atlas_borg_known_hosts_path.startswith('/etc/atlas-borg/')
- atlas_borg_passphrase_path.startswith('/etc/atlas-borg/')
- atlas_borg_ssh_wrapper_path.startswith('/usr/local/libexec/')
- atlas_borg_encryption_mode == 'repokey'
- atlas_borg_archive_prefix is match('^[a-z0-9][a-z0-9_-]*$')
- atlas_borg_snapshot_prefix is match('^[a-z0-9][a-z0-9_-]*$')
- atlas_borg_keep_daily | int > 0
- atlas_borg_keep_weekly | int > 0
- atlas_borg_keep_monthly | int > 0
fail_msg: >-
Atlas Borg needs a safe relative repository path, a pinned ED25519 host
key, positive retention counts, and valid dedicated SSH settings.
when: atlas_manage_borg_backup | bool
- name: Create the Atlas Borg system group
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.group:
name: "{{ atlas_borg_group }}"
system: true
state: present
when: atlas_manage_borg_backup | bool
- name: Create the least-privilege Atlas Borg account
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.user:
name: "{{ atlas_borg_username }}"
group: "{{ atlas_borg_group }}"
groups: []
append: false
comment: Atlas Borg backup service
home: "{{ atlas_borg_home }}"
create_home: false
shell: /sbin/nologin
password_lock: true
system: true
state: present
when: atlas_manage_borg_backup | bool
- name: Read Atlas Borg account group membership
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.command:
argv:
- id
- -nG
- "{{ atlas_borg_username }}"
register: atlas_borg_account_groups
changed_when: false
check_mode: false
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Require the Atlas Borg account to have no supplementary groups
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.assert:
that:
- atlas_borg_account_groups.stdout.split() == [atlas_borg_group]
fail_msg: >-
The Atlas Borg service account must belong only to its private primary
group and must never receive wheel or other supplementary membership.
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Validate Atlas Borg systemd calendars
tags: [atlas, storage, backup, borg]
ansible.builtin.command:
argv:
- systemd-analyze
- calendar
- "{{ item }}"
loop:
- "{{ atlas_borg_backup_calendar }}"
- "{{ atlas_borg_check_calendar }}"
changed_when: false
check_mode: false
when: atlas_manage_borg_backup | bool
- name: Create Atlas Borg configuration directory
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.file:
path: /etc/atlas-borg
state: directory
owner: root
group: "{{ atlas_borg_group }}"
mode: "0750"
when: atlas_manage_borg_backup | bool
- name: Generate the dedicated Atlas Borg SSH identity
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.command:
argv:
- ssh-keygen
- -q
- -t
- ed25519
- -N
- ""
- -C
- atlas-borg@atlas
- -f
- "{{ atlas_borg_ssh_private_key_path }}"
creates: "{{ atlas_borg_ssh_private_key_path }}"
when: atlas_manage_borg_backup | bool
- name: Protect the Atlas Borg private SSH identity
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.file:
path: "{{ atlas_borg_ssh_private_key_path }}"
owner: "{{ atlas_borg_username }}"
group: "{{ atlas_borg_group }}"
mode: "0600"
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Set permissions on the Atlas Borg public SSH identity
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.file:
path: "{{ atlas_borg_ssh_private_key_path }}.pub"
owner: "{{ atlas_borg_username }}"
group: "{{ atlas_borg_group }}"
mode: "0644"
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Read the dedicated Atlas Borg public SSH identity
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.slurp:
src: "{{ atlas_borg_ssh_private_key_path }}.pub"
register: atlas_borg_public_key
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Report the public SSH identity to install in the Hetzner sub-account
tags: [atlas, storage, backup, borg, borg_key]
ansible.builtin.debug:
msg: "{{ atlas_borg_public_key.content | b64decode | trim }}"
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Pin the Hetzner Storage Box SSH host key
tags: [atlas, storage, backup, borg]
ansible.builtin.copy:
content: "{{ atlas_borg_host_key }}\n"
dest: "{{ atlas_borg_known_hosts_path }}"
owner: "{{ atlas_borg_username }}"
group: "{{ atlas_borg_group }}"
mode: "0600"
when: atlas_manage_borg_backup | bool
- name: Create Atlas Borg state directories
tags: [atlas, storage, backup, borg]
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ atlas_borg_username }}"
group: "{{ atlas_borg_group }}"
mode: "0700"
loop:
- "{{ atlas_borg_config_dir }}"
- "{{ atlas_borg_cache_dir }}"
when: atlas_manage_borg_backup | bool
- name: Create the shared Atlas Borg operation lock
tags: [atlas, storage, backup, borg]
ansible.builtin.copy:
content: ""
dest: "{{ atlas_borg_lock_path }}"
owner: "{{ atlas_borg_username }}"
group: "{{ atlas_borg_group }}"
mode: "0600"
force: false
when: atlas_manage_borg_backup | bool
- name: Require the Atlas Borg encryption passphrase from Vault
tags: [atlas, storage, backup, borg]
ansible.builtin.assert:
that:
- atlas_borg_passphrase | length >= 20
fail_msg: >-
Define vault_atlas_borg_passphrase with a strong unique value in the
encrypted Vault before activating the Borg repository.
no_log: true
when: atlas_manage_borg_backup | bool
- name: Install the Atlas Borg passphrase
tags: [atlas, storage, backup, borg]
ansible.builtin.copy:
content: "{{ atlas_borg_passphrase }}\n"
dest: "{{ atlas_borg_passphrase_path }}"
owner: "{{ atlas_borg_username }}"
group: "{{ atlas_borg_group }}"
mode: "0600"
diff: false
no_log: true
when: atlas_manage_borg_backup | bool
- name: Install the Atlas Borg backup helper
tags: [atlas, storage, backup, borg, borg_logging]
ansible.builtin.template:
src: atlas-borg-backup.sh.j2
dest: /usr/local/sbin/atlas-borg-backup
owner: root
group: root
mode: "0750"
when: atlas_manage_borg_backup | bool
- name: Install the Atlas Borg snapshot cleanup helper
tags: [atlas, storage, backup, borg, borg_logging]
ansible.builtin.template:
src: atlas-borg-snapshot-cleanup.sh.j2
dest: /usr/local/sbin/atlas-borg-snapshot-cleanup
owner: root
group: root
mode: "0750"
when: atlas_manage_borg_backup | bool
- name: Install the Atlas Borg check helper
tags: [atlas, storage, backup, borg]
ansible.builtin.template:
src: atlas-borg-check.sh.j2
dest: /usr/local/sbin/atlas-borg-check
owner: root
group: "{{ atlas_borg_group }}"
mode: "0750"
when: atlas_manage_borg_backup | bool
- name: Create the local libexec directory for the Atlas Borg SSH wrapper
tags: [atlas, storage, backup, borg, borg_logging]
ansible.builtin.file:
path: "{{ atlas_borg_ssh_wrapper_path | dirname }}"
state: directory
owner: root
group: root
mode: "0755"
when: atlas_manage_borg_backup | bool
- name: Install the Atlas Borg progress formatter
tags: [atlas, storage, backup, borg, borg_logging]
ansible.builtin.copy:
src: atlas-borg-progress.py
dest: /usr/local/libexec/atlas-borg-progress
owner: root
group: root
mode: "0755"
when: atlas_manage_borg_backup | bool
- name: Install the capability-dropping Atlas Borg SSH wrapper
tags: [atlas, storage, backup, borg]
ansible.builtin.template:
src: atlas-borg-ssh.sh.j2
dest: "{{ atlas_borg_ssh_wrapper_path }}"
owner: root
group: root
mode: "0755"
when: atlas_manage_borg_backup | bool
- name: Install Atlas Borg systemd units
tags: [atlas, storage, backup, borg, borg_logging]
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
owner: root
group: root
mode: "0644"
loop:
- atlas-borg-backup.service
- atlas-borg-backup.timer
- atlas-borg-check.service
- atlas-borg-check.timer
notify: Restart Atlas Borg timers
when: atlas_manage_borg_backup | bool
- name: Verify dedicated SSH access to the Hetzner Storage Box
tags: [atlas, storage, backup, borg]
ansible.builtin.command:
argv:
- ssh
- -T
- -i
- "{{ atlas_borg_ssh_private_key_path }}"
- -p
- "{{ atlas_borg_repository_port | string }}"
- -o
- BatchMode=yes
- -o
- IdentitiesOnly=yes
- -o
- StrictHostKeyChecking=yes
- -o
- "UserKnownHostsFile={{ atlas_borg_known_hosts_path }}"
- "{{ atlas_borg_repository_user }}@{{ atlas_borg_repository_host }}"
- pwd
register: atlas_borg_ssh_probe
become: true
become_user: "{{ atlas_borg_username }}"
changed_when: false
failed_when: false
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Require the dedicated public key on the Hetzner sub-account
tags: [atlas, storage, backup, borg]
ansible.builtin.assert:
that:
- atlas_borg_ssh_probe.rc == 0
fail_msg: >-
Install the reported Atlas Borg public key in the Hetzner sub-account
before rerunning the Borg tasks. Password authentication is never used.
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Probe the remote Atlas Borg repository path
tags: [atlas, storage, backup, borg]
ansible.builtin.command:
argv:
- ssh
- -T
- -i
- "{{ atlas_borg_ssh_private_key_path }}"
- -p
- "{{ atlas_borg_repository_port | string }}"
- -o
- BatchMode=yes
- -o
- IdentitiesOnly=yes
- -o
- StrictHostKeyChecking=yes
- -o
- "UserKnownHostsFile={{ atlas_borg_known_hosts_path }}"
- "{{ atlas_borg_repository_user }}@{{ atlas_borg_repository_host }}"
- stat
- "{{ atlas_borg_repository_path }}"
register: atlas_borg_repository_path_probe
become: true
become_user: "{{ atlas_borg_username }}"
changed_when: false
failed_when: false
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Probe the Atlas Borg repository
tags: [atlas, storage, backup, borg]
ansible.builtin.command:
argv:
- /usr/bin/borg
- --remote-path
- "{{ atlas_borg_remote_path }}"
- info
- >-
ssh://{{ atlas_borg_repository_user }}@{{ atlas_borg_repository_host }}:
{{- atlas_borg_repository_port }}/{{ atlas_borg_repository_path }}
environment:
BORG_CACHE_DIR: "{{ atlas_borg_cache_dir }}"
BORG_CONFIG_DIR: "{{ atlas_borg_config_dir }}"
BORG_PASSCOMMAND: "cat {{ atlas_borg_passphrase_path }}"
BORG_RSH: "{{ atlas_borg_ssh_wrapper_path }}"
register: atlas_borg_repository_probe
become: true
become_user: "{{ atlas_borg_username }}"
changed_when: false
failed_when: false
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- atlas_borg_repository_path_probe.rc == 0
- name: Reject an existing path that is not the configured Borg repository
tags: [atlas, storage, backup, borg]
ansible.builtin.assert:
that:
- atlas_borg_repository_probe.rc == 0
fail_msg: >-
The remote repository path already exists but Borg could not open it.
Refusing to initialize over existing data; verify the path, passphrase,
and repository state manually.
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- atlas_borg_repository_path_probe.rc == 0
- name: Initialize the encrypted Atlas Borg repository
tags: [atlas, storage, backup, borg]
ansible.builtin.command:
argv:
- /usr/bin/borg
- --remote-path
- "{{ atlas_borg_remote_path }}"
- init
- --encryption
- "{{ atlas_borg_encryption_mode }}"
- >-
ssh://{{ atlas_borg_repository_user }}@{{ atlas_borg_repository_host }}:
{{- atlas_borg_repository_port }}/{{ atlas_borg_repository_path }}
environment:
BORG_CACHE_DIR: "{{ atlas_borg_cache_dir }}"
BORG_CONFIG_DIR: "{{ atlas_borg_config_dir }}"
BORG_PASSCOMMAND: "cat {{ atlas_borg_passphrase_path }}"
BORG_RSH: "{{ atlas_borg_ssh_wrapper_path }}"
become: true
become_user: "{{ atlas_borg_username }}"
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- atlas_borg_repository_path_probe.rc != 0
- name: Verify the encrypted Atlas Borg repository
tags: [atlas, storage, backup, borg]
ansible.builtin.command:
argv:
- /usr/bin/borg
- --remote-path
- "{{ atlas_borg_remote_path }}"
- info
- >-
ssh://{{ atlas_borg_repository_user }}@{{ atlas_borg_repository_host }}:
{{- atlas_borg_repository_port }}/{{ atlas_borg_repository_path }}
environment:
BORG_CACHE_DIR: "{{ atlas_borg_cache_dir }}"
BORG_CONFIG_DIR: "{{ atlas_borg_config_dir }}"
BORG_PASSCOMMAND: "cat {{ atlas_borg_passphrase_path }}"
BORG_RSH: "{{ atlas_borg_ssh_wrapper_path }}"
become: true
become_user: "{{ atlas_borg_username }}"
changed_when: false
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Check for the local Atlas Borg recovery-key export
tags: [atlas, storage, backup, borg]
ansible.builtin.stat:
path: "{{ atlas_borg_recovery_export_path }}"
register: atlas_borg_recovery_export
delegate_to: localhost
become: false
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- name: Export the Atlas Borg recovery key for offline preservation
tags: [atlas, storage, backup, borg]
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode
- not atlas_borg_recovery_export.stat.exists
no_log: true
block:
- name: Create the local recovery-material directory
ansible.builtin.file:
path: "{{ atlas_borg_recovery_export_path | dirname }}"
state: directory
mode: "0700"
delegate_to: localhost
become: false
- name: Export the encrypted Borg repository key on Atlas
ansible.builtin.command:
argv:
- /usr/bin/borg
- --remote-path
- "{{ atlas_borg_remote_path }}"
- key
- export
- >-
ssh://{{ atlas_borg_repository_user }}@{{ atlas_borg_repository_host }}:
{{- atlas_borg_repository_port }}/{{ atlas_borg_repository_path }}
- "{{ atlas_borg_config_dir }}/atlas-borg-repokey.export"
environment:
BORG_CACHE_DIR: "{{ atlas_borg_cache_dir }}"
BORG_CONFIG_DIR: "{{ atlas_borg_config_dir }}"
BORG_PASSCOMMAND: "cat {{ atlas_borg_passphrase_path }}"
BORG_RSH: "{{ atlas_borg_ssh_wrapper_path }}"
become: true
become_user: "{{ atlas_borg_username }}"
- name: Fetch the encrypted Borg recovery key from Atlas
ansible.builtin.fetch:
src: "{{ atlas_borg_config_dir }}/atlas-borg-repokey.export"
dest: "{{ atlas_borg_recovery_export_path }}"
flat: true
- name: Protect the local Borg recovery-key export
ansible.builtin.file:
path: "{{ atlas_borg_recovery_export_path }}"
mode: "0600"
delegate_to: localhost
become: false
always:
- name: Remove the temporary recovery-key export from Atlas
ansible.builtin.file:
path: "{{ atlas_borg_config_dir }}/atlas-borg-repokey.export"
state: absent
- name: Enable Atlas Borg backup and check timers
tags: [atlas, storage, backup, borg]
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
state: started
daemon_reload: true
loop:
- atlas-borg-backup.timer
- atlas-borg-check.timer
when:
- atlas_manage_borg_backup | bool
- not ansible_check_mode

View File

@@ -1,15 +0,0 @@
---
- name: Configure the official 45Drives repository
tags: [atlas, packages]
ansible.builtin.get_url:
url: "{{ atlas_45drives_repo_url }}"
dest: "{{ atlas_45drives_repo_file }}"
owner: root
group: root
mode: "0644"
- name: Install 45Drives Cockpit plugins
tags: [atlas, packages]
ansible.builtin.dnf:
name: "{{ atlas_45drives_packages }}"
state: present

View File

@@ -1,140 +0,0 @@
---
- name: Require completed Atlas media-stack configuration
tags: [atlas, containers, immich]
ansible.builtin.assert:
that:
- atlas_manage_storage | bool
- atlas_zfs_pool != 'CHANGEME_ZFS_POOL'
- atlas_mount_root != '/CHANGEME_ATLAS_MOUNT_ROOT'
- atlas_immich_db_password | length > 0
- atlas_npm_admin_bind_address == '127.0.0.1'
fail_msg: >-
Enable and configure Atlas storage, provide vault_atlas_immich_db_password,
and keep the NPM administration port bound to loopback before enabling the media stack.
no_log: true
when: atlas_manage_media_stack | bool
- name: Check Atlas Intel graphics device
tags: [atlas, containers, immich]
ansible.builtin.stat:
path: /dev/dri
register: atlas_dri_device
when: atlas_manage_media_stack | bool
- name: Require Atlas Intel graphics device
tags: [atlas, containers, immich]
ansible.builtin.assert:
that:
- atlas_dri_device.stat.isdir | default(false)
fail_msg: /dev/dri is required for Immich QuickSync and OpenVINO acceleration.
when: atlas_manage_media_stack | bool
- name: Create Atlas rootful Quadlet directory
tags: [atlas, containers]
ansible.builtin.file:
path: "{{ atlas_container_quadlet_dir }}"
state: directory
owner: root
group: root
mode: "0755"
when: atlas_manage_media_stack | bool
- name: Create Atlas Immich configuration directory
tags: [atlas, containers, immich]
ansible.builtin.file:
path: /etc/immich
state: directory
owner: root
group: "{{ atlas_immich_group }}"
mode: "0750"
when: atlas_manage_media_stack | bool
- name: Create Atlas Immich persistent directories
tags: [atlas, containers, immich]
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ atlas_immich_username }}"
group: "{{ atlas_immich_group }}"
mode: "0750"
loop:
- "{{ atlas_immich_upload_dir }}"
- "{{ atlas_immich_model_cache_dir }}"
- "{{ atlas_immich_machine_learning_config_dir }}"
- "{{ atlas_immich_machine_learning_cache_dir }}"
- "{{ atlas_immich_redis_data_dir }}"
- "{{ atlas_immich_postgres_data_dir }}"
loop_control:
label: "{{ item }}"
when: atlas_manage_media_stack | bool
- name: Create Atlas NPM persistent directories
tags: [atlas, containers, npm]
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: "0750"
loop:
- "{{ atlas_npm_data_dir }}"
- "{{ atlas_npm_letsencrypt_dir }}"
loop_control:
label: "{{ item }}"
when: atlas_manage_media_stack | bool
- name: Allow confined containers to use Atlas graphics devices
tags: [atlas, containers, immich]
ansible.posix.seboolean:
name: container_use_devices
state: true
persistent: true
when:
- atlas_manage_media_stack | bool
- (ansible_facts['selinux'] | default({})).get('status', 'disabled') == 'enabled'
- name: Render Vault-backed Immich environment
tags: [atlas, containers, immich]
ansible.builtin.template:
src: immich.env.j2
dest: /etc/immich/immich.env
owner: root
group: "{{ atlas_immich_group }}"
mode: "0640"
no_log: true
diff: false
notify: Restart Atlas media Quadlets
when: atlas_manage_media_stack | bool
- name: Render Atlas media Quadlets
tags: [atlas, containers]
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "{{ atlas_container_quadlet_dir }}/{{ item }}"
owner: root
group: root
mode: "0644"
loop:
- atlas-media.network
- atlas-immich-redis.container
- atlas-immich-postgres.container
- atlas-immich-machine-learning.container
- atlas-immich-server.container
- atlas-npm.container
loop_control:
label: "{{ item }}"
notify: Restart Atlas media Quadlets
when: atlas_manage_media_stack | bool
- name: Start Atlas media Quadlet services
tags: [atlas, containers, services]
ansible.builtin.systemd:
name: "{{ item }}"
state: started
daemon_reload: true
loop: "{{ atlas_media_quadlet_services }}"
loop_control:
label: "{{ item }}"
when:
- atlas_manage_media_stack | bool
- not ansible_check_mode

View File

@@ -1,159 +0,0 @@
---
- name: Prepare the isolated rootless Atlas Gitea target
tags: [atlas, gitea]
when: atlas_manage_gitea | bool
block:
- name: Require the existing Atlas application-data dataset
ansible.builtin.assert:
that:
- atlas_manage_storage | bool
- atlas_gitea_dataset == atlas_zfs_pool ~ '/services/data/gitea'
- atlas_gitea_mountpoint == atlas_app_data_mountpoint ~ '/gitea'
- atlas_gitea_username == atlas_admin_username
- atlas_gitea_group == atlas_admin_group
- atlas_gitea_uid | int == atlas_admin_uid | int
- atlas_gitea_gid | int == atlas_admin_gid | int
- atlas_gitea_container_uid | int == 1000
- atlas_gitea_container_gid | int == 1000
- atlas_gitea_staging_bind_address == '127.0.0.1'
- not (atlas_gitea_production_enabled | bool) or atlas_manage_firewall | bool
- not (atlas_gitea_production_enabled | bool) or atlas_gitea_bind_address == ansible_host
fail_msg: >-
Rootless Gitea requires Atlas storage, the admin user manager, the
dedicated dataset, and loopback-only staging ports.
- name: Inspect the final-restore marker before production activation
ansible.builtin.stat:
path: "{{ atlas_gitea_mountpoint }}/.final-sha256"
register: atlas_gitea_final_marker
when: atlas_gitea_production_enabled | bool
- name: Refuse production activation without the final consistent restore
ansible.builtin.assert:
that:
- atlas_gitea_final_marker.stat.isreg | default(false)
fail_msg: Restore the final stopped-source Gitea export before enabling production.
when: atlas_gitea_production_enabled | bool
- name: Verify the production Gitea dataset belongs to admin
ansible.builtin.stat:
path: "{{ atlas_gitea_mountpoint }}"
register: atlas_gitea_dataset_owner
when: atlas_gitea_production_enabled | bool
- name: Refuse to overlap the legacy host-account service
ansible.builtin.assert:
that:
- atlas_gitea_dataset_owner.stat.uid | int == atlas_admin_uid | int
- atlas_gitea_dataset_owner.stat.gid | int == atlas_admin_gid | int
fail_msg: >-
The production dataset must already belong to admin before enabling
the Quadlet; normal provisioning must not chown an active legacy service.
when: atlas_gitea_production_enabled | bool
- name: Remove the retired account's parent-dataset traverse ACL
ansible.posix.acl:
path: "{{ item }}"
etype: user
entity: "{{ atlas_gitea_legacy_username }}"
state: absent
loop:
- "{{ atlas_services_mountpoint }}"
- "{{ atlas_app_data_mountpoint }}"
when: atlas_gitea_production_enabled | bool
- name: Enable POSIX ACLs only on the service-namespace parents
community.general.zfs:
name: "{{ item }}"
state: present
extra_zfs_properties:
acltype: posix
loop:
- "{{ atlas_zfs_pool }}/{{ atlas_zfs_dataset_services }}"
- "{{ atlas_zfs_pool }}/{{ atlas_zfs_dataset_app_data }}"
- name: Create the dedicated Gitea ZFS dataset
community.general.zfs:
name: "{{ atlas_gitea_dataset }}"
state: present
extra_zfs_properties:
compression: zstd
mountpoint: "{{ atlas_gitea_mountpoint }}"
- name: Restrict the Gitea dataset and create rootless volume paths
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ atlas_gitea_username }}"
group: "{{ atlas_gitea_group }}"
mode: "0700"
loop:
- "{{ atlas_gitea_mountpoint }}"
- "{{ atlas_gitea_mountpoint }}/data"
- "{{ atlas_gitea_mountpoint }}/config"
- "{{ atlas_gitea_home }}/.config"
- "{{ atlas_gitea_home }}/.config/containers"
- "{{ atlas_gitea_quadlet_dir }}"
- name: Ensure lingering for the admin rootless account
ansible.builtin.command:
argv:
- loginctl
- enable-linger
- "{{ atlas_gitea_username }}"
creates: "/var/lib/systemd/linger/{{ atlas_gitea_username }}"
- name: Start the admin rootless user manager
ansible.builtin.systemd:
name: "user@{{ atlas_gitea_uid }}.service"
state: started
when: not ansible_check_mode
- name: Prepare the admin-owned Gitea image
ansible.builtin.import_tasks: gitea_image.yml
- name: Render the rootless Gitea Quadlet
ansible.builtin.template:
src: atlas-gitea.container.j2
dest: "{{ atlas_gitea_quadlet_dir }}/atlas-gitea.container"
owner: "{{ atlas_gitea_username }}"
group: "{{ atlas_gitea_group }}"
mode: "0644"
- name: Permit only Aegis to reach production Gitea HTTP and SSH
ansible.posix.firewalld:
rich_rule: >-
rule family="ipv4" source address="{{ atlas_aegis_ip }}"
port port="{{ item }}" protocol="tcp" accept
zone: "{{ atlas_firewalld_zone }}"
state: "{{ 'enabled' if atlas_gitea_production_enabled | bool else 'disabled' }}"
permanent: true
immediate: true
loop:
- "{{ atlas_gitea_http_port }}"
- "{{ atlas_gitea_ssh_port }}"
when: atlas_manage_firewall | bool
- name: Reload the rootless Gitea user manager without starting Gitea
become_user: "{{ atlas_gitea_username }}"
ansible.builtin.systemd:
scope: user
daemon_reload: true
environment:
XDG_RUNTIME_DIR: "/run/user/{{ atlas_gitea_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ atlas_gitea_uid }}/bus"
when: not ansible_check_mode
- name: Start and enable the rootless Gitea user Quadlet after final restore
become_user: "{{ atlas_gitea_username }}"
ansible.builtin.systemd:
name: atlas-gitea.service
scope: user
state: started
enabled: true
environment:
XDG_RUNTIME_DIR: "/run/user/{{ atlas_gitea_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ atlas_gitea_uid }}/bus"
when:
- atlas_gitea_production_enabled | bool
- not ansible_check_mode

View File

@@ -1,51 +0,0 @@
---
- name: Create the admin-owned Gitea image build directory
ansible.builtin.file:
path: "{{ atlas_gitea_image_build_dir }}"
state: directory
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0700"
- name: Install the pinned rootless Gitea Containerfile
ansible.builtin.copy:
src: Containerfile.gitea-rootless
dest: "{{ atlas_gitea_image_build_dir }}/Containerfile"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0644"
- name: Check the admin-owned Gitea image
become_user: "{{ atlas_admin_username }}"
ansible.builtin.command:
argv: [podman, image, exists, "{{ atlas_gitea_image }}"]
args:
chdir: "{{ atlas_gitea_image_build_dir }}"
environment:
HOME: "{{ atlas_admin_home }}"
XDG_RUNTIME_DIR: "/run/user/{{ atlas_admin_uid }}"
register: atlas_gitea_image_present
changed_when: false
failed_when: false
check_mode: false
- name: Build the pinned Gitea image with the internal gitea identity
become_user: "{{ atlas_admin_username }}"
ansible.builtin.command:
argv:
- podman
- build
- --pull=always
- --tag
- "{{ atlas_gitea_image }}"
- --file
- Containerfile
- .
args:
chdir: "{{ atlas_gitea_image_build_dir }}"
environment:
HOME: "{{ atlas_admin_home }}"
XDG_RUNTIME_DIR: "/run/user/{{ atlas_admin_uid }}"
when:
- atlas_gitea_image_present.rc != 0
- not ansible_check_mode

View File

@@ -1,58 +0,0 @@
---
- name: Manage the public domain of the restored production Gitea
tags: [atlas, gitea, gitea_public_domain]
when:
- atlas_manage_gitea | bool
- atlas_gitea_production_enabled | bool
- atlas_gitea_public_domain | length > 0
block:
- name: Require an explicit public Gitea hostname
ansible.builtin.assert:
that:
- atlas_gitea_public_domain is match('^[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z]{2,}$')
- name: Inspect the restored private Gitea configuration
ansible.builtin.stat:
path: "{{ atlas_gitea_mountpoint }}/config/app.ini"
follow: false
register: atlas_gitea_public_config
- name: Refuse to create or replace an unprepared Gitea configuration
ansible.builtin.assert:
that:
- atlas_gitea_public_config.stat.isreg | default(false)
- atlas_gitea_public_config.stat.uid | int == atlas_gitea_uid | int
- atlas_gitea_public_config.stat.mode == '0600'
# app.ini contains secrets: preserve all unrelated settings and suppress diffs.
- name: Set only the declared public Gitea server fields
community.general.ini_file:
path: "{{ atlas_gitea_mountpoint }}/config/app.ini"
section: server
option: "{{ item.option }}"
value: "{{ item.value }}"
create: false
backup: true
owner: "{{ atlas_gitea_username }}"
group: "{{ atlas_gitea_group }}"
mode: "0600"
loop:
- { option: DOMAIN, value: "{{ atlas_gitea_public_domain }}" }
- { option: ROOT_URL, value: "https://{{ atlas_gitea_public_domain }}/" }
- { option: SSH_DOMAIN, value: "{{ atlas_gitea_public_domain }}" }
register: atlas_gitea_public_domain_update
no_log: true
diff: false
- name: Restart only Gitea when its public configuration changes
become_user: "{{ atlas_gitea_username }}"
ansible.builtin.systemd:
name: atlas-gitea.service
scope: user
state: restarted
environment:
XDG_RUNTIME_DIR: "/run/user/{{ atlas_gitea_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ atlas_gitea_uid }}/bus"
when:
- atlas_gitea_public_domain_update is changed
- not ansible_check_mode

View File

@@ -1,45 +0,0 @@
---
- name: Enforce targeted SELinux on Atlas
tags: [atlas, hardening, security]
ansible.posix.selinux:
policy: targeted
state: enforcing
update_kernel_param: true
register: atlas_selinux_enforcement
- name: Report when Atlas requires a reboot for SELinux enforcement
tags: [atlas, hardening, security]
ansible.builtin.debug:
msg: Reboot Atlas before relying on SELinux enforcement.
when: atlas_selinux_enforcement.reboot_required | default(false)
- name: Apply Atlas network-kernel hardening
tags: [atlas, hardening, security]
ansible.posix.sysctl:
name: "{{ item.key }}"
value: "{{ item.value }}"
state: present
sysctl_set: true
reload: true
loop: "{{ atlas_hardening_sysctls | dict2items }}"
loop_control:
label: "{{ item.key }}={{ item.value }}"
- name: Read active Atlas SELinux mode
tags: [atlas, hardening, security]
ansible.builtin.command:
argv:
- getenforce
register: atlas_selinux_mode
changed_when: false
when: not ansible_check_mode
- name: Require active SELinux enforcement on Atlas
tags: [atlas, hardening, security]
ansible.builtin.assert:
that:
- atlas_selinux_mode.stdout == 'Enforcing'
fail_msg: >-
Atlas SELinux is not enforcing. Reboot if requested by the preceding
SELinux task, then rerun the hardening role before enabling services.
when: not ansible_check_mode

View File

@@ -1,188 +0,0 @@
---
- name: Require exact Atlas iCloudPD paths and rootless identity
tags: [atlas, icloudpd]
ansible.builtin.assert:
that:
- atlas_manage_storage | bool
- atlas_icloudpd_dataset == atlas_zfs_pool ~ '/services/data/icloudpd'
- atlas_icloudpd_state_dir == atlas_app_data_mountpoint ~ '/icloudpd'
- atlas_icloudpd_config_dir == atlas_icloudpd_state_dir ~ '/config'
- atlas_icloudpd_photos_dir == atlas_archive_mountpoint ~ '/Pictures/iCloudPD'
- atlas_admin_uid | int == 1000
- atlas_admin_gid | int == 1000
- atlas_icloudpd_image is search('@sha256:[0-9a-f]{64}$')
fail_msg: Verify the fixed, separate Atlas iCloudPD photo and state paths.
- name: Declare rootless Atlas iCloudPD storage and boot-started Quadlet
tags: [atlas, icloudpd]
block:
- name: Inspect the existing Archive and application-data datasets
community.general.zfs_facts:
name: "{{ item.dataset }}"
properties: name,mounted,mountpoint
loop:
- dataset: "{{ atlas_zfs_pool }}/{{ atlas_zfs_dataset_archive }}"
mountpoint: "{{ atlas_archive_mountpoint }}"
- dataset: "{{ atlas_zfs_pool }}/{{ atlas_zfs_dataset_app_data }}"
mountpoint: "{{ atlas_app_data_mountpoint }}"
loop_control:
label: "{{ item.dataset }}"
register: atlas_icloudpd_parent_datasets
- name: Refuse missing or unmounted iCloudPD parent datasets
ansible.builtin.assert:
that:
- item.ansible_facts.ansible_zfs_datasets | length == 1
- item.ansible_facts.ansible_zfs_datasets[0].mounted == 'yes'
- item.ansible_facts.ansible_zfs_datasets[0].mountpoint == item.item.mountpoint
loop: "{{ atlas_icloudpd_parent_datasets.results }}"
loop_control:
label: "{{ item.item.dataset }}"
- name: Inspect the existing Pictures namespace and proposed target
ansible.builtin.stat:
path: "{{ item }}"
follow: false
loop:
- "{{ atlas_archive_mountpoint }}/Pictures"
- "{{ atlas_icloudpd_photos_dir }}"
- "{{ atlas_icloudpd_photos_dir }}/.atlas-icloudpd-managed"
register: atlas_icloudpd_photo_paths
- name: Refuse to adopt unrelated Pictures data or a symlink
ansible.builtin.assert:
that:
- atlas_icloudpd_photo_paths.results[0].stat.isdir | default(false)
- atlas_icloudpd_photo_paths.results[0].stat.uid | int == atlas_admin_uid | int
- >-
not atlas_icloudpd_photo_paths.results[1].stat.exists or
(atlas_icloudpd_photo_paths.results[1].stat.isdir | default(false) and
atlas_icloudpd_photo_paths.results[2].stat.isreg | default(false))
fail_msg: >-
Pictures must exist and be admin-owned; an existing iCloudPD target
must carry its managed marker. Never adopt or replace unrelated data.
- name: Create a dedicated ZFS dataset for iCloudPD configuration and MFA
community.general.zfs:
name: "{{ atlas_icloudpd_dataset }}"
state: present
extra_zfs_properties:
compression: zstd
mountpoint: "{{ atlas_icloudpd_state_dir }}"
- name: Restrict iCloudPD state and the new photo subtree
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "{{ item.mode }}"
loop:
- path: "{{ atlas_icloudpd_state_dir }}"
mode: "0700"
- path: "{{ atlas_icloudpd_config_dir }}"
mode: "0700"
- path: "{{ atlas_icloudpd_photos_dir }}"
mode: "0750"
- path: "{{ atlas_icloudpd_quadlet_dir }}"
mode: "0700"
loop_control:
label: "{{ item.path }}"
- name: Mark only the newly managed iCloudPD photo subtree
ansible.builtin.copy:
content: "Atlas iCloudPD photo subtree; do not remove source photos.\n"
dest: "{{ atlas_icloudpd_photos_dir }}/.atlas-icloudpd-managed"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0600"
force: false
- name: Install the image's required mounted-filesystem failsafe
ansible.builtin.copy:
content: ""
dest: "{{ atlas_icloudpd_photos_dir }}/.mounted"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0644"
force: false
- name: Require the Vault-backed iCloudPD Apple ID
ansible.builtin.assert:
that:
- vault_atlas_icloudpd_apple_id is defined
- vault_atlas_icloudpd_apple_id | length > 0
- vault_atlas_icloudpd_apple_id != 'REPLACE_ME'
- vault_atlas_icloudpd_apple_id.splitlines() | length == 1
fail_msg: Configure the existing iCloudPD Apple ID in Vault.
no_log: true
- name: Seed private Atlas iCloudPD configuration when absent
ansible.builtin.template:
src: atlas-icloudpd.conf.j2
dest: "{{ atlas_icloudpd_config_dir }}/icloudpd.conf"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0600"
force: false
no_log: true
diff: false
- name: Keep declared iCloudPD options in the image-managed configuration
ansible.builtin.lineinfile:
path: "{{ atlas_icloudpd_config_dir }}/icloudpd.conf"
regexp: "^{{ item.key }}="
line: "{{ item.key }}={{ item.value }}"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0600"
loop:
- {key: apple_id, value: "{{ vault_atlas_icloudpd_apple_id }}"}
- {key: authentication_type, value: MFA}
- {key: user, value: user}
- {key: user_id, value: "1000"}
- {key: group, value: group}
- {key: group_id, value: "1000"}
- {key: download_path, value: /home/user/iCloud}
- {key: folder_structure, value: "{:%Y/%m/%d}"}
- {key: directory_permissions, value: "750"}
- {key: file_permissions, value: "640"}
- {key: download_interval, value: "86400"}
- {key: auto_delete, value: "false"}
- {key: delete_after_download, value: "false"}
loop_control:
label: "{{ item.key }}"
no_log: true
diff: false
- name: Render the rootless Atlas iCloudPD Quadlet
ansible.builtin.template:
src: atlas-icloudpd.container.j2
dest: "{{ atlas_icloudpd_quadlet_dir }}/atlas-icloudpd.container"
owner: "{{ atlas_admin_username }}"
group: "{{ atlas_admin_group }}"
mode: "0644"
register: atlas_icloudpd_quadlet
- name: Reload the Atlas admin user manager after iCloudPD Quadlet changes
become_user: "{{ atlas_admin_username }}"
ansible.builtin.systemd:
scope: user
daemon_reload: true
environment:
XDG_RUNTIME_DIR: "/run/user/{{ atlas_admin_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ atlas_admin_uid }}/bus"
when:
- atlas_icloudpd_quadlet.changed
- not ansible_check_mode
- name: Keep the rootless Atlas iCloudPD service running
become_user: "{{ atlas_admin_username }}"
ansible.builtin.systemd:
name: atlas-icloudpd.service
scope: user
state: started
environment:
XDG_RUNTIME_DIR: "/run/user/{{ atlas_admin_uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ atlas_admin_uid }}/bus"
when: not ansible_check_mode

Some files were not shown because too many files have changed in this diff Show More