Initial commit: Ansible role for Hysteria2 VPN server deployment.
Includes install/update/uninstall playbooks, Makefile, vault-based SSH credentials, per-server and global HTML export with QR codes.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
---
|
||||
- name: Stop and disable hysteria-server
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ hysteria2_service_name }}"
|
||||
enabled: false
|
||||
state: stopped
|
||||
failed_when: false
|
||||
|
||||
- name: Remove Hysteria2 via official script
|
||||
ansible.builtin.shell:
|
||||
cmd: bash <(curl -fsSL https://get.hy2.sh/) --remove
|
||||
executable: /bin/bash
|
||||
register: _hysteria2_remove
|
||||
failed_when: false
|
||||
|
||||
- name: Remove Hysteria2 configuration directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ hysteria2_config_path | dirname }}"
|
||||
state: absent
|
||||
when: hysteria2_uninstall_remove_config | bool
|
||||
|
||||
- name: Remove masquerade web directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ hysteria2_masq_dir }}"
|
||||
state: absent
|
||||
when: hysteria2_uninstall_remove_masq | bool
|
||||
|
||||
- name: Reload systemd after uninstall
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
|
||||
- name: Show uninstall result
|
||||
ansible.builtin.debug:
|
||||
msg: >-
|
||||
Hysteria2 удалён с {{ inventory_hostname }}.
|
||||
{% if not hysteria2_uninstall_remove_local_output | bool %}
|
||||
Локальные URL/QR в {{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/ сохранены.
|
||||
{% endif %}
|
||||
|
||||
- name: Remove local exported client files
|
||||
ansible.builtin.file:
|
||||
path: "{{ hysteria2_output_dir }}/{{ hysteria2_output_name }}"
|
||||
state: absent
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
when: hysteria2_uninstall_remove_local_output | bool
|
||||
Reference in New Issue
Block a user