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:
Sergey Antropoff
2026-07-01 02:02:58 +03:00
commit 6f96a26bed
28 changed files with 2027 additions and 0 deletions
+46
View File
@@ -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