Skip to content

Instantly share code, notes, and snippets.

@stanchan
Last active January 19, 2018 00:55
Show Gist options
  • Save stanchan/1e7a4e30a42eef5d4747d8cbd0d2c8ef to your computer and use it in GitHub Desktop.
Save stanchan/1e7a4e30a42eef5d4747d8cbd0d2c8ef to your computer and use it in GitHub Desktop.
Clean up Teleport
---
- hosts: teleport:teleport_auth:teleport_proxy
gather_facts: False
vars:
systemd_service_dir: /lib/systemd/system
tasks:
- name: CAUTION! WARNING! DANGER!
pause:
prompt: "You are about to wipe this teleport (There is no going back!) [Press Ctrl+C and then 'A' to abort]"
- name: Stop teleport
service:
state: stopped
name: teleport
ignore_errors: yes
- name: Kill all teleport processes
shell: pkill -f teleport
ignore_errors: yes
- name: Wipe teleport
file:
path: "/usr/local/bin/teleport"
state: absent
- name: Wipe teleport data directory
file:
path: "/var/lib/teleport"
state: absent
- name: Remove teleport openrc service
file:
dest: /etc/init.d/teleport
state: absent
when: ansible_service_mgr == "openrc"
ignore_errors: yes
- name: Remove teleport sysv service
file:
dest: /etc/init.d/teleport
state: absent
when: ansible_service_mgr == "sysvinit"
ignore_errors: yes
- name: Remove teleport systemd service
file:
dest: "{{ systemd_service_dir }}/teleport.service"
state: absent
when: ansible_service_mgr == "systemd"
ignore_errors: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment