Upload the ansible playbook for the elk k8s stack

This commit is contained in:
tsvetkov
2026-02-27 09:42:48 +00:00
commit 1f6e65ab7d
3 changed files with 425 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
---
# =============================================================================
# Teardown Playbook — Remove the entire ELK stack deployment
# =============================================================================
# Usage:
# ansible-playbook -i inventory/hosts.yml playbooks/teardown.yml
# =============================================================================
- name: Teardown ELK Stack
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Delete elk namespace (removes all ELK resources)
ansible.builtin.command: kubectl delete namespace elk --ignore-not-found --timeout=120s
changed_when: false
- name: Delete database namespace (removes MySQL)
ansible.builtin.command: kubectl delete namespace database --ignore-not-found --timeout=120s
changed_when: false
- name: Remove /etc/hosts entries
become: true
ansible.builtin.lineinfile:
path: /etc/hosts
regexp: '.*kibana\.elk\.local.*'
state: absent
- name: Optionally stop Minikube
ansible.builtin.command: minikube stop
ignore_errors: true
changed_when: false
when: stop_minikube | default(false) | bool
- name: Print teardown complete
ansible.builtin.debug:
msg: "ELK stack teardown complete. Run with -e stop_minikube=true to also stop Minikube."