# Préparation

### Prérequis

- Serveur Rocky Linux 9 avec au moins 4 Go de RAM et 2 vCPUs
- Accès root
- Nom de domaine configuré : foreman.mondomaine.com
- Firewall configuré pour autoriser les ports nécessaires

### Checklist avant de commencer

- [ ] **Serveur HAProxy** : IP = `<IP_HAPROXY>` (serveur mutualisé séparé)
- [ ] **Serveur Foreman** : IP = `<IP_SERVEUR_FOREMAN>`
- [ ] Les deux serveurs peuvent communiquer entre eux
- [ ] DNS configuré : `foreman.mondomaine.com` → `<IP_HAPROXY>`
- [ ] Certificats SSL disponibles (ou génération prévue)
- [ ]  Accès root sur les deux serveurs

### Informations à préparer

<div class="overflow-x-auto w-full px-2 mb-6" id="bkmrk-information-valeur-%C3%A0"><table class="min-w-full border-collapse text-sm leading-[1.7] whitespace-normal" style="height: 217px; width: 62.381%;"><thead class="text-left"><tr><th class="text-text-100 border-b-0.5 border-border-300/60 py-2 pr-4 align-top font-bold" style="width: 49.9237%;">Information</th><th class="text-text-100 border-b-0.5 border-border-300/60 py-2 pr-4 align-top font-bold" style="width: 49.9237%;">Valeur à renseigner</th></tr></thead><tbody><tr><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">IP HAProxy</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">`<IP_HAPROXY>`</td></tr><tr><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">IP Foreman</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">`<IP_SERVEUR_FOREMAN>`</td></tr><tr><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">Nom de domaine</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">`foreman.mondomaine.com`</td></tr><tr><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">Organisation</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">`MonOrganisation`</td></tr><tr><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">Location</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">`MonDatacenter`</td></tr><tr><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">Mot de passe admin Foreman</td><td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top" style="width: 49.9237%;">`MotDePasseSecurise`</td></tr></tbody></table>

</div>### Architecture

- **Serveur HAProxy** (serveur mutualisé séparé) : Frontend (ports 443 et 8443)
- **Serveur Foreman** : Backend (ports 80, 8443, 8140)
- Interface Web : [https://foreman.mondomaine.com](https://foreman.mondomaine.com) (HAProxy → Foreman:80)
- Smart Proxy : [https://foreman.mondomaine.com:8443](https://foreman.mondomaine.com:8443) (HAProxy → Foreman:8443)

**Important** : HAProxy et Foreman sont sur des serveurs distincts. HAProxy agit comme reverse proxy SSL/TLS et redirige le trafic vers le serveur Foreman backend.

### Schéma de l'architecture

```
                                    ┌─────────────────────────┐
                                    │   Clients / Agents      │
                                    │   Puppet & Browsers     │
                                    └───────────┬─────────────┘
                                                │
                                                │ HTTPS (443, 8443)
                                                │ TCP (8140 optionnel)
                                                ▼
                                    ┌─────────────────────────┐
                                    │   Serveur HAProxy       │
                                    │   (Mutualisé/Séparé)    │
                                    │                         │
                                    │  - Port 443  → WebUI    │
                                    │  - Port 8443 → Proxy    │
                                    │  - Port 8140 → Puppet   │
                                    └───────────┬─────────────┘
                                                │
                      ┌─────────────────────────┼─────────────────────────┐
                      │ HTTP (80)               │ HTTPS (8443)            │ TCP (8140)
                      ▼                         ▼                         ▼
          ┌───────────────────┐   ┌───────────────────┐   ┌───────────────────┐
          │  Apache/Foreman   │   │   Smart Proxy     │   │   Puppet Server   │
          │  (Port 80)        │   │   (Port 8443)     │   │   (Port 8140)     │
          └───────────────────┘   └───────────────────┘   └───────────────────┘
                      ▲                         ▲                         ▲
                      └─────────────────────────┴─────────────────────────┘
                                  Serveur Foreman Backend
                                  (IP : <IP_SERVEUR_FOREMAN>)
```

### Flux de communication

1. **WebUI** : Client → HAProxy:443 (HTTPS) → Foreman:80 (HTTP)
2. **Smart Proxy** : Client → HAProxy:8443 (HTTPS) → Foreman:8443 (HTTPS)
3. **Puppet** : Agent → HAProxy:8140 (TCP) → Foreman:8140 (TCP) OU Agent → Direct Foreman:8140