94 lines
2.0 KiB
Markdown
94 lines
2.0 KiB
Markdown
# PLAYBOOK POUR CONFIGURER UN SERVER DU GARAGE
|
|
|
|
Projet qui vise à automatiser l'installation et la configuration d'une machine serveur du garage sous Linux Debian.
|
|
|
|
## PAQUETS / TASKS
|
|
|
|
- Tasks:
|
|
- apt_update.yml
|
|
- basic_install.yml
|
|
- create_workspace.yml
|
|
- nginx.yml
|
|
- docker.yml
|
|
- certbot.yml
|
|
- clamav
|
|
- fail2ban.yml
|
|
- ufw.yml
|
|
- ssh.yml
|
|
|
|
- Dépendances:
|
|
- rsyslog
|
|
- wget
|
|
- curl
|
|
- git
|
|
- vim
|
|
- htop
|
|
- btop
|
|
- net-tools
|
|
- unzip
|
|
- gnupg
|
|
- lsb-release
|
|
- ca-certificates
|
|
- software-properties-common
|
|
- apt-transport-https
|
|
- bash-completion
|
|
|
|
- Services:
|
|
- git
|
|
- nginx
|
|
- docker
|
|
- docker-compose
|
|
- fail2ban
|
|
- ufw
|
|
- clamAV
|
|
|
|
## PRE REQUIS
|
|
|
|
- Debian 13
|
|
|
|
- Accès au serveur en ssh (username sudo, password)
|
|
|
|
- Ansible:
|
|
|
|
```bash
|
|
sudo apt install ansible -y
|
|
```
|
|
|
|
## CONFIGURATION
|
|
|
|
- Editer le fichier `vars.yml` et renseigner le `user`, `ssh_port`, `admin_password` et l'`admin_email`
|
|
|
|
```bash
|
|
# Générer l'admin password:
|
|
python3 -c "import crypt; print(crypt.crypt('monmotdepasse', crypt.mksalt(crypt.METHOD_SHA512)))"
|
|
```
|
|
> Remplacer `monmotdepasse` par le mot de passe voulu
|
|
|
|
- Ajouter une clé SSH `~/.ssh/id_ed25519.pub` dans le dossier `files/`
|
|
|
|
> Cette clé permettra l'accès au serveur une fois le playbook terminé
|
|
|
|
## UTILISATION
|
|
|
|
- échanger sa clef ssh avec la machine cible avec la commande:
|
|
```bash
|
|
ssh-copy-id username@ip-machine-cible
|
|
```
|
|
|
|
- Lançer la commande avec les paramètres modifiés pour username, password et ssh_port
|
|
```bash
|
|
ansible-playbook -i hosts playbook.yml --user=username --extra-vars "ansible_sudo_pass=password user=username ssh_port=2222"
|
|
```
|
|
> ssh_port changera le port de connection ssh de la machine cible
|
|
|
|
:bulb: Idéalement, une clé SSH est déjà ajoutée au serveur lors de la création (VPS cloud)
|
|
|
|
## DOCUMENTATION
|
|
|
|
- [Ansible](https://docs.ansible.com/ansible/latest/index.html)
|
|
- [Debian](https://wiki.debian.org/fr/SystemAdministration)
|
|
|
|
## TO DO
|
|
|
|
- [x] update sources.list for Debian 13
|
|
- [x] test |