- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
52 lines
1.4 KiB
YAML
52 lines
1.4 KiB
YAML
---
|
|
- name: Remove WireGuard Client
|
|
hosts: vpn
|
|
become: true
|
|
gather_facts: false
|
|
|
|
vars_prompt:
|
|
- name: client_name
|
|
prompt: "Client-Name zum Entfernen"
|
|
private: false
|
|
|
|
tasks:
|
|
- name: Validiere Eingaben
|
|
fail:
|
|
msg: "client_name muss angegeben werden"
|
|
when: client_name | length == 0
|
|
|
|
- name: Prüfe ob Client existiert
|
|
stat:
|
|
path: /etc/wireguard/clients/{{ client_name }}.conf
|
|
register: client_exists
|
|
|
|
- name: Fehler wenn Client nicht existiert
|
|
fail:
|
|
msg: "Client {{ client_name }} existiert nicht!"
|
|
when: not client_exists.stat.exists
|
|
|
|
- name: Entferne Client aus Server-Konfiguration
|
|
blockinfile:
|
|
path: /etc/wireguard/wg0.conf
|
|
marker: "# {mark} {{ client_name }}"
|
|
state: absent
|
|
|
|
- name: Lösche Client-Dateien
|
|
file:
|
|
path: "{{ item }}"
|
|
state: absent
|
|
loop:
|
|
- /etc/wireguard/clients/{{ client_name }}-private.key
|
|
- /etc/wireguard/clients/{{ client_name }}-public.key
|
|
- /etc/wireguard/clients/{{ client_name }}.conf
|
|
- /etc/wireguard/clients/{{ client_name }}-psk.key
|
|
|
|
- name: Starte WireGuard neu
|
|
systemd:
|
|
name: wg-quick@wg0
|
|
state: restarted
|
|
|
|
- name: Bestätige Entfernung
|
|
debug:
|
|
msg: "✅ Client {{ client_name }} wurde erfolgreich entfernt."
|