Upload the ansible playbook for the elk k8s stack
This commit is contained in:
38
ansible/playbooks/teardown.yml
Normal file
38
ansible/playbooks/teardown.yml
Normal 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."
|
||||
Reference in New Issue
Block a user