198 lines
3.4 KiB
Markdown
198 lines
3.4 KiB
Markdown
|
|
# Mise à jour pour Codex et Claude Code — Set-OPS
|
|||
|
|
|
|||
|
|
## État du dépôt
|
|||
|
|
|
|||
|
|
`Set-OPS` est le dépôt Ansible global d’exploitation de Chezlepro Inc.
|
|||
|
|
|
|||
|
|
Il ne sert pas seulement à créer un template Proxmox. Il doit contenir progressivement les playbooks, rôles, inventaires et templates nécessaires à tous les systèmes de Chezlepro Inc.
|
|||
|
|
|
|||
|
|
Le chantier en cours est le template Debian 13 Proxmox.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Fichiers de gouvernance
|
|||
|
|
|
|||
|
|
Les fichiers suivants doivent être lus avant toute modification :
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
AGENTS.md
|
|||
|
|
CLAUDE.md
|
|||
|
|
README.md
|
|||
|
|
CHANGELOG.md
|
|||
|
|
ansible.cfg
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
`AGENTS.md` est la source d’autorité principale.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## État fonctionnel visé pour le template Debian 13
|
|||
|
|
|
|||
|
|
Le template Debian 13 Proxmox doit contenir :
|
|||
|
|
|
|||
|
|
- Debian minimal ;
|
|||
|
|
- SSH ;
|
|||
|
|
- sudo ;
|
|||
|
|
- compte `ansible` ;
|
|||
|
|
- sudo NOPASSWD pour `ansible` ;
|
|||
|
|
- `qemu-guest-agent` ;
|
|||
|
|
- `cloud-init` ;
|
|||
|
|
- `cloud-guest-utils` ;
|
|||
|
|
- chrony ;
|
|||
|
|
- outils de diagnostic ;
|
|||
|
|
- AppArmor ;
|
|||
|
|
- auditd ;
|
|||
|
|
- fail2ban SSH ;
|
|||
|
|
- unattended-upgrades ;
|
|||
|
|
- journald ;
|
|||
|
|
- sysctl de sécurité ;
|
|||
|
|
- nftables installé et préparé, mais désactivé par défaut.
|
|||
|
|
|
|||
|
|
Il ne doit pas contenir :
|
|||
|
|
|
|||
|
|
- NGINX ;
|
|||
|
|
- PostgreSQL ;
|
|||
|
|
- MariaDB ;
|
|||
|
|
- Docker ;
|
|||
|
|
- Podman ;
|
|||
|
|
- Redis ;
|
|||
|
|
- GitLab ;
|
|||
|
|
- Nextcloud ;
|
|||
|
|
- monitoring complet ;
|
|||
|
|
- secrets ;
|
|||
|
|
- clés privées ;
|
|||
|
|
- données propres à un clone.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Incident récent à corriger
|
|||
|
|
|
|||
|
|
Le playbook :
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
playbooks/vm_templates/debian13_proxmox_prepare.yml
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
a échoué sur un handler manquant :
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
ERROR! The requested handler 'Validate and reload ssh' was not found
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Le problème est relié à des rôles contenant :
|
|||
|
|
|
|||
|
|
```yaml
|
|||
|
|
notify: Validate and reload ssh
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
sans handler local correspondant.
|
|||
|
|
|
|||
|
|
Rôles à vérifier en priorité :
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
roles/ssh_baseline/
|
|||
|
|
roles/ssh_hardening/
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Chaque rôle utilisant `notify` doit avoir son propre fichier :
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
roles/<role>/handlers/main.yml
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Correctif minimal attendu
|
|||
|
|
|
|||
|
|
Ne pas régénérer tout le dépôt.
|
|||
|
|
|
|||
|
|
Créer ou corriger :
|
|||
|
|
|
|||
|
|
```text
|
|||
|
|
roles/ssh_baseline/handlers/main.yml
|
|||
|
|
roles/ssh_hardening/handlers/main.yml
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Contenu attendu :
|
|||
|
|
|
|||
|
|
```yaml
|
|||
|
|
---
|
|||
|
|
- name: Validate and reload ssh
|
|||
|
|
block:
|
|||
|
|
- name: Valider la configuration SSH
|
|||
|
|
ansible.builtin.command: sshd -t
|
|||
|
|
changed_when: false
|
|||
|
|
|
|||
|
|
- name: Recharger SSH
|
|||
|
|
ansible.builtin.systemd:
|
|||
|
|
name: ssh
|
|||
|
|
state: reloaded
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Puis vérifier tous les `notify` :
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
find roles -path '*/tasks/*.yml' -exec grep -H "notify:" {} \;
|
|||
|
|
find roles -path '*/handlers/main.yml' -print
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Validation obligatoire
|
|||
|
|
|
|||
|
|
Après correction :
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ansible-playbook -i inventories/lab/hosts.yml playbooks/vm_templates/debian13_proxmox_prepare.yml --syntax-check
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Puis relancer :
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ansible-playbook -i inventories/lab/hosts.yml playbooks/vm_templates/debian13_proxmox_prepare.yml
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Puis vérifier :
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ansible-playbook -i inventories/lab/hosts.yml playbooks/vm_templates/debian13_proxmox_verify.yml
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Nettoyage final
|
|||
|
|
|
|||
|
|
Ne lancer le nettoyage final que lorsque la VM est validée :
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
ansible-playbook -i inventories/lab/hosts.yml playbooks/vm_templates/debian13_proxmox_cleanup.yml -e confirm_template_cleanup=true
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Ensuite seulement :
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
sudo shutdown -h now
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Puis côté Proxmox :
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
qm template VMID
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Règle de conduite
|
|||
|
|
|
|||
|
|
Ne pas faire de régénération massive.
|
|||
|
|
|
|||
|
|
Lire l’existant.
|
|||
|
|
|
|||
|
|
Corriger petit.
|
|||
|
|
|
|||
|
|
Valider.
|
|||
|
|
|
|||
|
|
Mettre à jour `CHANGELOG.md`.
|
|||
|
|
|
|||
|
|
Résumer clairement ce qui a été fait et ce qui n’a pas été testé.
|