churn/ansible/cleanup.yml

42 lines
1.3 KiB
YAML
Raw Permalink Normal View History

2025-09-30 13:27:57 +01:00
---
- name: Cleanup
hosts: all
become: true
tasks:
- name: Print Dendrite process info for debugging
ansible.builtin.shell: |
echo "=== Dendrite PIDs ==="
pgrep -u {{ butter_user }} -f dendrite || echo "No dendrite PIDs found"
echo
echo "=== Full process tree of Dendrite ==="
for pid in $(pgrep -u {{ butter_user }} -f dendrite); do
echo "Process tree for PID $pid:"
pstree -p $pid || echo "pstree not available for PID $pid"
echo
done
register: dendrite_debug
when: is_vmdb2 | bool
changed_when: false
2025-09-30 13:27:57 +01:00
- name: Show debug output
ansible.builtin.debug:
2025-09-30 13:27:57 +01:00
msg: "{{ dendrite_debug.stdout_lines }}"
when: is_vmdb2 | bool
- name: Kill any running Dendrite process
ansible.builtin.shell: |
set -o pipefail && pgrep -u {{ butter_user }} -f dendrite | xargs -r kill -9
2025-09-30 13:27:57 +01:00
register: dendrite_cleanup
changed_when: dendrite_cleanup.stdout != ""
when: is_vmdb2 | bool
2025-09-30 13:27:57 +01:00
- name: Show cleanup output
ansible.builtin.debug:
msg: "{{ dendrite_cleanup.stdout_lines }}"
when: is_vmdb2 | bool
- name: Give processes time to exit
ansible.builtin.pause:
seconds: 5
2025-09-30 13:27:57 +01:00
when: is_vmdb2 | bool