Fix playbooks for cross-platform compatibility and graceful error handling

- Fix ansible_default_ipv4 undefined issue with fallback to ansible_ssh_host
- Simplify disk space analyzer to avoid complex JSON parsing
- Update Docker cleanup to handle missing Docker gracefully
- Update log archiver to handle missing rotated logs gracefully
- All playbooks now provide comprehensive JSON reports
- Tested successfully on Ubuntu 20.04/22.04/24.04, Debian 11/12/13, and Alpine
This commit is contained in:
2026-01-22 11:25:44 -03:00
parent 3574b47a5f
commit 69cc8c560d
10 changed files with 821 additions and 148 deletions
@@ -0,0 +1,21 @@
---
- name: Run {{ playbook_name }}
shell: |
cd "{{ playbook_dir }}"
ansible-playbook "{{ playbook_file }}" -i "{{ inventory_file }}" -l "{{ inventory_hostname }}" 2>&1 | tee "/tmp/{{ playbook_name }}_output.log"
delegate_to: localhost
register: playbook_result
ignore_errors: yes
- name: Mark test result
set_fact:
test_results: "{{ test_results | default({}) | combine({playbook_name: {'success': playbook_result.rc == 0, 'output': playbook_result.stdout | default('')}}) }}"
delegate_to: localhost
- name: Fetch JSON reports from container
fetch:
src: "/tmp/{{ output_pattern }}"
dest: "{{ results_dir }}/{{ inventory_hostname }}_"
flat: yes
delegate_to: localhost
failed_when: no