Archived
Ajouter docs/usage.md
This commit is contained in:
1 parent
1dec2984b5
commit
bf27011cbf
1 file changed
+203
+203
@@ -0,0 +1,203 @@
|
|||||||
|
# Guide d'utilisation
|
||||||
|
|
||||||
|
## Workflow complet
|
||||||
|
|
||||||
|
### Étape 1 — Machine INFRA : créer la VM
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/ephaitek-provisioning
|
||||||
|
./scripts/infra/deploy-vm.sh --vmid <ID> --name <NOM> --vlan <N>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Exemple minimal (toutes valeurs par défaut) :**
|
||||||
|
```bash
|
||||||
|
./scripts/infra/deploy-vm.sh --vmid 1110 --name client1 --vlan 11
|
||||||
|
```
|
||||||
|
|
||||||
|
Ce qui est créé :
|
||||||
|
- IP SVC : `10.11.0.10/24`, gateway `10.11.0.1`
|
||||||
|
- IP Admin : `10.100.0.11/24` (VLAN 100)
|
||||||
|
- Port SSH : `2211`
|
||||||
|
- CPU : 4 vCPU, RAM : 8 GB, Disque : 160 Go
|
||||||
|
- Mot de passe root et deployer : `Tyujkl46`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Étape 2 — Machine ADMIN : post-provisioning
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /root/admin_tools/post-provision/scripts/admin
|
||||||
|
export VM_ROOT_PASSWORD="Tyujkl46"
|
||||||
|
./run-all.sh --vmid <ID> --name <NOM> --vlan <N>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Exemple :**
|
||||||
|
```bash
|
||||||
|
export VM_ROOT_PASSWORD="Tyujkl46"
|
||||||
|
./run-all.sh --vmid 1110 --name client1 --vlan 11
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Options de deploy-vm.sh
|
||||||
|
|
||||||
|
### Paramètres obligatoires
|
||||||
|
|
||||||
|
| Paramètre | Description |
|
||||||
|
|-----------|-------------|
|
||||||
|
| `--vmid <int>` | ID de la VM dans Proxmox |
|
||||||
|
| `--name <str>` | Hostname court (ex: `web01`, `client1`) |
|
||||||
|
| `--vlan <int>` | VLAN ID — détermine tout l'adressage |
|
||||||
|
|
||||||
|
### Personnalisation des ressources
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# VM avec plus de RAM et disque
|
||||||
|
./scripts/infra/deploy-vm.sh \
|
||||||
|
--vmid 1110 --name client1 --vlan 11 \
|
||||||
|
--memory 16384 \
|
||||||
|
--disk 320 \
|
||||||
|
--cores 8
|
||||||
|
|
||||||
|
# VM légère pour dev/test
|
||||||
|
./scripts/infra/deploy-vm.sh \
|
||||||
|
--vmid 9001 --name devbox --vlan 88 \
|
||||||
|
--cores 2 --memory 4096 --disk 80
|
||||||
|
```
|
||||||
|
|
||||||
|
### Toutes les options
|
||||||
|
|
||||||
|
| Option | Défaut | Description |
|
||||||
|
|--------|--------|-------------|
|
||||||
|
| `--cores <N>` | `4` | Nombre de vCPU |
|
||||||
|
| `--memory <MiB>` | `8192` (8GB) | RAM en MiB |
|
||||||
|
| `--disk <Go>` | `160` | Taille disque en Go |
|
||||||
|
| `--ip <CIDR>` | `10.<VLAN>.0.10/24` | IP principale |
|
||||||
|
| `--gw <IP>` | `10.<VLAN>.0.1` | Passerelle |
|
||||||
|
| `--ssh-port <N>` | `22<VLAN>` | Port SSH |
|
||||||
|
| `--admin-ip <IP>` | `10.100.0.<VLAN>` | IP réseau admin |
|
||||||
|
| `--dns <IPs>` | `8.8.8.8,1.1.1.1` | Serveurs DNS |
|
||||||
|
| `--template <ID>` | `9000` | Template Proxmox |
|
||||||
|
| `--storage <str>` | `local-lvm` | Stockage Proxmox |
|
||||||
|
| `--bridge <str>` | `vmbr1` | Bridge réseau |
|
||||||
|
| `--force` | — | Détruire si VM existe |
|
||||||
|
| `--dry-run` | — | Simulation sans création |
|
||||||
|
| `--verbose` | — | Mode verbeux (`set -x`) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Options de run-all.sh
|
||||||
|
|
||||||
|
### Paramètres obligatoires
|
||||||
|
|
||||||
|
Identiques à `deploy-vm.sh` : `--vmid`, `--name`, `--vlan`.
|
||||||
|
|
||||||
|
### Options avancées
|
||||||
|
|
||||||
|
| Option | Description |
|
||||||
|
|--------|-------------|
|
||||||
|
| `--from <N>` | Reprendre à partir de l'étape N |
|
||||||
|
| `--only <N>` | Exécuter uniquement l'étape N |
|
||||||
|
| `--dry-run` | Simulation sans modification |
|
||||||
|
|
||||||
|
### Exemples
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Lancement complet
|
||||||
|
./run-all.sh --vmid 1110 --name client1 --vlan 11
|
||||||
|
|
||||||
|
# Dry-run
|
||||||
|
./run-all.sh --vmid 1110 --name client1 --vlan 11 --dry-run
|
||||||
|
|
||||||
|
# Reprendre après une erreur à l'étape 03
|
||||||
|
./run-all.sh --vmid 1110 --name client1 --vlan 11 --from 03
|
||||||
|
|
||||||
|
# Rejouer uniquement SSSD
|
||||||
|
./run-all.sh --vmid 1110 --name client1 --vlan 11 --only 05
|
||||||
|
|
||||||
|
# Interface pfSense différente
|
||||||
|
./run-all.sh --vmid 1110 --name client1 --vlan 11 \
|
||||||
|
--parent-if vtnet0 --wan-if wan
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Description des étapes
|
||||||
|
|
||||||
|
### 01 — pfSense
|
||||||
|
**Cible :** `admin@10.11.0.1:2266`
|
||||||
|
|
||||||
|
Crée sur pfSense via `expect` :
|
||||||
|
- Interface VLAN `vtnet1.<N>` avec IP `10.<N>.0.1/24`
|
||||||
|
- Règles firewall : DNS (UDP+TCP) + WEB (80, 443)
|
||||||
|
- Reload complet via `php /etc/rc.reload_all`
|
||||||
|
|
||||||
|
### 02 — DNS
|
||||||
|
**Cible :** `root@ns1.adm:2260`
|
||||||
|
|
||||||
|
Via `expect` sur `dns1maj.sh` :
|
||||||
|
- `<nom>.svc.ephaitek.com` → `10.<VLAN>.0.10`
|
||||||
|
- `<nom>.adm.ephaitek.com` → `10.100.0.<VLAN>`
|
||||||
|
|
||||||
|
### 03 — PKI
|
||||||
|
**Cible :** `root@10.100.0.<VLAN>:<PORT>`
|
||||||
|
|
||||||
|
- Attend SSH de la VM (timeout 300s + 15s Cloud-Init)
|
||||||
|
- Copie `/root/admin_tools/pki/root.crt` vers le trust-store
|
||||||
|
- Exécute `update-ca-trust extract`
|
||||||
|
|
||||||
|
### 04 — Split DNS
|
||||||
|
**Cible :** `root@10.100.0.<VLAN>:<PORT>`
|
||||||
|
|
||||||
|
- Génère un CSV temporaire et appelle `deploy-dns-keyv3.sh`
|
||||||
|
- Configure dnsmasq avec zones ADM/SVC
|
||||||
|
- Patch TTY : contourne le `read -s` du script
|
||||||
|
|
||||||
|
### 05 — SSSD
|
||||||
|
**Cible :** `root@10.100.0.<VLAN>:<PORT>`
|
||||||
|
|
||||||
|
- Vérifie l'accès Internet avant `dnf` (3 essais)
|
||||||
|
- Installe `sssd`, `sssd-ldap`, `oddjob`, `oddjob-mkhomedir`
|
||||||
|
- Déploie `/etc/sssd/sssd.conf` (permissions `600`)
|
||||||
|
- Configure `authselect` avec profil `sssd with-mkhomedir`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Vérifications post-déploiement
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Se connecter à la VM
|
||||||
|
ssh root@10.100.0.<VLAN> -p 22<VLAN>
|
||||||
|
|
||||||
|
# PKI — CA cert importé
|
||||||
|
trust list | grep -i ephaitek
|
||||||
|
|
||||||
|
# PKI — TLS Vault fonctionnel
|
||||||
|
curl -s https://vault.adm.ephaitek.com:8200/v1/sys/health
|
||||||
|
|
||||||
|
# DNS — résolution
|
||||||
|
dig +short <nom>.svc.ephaitek.com
|
||||||
|
dig +short <nom>.adm.ephaitek.com @127.0.0.1
|
||||||
|
|
||||||
|
# SSSD — utilisateurs LDAP
|
||||||
|
id youness-adm
|
||||||
|
getent passwd youness-adm
|
||||||
|
systemctl status sssd
|
||||||
|
|
||||||
|
# Connexion SSH avec compte LDAP
|
||||||
|
ssh youness-adm@10.100.0.<VLAN> -p 22<VLAN>
|
||||||
|
# mot de passe : Admin123!
|
||||||
|
# → home dir créé automatiquement
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Logs
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Voir les logs en temps réel
|
||||||
|
tail -f /var/log/ephaitek/post-provision-*.log
|
||||||
|
|
||||||
|
# Dernier log
|
||||||
|
ls -t /var/log/ephaitek/ | head -1
|
||||||
|
```
|
||||||
Reference in new issue
Block a user