feat: add setup-host-linux.sh script for CI host bootstrap and update Phase B checklist

This commit is contained in:
2026-05-20 22:13:37 +02:00
parent 573d11691d
commit b9d6994c85
4 changed files with 506 additions and 41 deletions
+28 -41
View File
@@ -24,9 +24,9 @@ nuovo host **Linux Mint LTS** con VMware Workstation Pro Linux.
**Obiettivo**: hardware target con Linux Mint LTS, VMware Workstation
Pro Linux, layout storage e venv Python pronti.
- [ ] Installare Linux Mint LTS sull'hardware target.
- [ ] `sudo apt update && sudo apt full-upgrade -y && sudo reboot`
- [ ] Scaricare e installare VMware Workstation Pro Linux (bundle
- [x] Installare Linux Mint LTS sull'hardware target.
- [x] `sudo apt update && sudo apt full-upgrade -y && sudo reboot`
- [x] Scaricare e installare VMware Workstation Pro Linux (bundle
`.bundle` da Broadcow):
```bash
@@ -34,56 +34,43 @@ Pro Linux, layout storage e venv Python pronti.
vmrun -T ws --version # deve ritornare versione coerente
```
- [ ] Smoke test Workstation (UI): creare VM trivia, clone, start,
- [x] Smoke test Workstation (UI): creare VM trivia, clone, start,
stop, delete.
- [ ] Configurare `vmnet8` NAT range `192.168.79.0/24` (allineato a
- [x] Configurare `vmnet8` NAT range `192.168.79.0/24` (allineato a
Windows) editando `/etc/vmware/vmnet8/dhcpd/dhcpd.conf` o via
`vmware-netcfg`.
- [ ] Creare utente di servizio `ci-runner`:
- [x] Creare utente di servizio `ci-runner`:
```bash
sudo useradd -r -m -s /bin/bash ci-runner
```
- [ ] Creare layout storage:
- [x] Eseguire `setup-host-linux.sh` (copre mount disco, layout, Python venv,
clone repo, PowerShell Core):
```bash
sudo mkdir -p /var/lib/ci/{build-vms,artifacts,templates,keys}
sudo chown -R ci-runner:ci-runner /var/lib/ci
sudo chmod 750 /var/lib/ci /var/lib/ci/*
sudo setfacl -d -m u:ci-runner:rwX /var/lib/ci/build-vms
# Clonare il repo prima di eseguire lo script
git clone https://gitea.emulab.it/Simone/local-ci-cd-system.git /tmp/local-ci-cd-system
sudo bash /tmp/local-ci-cd-system/setup-host-linux.sh -d /dev/sdf1
```
- [ ] Installare Python 3.11+ e creare venv produzione:
Lo script:
- Monta `/dev/sdf1` su `/var/lib/ci` via fstab (boot automatico).
Se la partizione ha una sottocartella `ci/`, ne sposta i contenuti
alla root della partizione prima del mount definitivo.
- Crea il layout `build-vms/`, `artifacts/`, `templates/`, `keys/`,
`logs/`, `runner/` con permessi e ACL corretti.
- Installa Python 3.11, crea `/opt/ci/venv`, clona il repo in
`/opt/ci/local-ci-cd-system` e installa il package.
- Installa PowerShell Core.
Flag utili se alcune dipendenze sono già presenti:
```bash
sudo apt install -y python3.11 python3.11-venv git
sudo mkdir -p /opt/ci
sudo python3.11 -m venv /opt/ci/venv
sudo chown -R ci-runner:ci-runner /opt/ci
sudo bash setup-host-linux.sh -d /dev/sdf1 --skip-pwsh --skip-clone
```
- [ ] Clonare il repo e installare il package nel venv:
```bash
sudo -u ci-runner git clone https://gitea.emulab.it/Simone/local-ci-cd-system.git /opt/ci/local-ci-cd-system
sudo -u ci-runner /opt/ci/venv/bin/pip install -e /opt/ci/local-ci-cd-system
sudo -u ci-runner /opt/ci/venv/bin/python -m ci_orchestrator --help
```
Atteso: lista degli 11 sub-comandi.
- [ ] Installare PowerShell Core (richiesto da `Invoke-RetentionPolicy.ps1`
e `Backup-CITemplate.ps1`):
```bash
sudo apt install -y wget apt-transport-https software-properties-common
source /etc/os-release
wget -q https://packages.microsoft.com/config/ubuntu/${VERSION_ID}/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt update && sudo apt install -y powershell
pwsh --version
```
Atteso a fine script: `ci_orchestrator --help` lista gli 11 sub-comandi.
---
@@ -103,7 +90,7 @@ Pro Linux, layout storage e venv Python pronti.
# atteso: nessun risultato
```
- [ ] Sull'host Linux, eseguire rsync via SSH dall'host Windows
- [x] Sull'host Linux, eseguire rsync via SSH dall'host Windows
(richiede OpenSSH Server attivo su Windows o, in alternativa,
`scp -r` lanciato da Windows verso Linux):
@@ -113,7 +100,7 @@ Pro Linux, layout storage e venv Python pronti.
/var/lib/ci/templates/
```
- [ ] Validare integrità snapshot:
- [x] Validare integrità snapshot:
```bash
find /var/lib/ci/templates -name '*.vmx' -exec vmrun -T ws listSnapshots {} \;
@@ -122,7 +109,7 @@ Pro Linux, layout storage e venv Python pronti.
Atteso: `BaseClean` su `WinBuild2025.vmx` e `WinBuild2022.vmx`,
`BaseClean-Linux` su `LinuxBuild2404.vmx`.
- [ ] Aprire ciascun `.vmx` su Workstation Linux per registrarli;
- [x] Aprire ciascun `.vmx` su Workstation Linux per registrarli;
al prompt rispondere "**I copied it**".
- [ ] Smoke test pipeline VM:
@@ -466,7 +453,7 @@ vedi Passo 9: host Windows mantenuto in permanenza.)
| Passo | Step | Descrizione | Stato |
| ----- | ---- | -------------------------------------------------- | ----- |
| 1 | B1 | Setup host Linux Mint (OS, Workstation, venv, ACL) | [ ] |
| 1 | B1 | Setup host Linux Mint (OS, Workstation, venv, ACL) | [x] |
| 2 | B2 | Trasferimento template VM + smoke `vm new` | [ ] |
| 3 | B3 | Chiavi SSH + keyring (PoC headless) | [ ] |
| 4 | B4 | act_runner systemd service registrato | [ ] |