Projekte/Ansible: Linux Server Automation

Ansible: Linux Server Automation

Automatisiertes Deployment und Konfiguration von Linux-Servern mit Ansible Playbooks.

AnsibleAutomationLinuxIaCDevOps

Tech Stack

AnsibleLinuxSSHDockerNginx

Projektziel

Automatisierung wiederkehrender Administrations-Aufgaben und standardisierte Server-Konfiguration mittels Infrastructure as Code.

Setup

  • Ansible Control Node (Ubuntu 22.04)
  • SSH Key-based Authentication
  • Inventory nach Umgebung (dev, staging, prod)
  • Ansible Vault für Secrets

Playbooks

Base Configuration

- System Updates (apt/yum)
  • Timezone & Locale
  • SSH Hardening (Key-only, Port ändern)
  • Firewall (ufw) Basis-Regeln
  • Fail2ban Installation
  • NTP Client
  • Monitoring Agent (Zabbix)

Webserver Role

- Nginx Installation
  • SSL via Let's Encrypt (certbot)
  • Virtual Hosts aus Variablen
  • PHP-FPM (optional)
  • Log Rotation

Database Role

- PostgreSQL / MariaDB
  • Datenbank & User anlegen
  • Remote Access konfigurieren
  • Backup-Cron-Job

Docker Host Role

- Docker Engine + Compose
  • User zu docker-Gruppe
  • Daemon.json (Logging, Registry)

Inventory Struktur

inventory/
├── group_vars/
│   ├── all.yml
│   ├── webservers.yml
│   └── databases.yml
├── host_vars/
│   └── server01.yml
└── hosts.ini

Automation Workflow

1. Neuer Server wird in Proxmox deployed (Template) 2. Ansible Play: base_config (Hardening, Updates) 3. Ansible Play: service_specific (Web/DB/Docker) 4. Monitoring Agent wird registriert 5. Backup-Job wird konfiguriert

Learnings

  • Ansible Roles und Galaxy
  • Idempotenz sicherstellen
  • Ansible Vault für Passwörter
  • Tags für selektive Ausführung
  • Error Handling & Rollback
Zurück zur Übersicht