Boot menu: "Clonezilla: back up this PC" and "restore this PC" ask for the machine number and boot Clonezilla (64-bit with Debian shim, or 32-bit i686 by cpuid) with ocs_repository=smb3://clonezilla:<pw>@server/clonezilla/, ocs_prerun fetching clonezilla-scripts/pxe-cz.sh and ocs_live_run running it. The script validates the machine number, saves <machine>-<YYYY-MM-DD-HHMM> (server time), writes pxe-meta.txt, runs ocs-chkimg, and restores only that machine's images with -k1 -r after a typed YES. The old entry is "Clonezilla: manual". Playbook: clonezilla Samba user for the [clonezilla] share only, password from clonezilla_smb_password (validated, filled into the menu placeholder), scripts installed to the web root. Webapp: Clonezilla backups page lists image folders and zips grouped by machine number with serial/model/version/check, serial mismatch flag, delete, move to another machine, streamed tar download, disk space bar and an explicit keep-last-N retention with preview. Tests and a VM test plan added.
96 lines
4.8 KiB
Python
96 lines
4.8 KiB
Python
"""Configuration constants for the PXE webapp.
|
|
|
|
Reads from environment variables with sensible defaults that match the
|
|
Ansible playbook's deploy paths. Also defines the canonical image type
|
|
list and shared-directory taxonomy used by the import pipeline.
|
|
"""
|
|
|
|
import os
|
|
|
|
# --- Filesystem paths --------------------------------------------------------
|
|
SAMBA_SHARE = os.environ.get("SAMBA_SHARE", "/srv/samba/winpeapps")
|
|
CLONEZILLA_SHARE = os.environ.get("CLONEZILLA_SHARE", "/srv/samba/clonezilla")
|
|
BLANCCO_REPORTS = os.environ.get("BLANCCO_REPORTS", "/srv/samba/blancco-reports")
|
|
ENROLLMENT_SHARE = os.environ.get("ENROLLMENT_SHARE", "/srv/samba/enrollment")
|
|
ENROLLMENT_PPKG_DIR = os.environ.get(
|
|
"ENROLLMENT_PPKG_DIR", os.path.join(ENROLLMENT_SHARE, "ppkgs")
|
|
)
|
|
UPLOAD_DIR = os.environ.get("UPLOAD_DIR", "/home/pxe/image-upload")
|
|
SHARED_DIR = os.path.join(SAMBA_SHARE, "_shared")
|
|
WEB_ROOT = os.environ.get("WEB_ROOT", "/var/www/html")
|
|
BOOT_WIM = os.path.join(WEB_ROOT, "win11", "sources", "boot.wim")
|
|
AUDIT_LOG = os.environ.get("AUDIT_LOG", "/var/log/pxe-webapp-audit.log")
|
|
IMAGING_DIR = os.environ.get("IMAGING_DIR", "/var/log/pxe-imaging")
|
|
# Blancco evidence: site name stamped on reports and evidence packs, and a
|
|
# small JSON state file (cloud-upload confirmations, ServiceNow ticks) kept
|
|
# off the report share so it never shows up as a report.
|
|
BLANCCO_SITE = os.environ.get("BLANCCO_SITE", "West Jefferson")
|
|
# Every time the webapp shows (and evidence-pack month boundaries) is in
|
|
# this zone, DST included. Stored timestamps keep their own UTC offsets.
|
|
DISPLAY_TZ = os.environ.get("DISPLAY_TZ", "America/New_York")
|
|
# Hardware models seen by WinPE, checked against driver packs and BIOS.
|
|
HARDWARE_STATE = os.environ.get("HARDWARE_STATE", "/var/lib/pxe-webapp/hardware-seen.json")
|
|
BIOS_DIR = os.environ.get("BIOS_DIR", "/srv/samba/winpeapps/_shared/BIOS")
|
|
BLANCCO_STATE = os.environ.get("BLANCCO_STATE", "/var/lib/pxe-webapp/blancco-state.json")
|
|
# Clonezilla backups page settings (keep last N per machine, disk warning).
|
|
CLONEZILLA_STATE = os.environ.get("CLONEZILLA_STATE", "/var/lib/pxe-webapp/clonezilla-settings.json")
|
|
# PXE server address the Blancco preferences must point the report share at
|
|
# (blancco-init.sh greps for it too); checked when a release is staged.
|
|
BLANCCO_SERVER = os.environ.get("BLANCCO_SERVER", "172.16.9.1")
|
|
# Updates pages (Dell drivers/BIOS, iPXE): settings, staged downloads, backups.
|
|
UPDATES_DIR = os.environ.get("UPDATES_DIR", "/var/lib/pxe-webapp/updates")
|
|
TFTP_ROOT = os.environ.get("TFTP_ROOT", "/srv/tftp")
|
|
DNSMASQ_CONF = os.environ.get("DNSMASQ_CONF", "/etc/dnsmasq.conf")
|
|
# Network interfaces (Overview): the pxe-nic-check verdict file, its config,
|
|
# and dnsmasq's NIC pin (the fallback for which NIC is the imaging one).
|
|
NIC_STATUS_FILE = os.environ.get("NIC_STATUS_FILE", "/run/pxe-nic-status.json")
|
|
NIC_CONF = os.environ.get("NIC_CONF", "/etc/pxe-server/nic.conf")
|
|
DNSMASQ_NIC_CONF = os.environ.get("DNSMASQ_NIC_CONF", "/etc/dnsmasq.d/pxe-nic-only.conf")
|
|
|
|
# Log sources used by services/imaging_log_tail.py to infer client progress
|
|
# when no /imaging/status push has arrived yet. Override per-host if any of
|
|
# these live elsewhere on the live PXE server.
|
|
DNSMASQ_LEASES = os.environ.get("DNSMASQ_LEASES", "/var/lib/misc/dnsmasq.leases")
|
|
APACHE_ACCESS_LOG = os.environ.get("APACHE_ACCESS_LOG", "/var/log/apache2/access.log")
|
|
SAMBA_LOG_DIR = os.environ.get("SAMBA_LOG_DIR", "/var/log/samba")
|
|
# dnsmasq log-dhcp + TFTP requests land in syslog by default. Used to spot
|
|
# very-early boot (TFTP bootloader fetch) before Apache sees anything.
|
|
DNSMASQ_SYSLOG = os.environ.get("DNSMASQ_SYSLOG", "/var/log/syslog")
|
|
|
|
# --- Flask -------------------------------------------------------------------
|
|
FLASK_SECRET_KEY = os.environ.get("FLASK_SECRET_KEY", "pxe-manager-dev-key-change-in-prod")
|
|
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 * 1024 # 16 GB max upload
|
|
|
|
# --- Image taxonomy ----------------------------------------------------------
|
|
# Subdirs inside Deploy/ shared across ALL image types.
|
|
SHARED_DEPLOY_GLOBAL = ["Out-of-box Drivers"]
|
|
|
|
# Subdirs inside Deploy/ shared within the same image family (by prefix).
|
|
SHARED_DEPLOY_SCOPED = {
|
|
"gea-": ["Operating Systems", "Packages"],
|
|
"ge-": ["Operating Systems", "Packages"],
|
|
}
|
|
|
|
# Sibling dirs at image root shared within the same image family.
|
|
SHARED_ROOT_DIRS = {
|
|
"gea-": ["Sources"],
|
|
"ge-": ["Sources"],
|
|
}
|
|
|
|
IMAGE_TYPES = [
|
|
"gea-standard",
|
|
"gea-engineer",
|
|
"gea-shopfloor",
|
|
]
|
|
|
|
FRIENDLY_NAMES = {
|
|
"gea-standard": "GE Aerospace Standard",
|
|
"gea-engineer": "GE Aerospace Engineer",
|
|
"gea-shopfloor": "GE Aerospace Shop Floor",
|
|
}
|
|
|
|
# --- Unattend XML namespaces -------------------------------------------------
|
|
UNATTEND_NS = "urn:schemas-microsoft-com:unattend"
|
|
WCM_NS = "http://schemas.microsoft.com/WMIConfig/2002/State"
|
|
NSMAP = {None: UNATTEND_NS, "wcm": WCM_NS}
|