services:
  # PostgreSQL Datenbank für AWX
  postgres:
    image: postgres:latest
    container_name: awx_postgres
    restart: unless-stopped
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: awx
      POSTGRES_PASSWORD: 58201928alsk
      POSTGRES_DB: awx

  # Redis für AWX Caching und Messaging
  redis:
    image: redis:latest
    container_name: awx_redis
    restart: unless-stopped
    command: redis-server --appendonly yes
    volumes:
      - redis_data:/data

  # AWX Web und Task Container
  awx:
    image: quay.io/ansible/awx:latest
    container_name: awx_web
    restart: unless-stopped
    depends_on:
      - postgres
      - redis
    volumes:
      - awx_data:/var/lib/awx
      - awx_projects:/var/lib/awx/projects
      # Optional: Wenn du SSH-Keys für Git brauchst
      - ${HOME}/.ssh/id_rsa:/root/.ssh/id_rsa:ro
    environment:
      DATABASE_NAME: awx
      DATABASE_USER: awx
      DATABASE_PASSWORD: 58201928alsk
      DATABASE_HOST: postgres
      DATABASE_PORT: 5432
      REDIS_HOST: redis
      REDIS_PORT: 6379
      AWX_ADMIN_USER: admin
      AWX_ADMIN_PASSWORD: 58201928alsk
    ports:
      - "8052:8052"

volumes:
  postgres_data:
  redis_data:
  awx_data:
  awx_projects: