Files
michaelschiemer/.deployment-backup/x_ansible/roles/common/tasks/main.yml
Michael Schiemer 9b74ade5b0 feat: Fix discovery system critical issues
Resolved multiple critical discovery system issues:

## Discovery System Fixes
- Fixed console commands not being discovered on first run
- Implemented fallback discovery for empty caches
- Added context-aware caching with separate cache keys
- Fixed object serialization preventing __PHP_Incomplete_Class

## Cache System Improvements
- Smart caching that only caches meaningful results
- Separate caches for different execution contexts (console, web, test)
- Proper array serialization/deserialization for cache compatibility
- Cache hit logging for debugging and monitoring

## Object Serialization Fixes
- Fixed DiscoveredAttribute serialization with proper string conversion
- Sanitized additional data to prevent object reference issues
- Added fallback for corrupted cache entries

## Performance & Reliability
- All 69 console commands properly discovered and cached
- 534 total discovery items successfully cached and restored
- No more __PHP_Incomplete_Class cache corruption
- Improved error handling and graceful fallbacks

## Testing & Quality
- Fixed code style issues across discovery components
- Enhanced logging for better debugging capabilities
- Improved cache validation and error recovery

Ready for production deployment with stable discovery system.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 12:04:17 +02:00

102 lines
2.2 KiB
YAML

---
# Common-Rolle für grundlegende Systemeinstellungen
- name: Setze globale Variablen
set_fact:
deploy_root: "{{ deploy_root | default('/var/www/michaelschiemer') }}"
deploy_user: "{{ deploy_user | default(ansible_user) }}"
app_domain: "{{ app_domain | default('localhost') }}"
tags: [always]
- name: Aktualisiere Paketindex
apt:
update_cache: yes
cache_valid_time: 3600
tags: [always]
- name: Installiere grundlegende Pakete
apt:
name:
- sudo
- vim
- htop
- git
- zip
- unzip
- curl
- wget
- net-tools
- rsync
- python3-pip
- ufw
- fail2ban
state: present
tags: [system, packages]
- name: Setze Zeitzone auf Europe/Berlin
timezone:
name: Europe/Berlin
tags: [system, timezone]
# Benutzer und Berechtigungen
- name: Stelle sicher, dass Deploy-Benutzer existiert
user:
name: "{{ deploy_user }}"
shell: /bin/bash
groups: sudo
append: yes
createhome: yes
state: present
when: deploy_user != 'root' and ansible_connection != 'local'
tags: [system, user]
- name: Stelle sicher, dass SSH-Verzeichnis existiert
file:
path: "/home/{{ deploy_user }}/.ssh"
state: directory
owner: "{{ deploy_user }}"
group: "{{ deploy_user }}"
mode: '0700'
when: deploy_user != 'root' and ansible_connection != 'local'
tags: [system, user]
- name: Konfiguriere passwordless sudo für deploy-Benutzer
lineinfile:
path: "/etc/sudoers.d/{{ deploy_user }}"
line: "{{ deploy_user }} ALL=(ALL) NOPASSWD: ALL"
state: present
create: yes
mode: '0440'
validate: 'visudo -cf %s'
become: true
when: deploy_user != 'root' and ansible_connection != 'local'
tags: [system, user]
# Firewall
- name: Öffne Ports in Firewall
ufw:
rule: allow
port: "{{ item }}"
proto: tcp
loop:
- '22' # SSH
- '80' # HTTP
- '443' # HTTPS
tags: [system, firewall]
- name: Aktiviere Firewall
ufw:
state: enabled
policy: deny
tags: [system, firewall]
# Verzeichnisse
- name: Erstelle deploy_root-Verzeichnis
file:
path: "{{ deploy_root }}"
state: directory
owner: "{{ deploy_user }}"
group: "{{ deploy_user }}"
mode: '0755'
tags: [system, directories]