This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Host configuration

Shared native Traefik and Nginx deployment

    Build :ansible_bin to package the playbooks and shared collection. The host play uses alwaldend.main.download_host for storage, the publisher account, rsync, service setup, and deduplication. The role does not configure publisher authorized keys; administrators use their existing SSH access and run publication through sudo as download. Inventory, Vault injection, and routing templates belong to this deployment. Both inventories connect using their unique host FQDNs, with the same names for SSH host-key checks. Host DNS must resolve before configuration; no IP override or HostKeyAlias is configured. The wrapper reuses the SSH injector’s temporary known-hosts file with the same repository server CA and hostname scope as the operator SSH targets. Strict verification stays enabled; client configuration and SSH-agent identities are excluded. AL removes the temporary trust file on exit. Run :ansible.local or :ansible.yandex only with explicit live authorization. Before configuring the host, Ansible requires the content path to resolve to a block device. The role creates the filesystem without forcing an overwrite and mounts it before enabling the services. The shared roles manage the service units. Traefik keeps its configuration and ACME data on the system disk at /opt/traefik and has no content-mount dependency. The role creates publication roots, including third_party/; publishers create individual artifact/site directories and select releases. It never uploads or selects releases.

    nginx_config_template supplies the complete configuration to the reusable Nginx role. JSON listings allow credential-free cross-origin reads and normal HEAD/range downloads. Site requests follow the current link. Port 8008 is loopback-only and uses the Fedora SELinux HTTP port type. Public content has read-only HTTP labels; the SSH publisher needs readable file modes and must preserve those labels when activating staged content.

    Yandex uses Let’s Encrypt HTTP-01 without EAB; XCP-ng uses the existing Vault HTTP-01 directory with EAB generated by the shared Traefik role. Local browsers need the repository CA. Neither host stores a DNS provider credential.

    For a newly created Yandex VM, authenticate the initial host public keys using its serial-port output through the component’s provider identity. Match the instance ID and public address to the applied Terraform result and use the SSH HOST KEY KEYS section, not the authorized client keys. Put the verified keys in a temporary known-hosts file scoped to the exact inventory FQDN. Pass it to the first Ansible invocation through --ssh-common-args, retaining StrictHostKeyChecking=yes, -F /dev/null, IdentityAgent=none, IdentitiesOnly=yes, and GlobalKnownHostsFile=/dev/null. The SSH role installs signed host certificates; subsequent runs use the default CA trust. A timeout happens before host-key verification and is not a reason to disable that verification.

    download_site_enabled controls the apex site and www redirect routers in both Nginx and Traefik. It is enabled in both environments after the authorized public cutover. For a new deployment, configure Nginx and verify content before changing DNS, then activate Traefik when public DNS reaches the host. This avoids premature HTTP-01 requests. The download router obtains its own certificate.

    When download_git_redirect_enabled is enabled, the higher-priority Traefik git_discovery router sends go-get=1 requests to Nginx. Its static HTML identifies git.alwaldend.com/alwaldend/src as the prefix for the Git repository https://github.com/alwaldend/src.git, at the repository root and all slash-delimited descendants. Other discovery prefixes return 404. The lower-priority git router redirects ordinary requests to GitHub. Both routers and the metadata virtual host are disabled for the local inventory, and discovery is independent of download_site_enabled.

    For public ACME staging, override both download_acme_directory and traefik_data_dir (for example a separate acme-staging directory under the Traefik root). Switching back preserves separate staging/production accounts and prevents staging certificates from becoming the production selection.

    The content filesystem is Btrfs. The native duperemove package and daily systemd timer share duplicate extents across published files and extracted sites. Its private hash database lives outside both scan roots. The maintenance service waits for the mount and has bounded CPU/memory and low I/O priority; a failed run leaves the release layout and active website selection intact.

    The play forces notified handlers after later task failures. Successfully installed configuration therefore still triggers its pending handlers if a later task fails. Unreachable hosts can still prevent handler execution. Nginx configuration validation before installation is unchanged. See Ansible’s handler failure behavior.

    The Ansible wrapper reuses the component SSH injector for the private key, certificate and scoped host CA. It disables agent and user-configuration identity selection and keeps strict host verification enabled. download_publication selects only publication directories, labels, maintenance units and Nginx; nginx selects only routing deployment.

    playbook_sync.yaml mirrors the local store to Yandex using the same inventory and credential injection. Invoke it through //infra/download:sync.yandex; append -- --check for a preview. It does not run the host role. The component runbook owns the transfer, retention, and failure contract. Tasks under tasks/sync_*.yaml validate roots and captured content, stage transfers, and select complete project directories.