Files
ansible-config/playbooks/monitoring/cleanup_grafana.yml

56 lines
1.2 KiB
YAML
Raw Normal View History

---
- name: Clean up Grafana completely
hosts: grafana
become: yes
tasks:
- name: Stop and disable Grafana service
systemd:
name: grafana
state: stopped
enabled: no
daemon_reload: yes
ignore_errors: yes
- name: Remove systemd service file
file:
path: /etc/systemd/system/grafana.service
state: absent
- name: Remove symlinks
file:
path: "{{ item }}"
state: absent
loop:
- /usr/local/bin/grafana-server
- /usr/local/bin/grafana-cli
- name: Remove Grafana directories
file:
path: "{{ item }}"
state: absent
loop:
- /usr/share/grafana
- /usr/share/grafana-*
- /var/lib/grafana
- /var/log/grafana
- /etc/grafana
- name: Remove temporary files
file:
path: /tmp/grafana-*.tar.gz
state: absent
- name: Remove Grafana user and group
user:
name: grafana
state: absent
remove: yes
- name: Reload systemd
systemd:
daemon_reload: yes
- name: Verify cleanup
debug:
msg: "✅ Grafana полностью удалена с хоста {{ inventory_hostname }}"