39 lines
1.3 KiB
YAML
39 lines
1.3 KiB
YAML
---
|
|
# =============================================================================
|
|
# 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."
|