Compare commits

..

4 Commits

Author SHA1 Message Date
Sergey Antropoff a79ce46457 fix: пересборка output/index.html при uninstall с LIMIT
Второй play перенесён на hysteria2_servers с run_once на localhost,
чтобы LIMIT не пропускал пересборку. Пустой index.html удаляется.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 13:31:40 +03:00
Sergey Antropoff 45f0682d8b Полная очистка при uninstall: VPS и output/<server>/
Скрипт --remove снимает только бинарник и systemd; Ansible дочищает конфиг,
пользователя, ufw, пакеты и всегда удаляет локальную папку экспорта.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 13:28:00 +03:00
Sergey Antropoff 27ae65edc5 fix: run only uninstall tasks, not full role on make uninstall
Tagging the whole role with uninstall caused install/configure/update/export to run first. Use include_role tasks_from uninstall.yml; add safe defaults for uninstall variables.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 13:19:47 +03:00
Sergey Antropoff 05994fceaf docs: update README for install script, update, uninstall and users
Document incremental export, full uninstall cleanup, vault wiring, Makefile commands and role structure.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 13:15:24 +03:00
2 changed files with 10 additions and 76 deletions
-21
View File
@@ -81,12 +81,10 @@ make install # → output/index.html откроется в браузере
```bash ```bash
make install LIMIT=vps-de make install LIMIT=vps-de
make install LIMIT=vps-nl # только новый сервер — старые не трогаются
make update LIMIT=vps-nl make update LIMIT=vps-nl
make export make export
make uninstall LIMIT=vps-de make uninstall LIMIT=vps-de
make update EXTRA_VARS='hysteria2_force_export=true' # перевыпустить URL/QR для всех make update EXTRA_VARS='hysteria2_force_export=true' # перевыпустить URL/QR для всех
make install EXTRA_VARS='hysteria2_force_export=true' # то же при install
make install EXTRA_VARS='hysteria2_open_browser=false' make install EXTRA_VARS='hysteria2_open_browser=false'
make update EXTRA_VARS='hysteria2_wait_for_acme=false' make update EXTRA_VARS='hysteria2_wait_for_acme=false'
``` ```
@@ -225,25 +223,6 @@ hysteria2_user_passwords:
Принудительно перевыпустить URL/QR для всех: `hysteria2_force_export: true``group_vars/all.yml` или `EXTRA_VARS`). Принудительно перевыпустить URL/QR для всех: `hysteria2_force_export: true``group_vars/all.yml` или `EXTRA_VARS`).
```bash
make install EXTRA_VARS='hysteria2_force_export=true'
make update LIMIT=vps-de EXTRA_VARS='hysteria2_force_export=true'
```
### Добавить второй VPS
После `make install` на первом сервере можно добавить ещё один хост в `inventory/hosts.yml`.
**Без `LIMIT`** `make install` пройдёт по **всем** серверам из inventory. На уже установленном пароли и файлы URL/QR **не перегенерируются** (берутся из `output/<server>/server-info.yml`), если вы не меняли его `hysteria2_users`, домен или порт.
Чтобы **не трогать** уже работающий VPS и экспорт:
```bash
make install LIMIT=новый-сервер
```
`LIMIT` — имя нового хоста из inventory (например `vps-nl`).
### Добавить / удалить пользователя ### Добавить / удалить пользователя
1. Отредактируйте `hysteria2_users` в `inventory/hosts.yml` (добавьте имя или уберите). 1. Отредактируйте `hysteria2_users` в `inventory/hosts.yml` (добавьте имя или уберите).
+7 -52
View File
@@ -14,19 +14,10 @@
dest: "{{ hysteria2_install_script_staging_dir }}/{{ hysteria2_install_script_name }}.remote" dest: "{{ hysteria2_install_script_staging_dir }}/{{ hysteria2_install_script_name }}.remote"
mode: "0644" mode: "0644"
force: true force: true
timeout: 30
delegate_to: localhost delegate_to: localhost
become: false become: false
run_once: true run_once: true
register: _hysteria2_remote_script register: _hysteria2_remote_script
failed_when: false
- name: Record install script fetch result
ansible.builtin.set_fact:
_hysteria2_script_fetch_ok: "{{ not (_hysteria2_remote_script.failed | default(false)) }}"
delegate_to: localhost
become: false
run_once: true
- name: Stat local install script in role files - name: Stat local install script in role files
ansible.builtin.stat: ansible.builtin.stat:
@@ -45,7 +36,6 @@
become: false become: false
run_once: true run_once: true
register: _hysteria2_remote_script_stat register: _hysteria2_remote_script_stat
when: _hysteria2_script_fetch_ok | bool
- name: Update bundled install script when official version is newer - name: Update bundled install script when official version is newer
ansible.builtin.copy: ansible.builtin.copy:
@@ -55,55 +45,20 @@
delegate_to: localhost delegate_to: localhost
become: false become: false
run_once: true run_once: true
when: when: >-
- _hysteria2_script_fetch_ok | bool
- >-
not _hysteria2_local_script.stat.exists not _hysteria2_local_script.stat.exists
or _hysteria2_local_script.stat.checksum or _hysteria2_local_script.stat.checksum
!= _hysteria2_remote_script_stat.stat.checksum != _hysteria2_remote_script_stat.stat.checksum
register: _hysteria2_script_updated register: _hysteria2_script_updated
- name: Fail when bundled install script is missing and official fetch failed - name: Report install script sync result
ansible.builtin.fail:
msg: >-
Не удалось скачать {{ hysteria2_install_script_url }}
({{ _hysteria2_remote_script.msg | default('сеть недоступна') }})
и локальный roles/hysteria2/files/{{ hysteria2_install_script_name }} отсутствует.
delegate_to: localhost
become: false
run_once: true
when:
- not _hysteria2_script_fetch_ok | bool
- not _hysteria2_local_script.stat.exists
- name: Report install script sync skipped due to network error
ansible.builtin.debug: ansible.builtin.debug:
msg: >- msg: >-
Пропуск синхронизации с {{ hysteria2_install_script_url }}: {{
{{ _hysteria2_remote_script.msg | default('сеть недоступна') }}. 'Официальный install_server.sh обновлён в roles/hysteria2/files/'
Используется локальный roles/hysteria2/files/{{ hysteria2_install_script_name }}. if (_hysteria2_script_updated.changed | default(false))
else 'Локальный install_server.sh актуален (совпадает с ' ~ hysteria2_install_script_url ~ ')'
}}
delegate_to: localhost delegate_to: localhost
become: false become: false
run_once: true run_once: true
when: not _hysteria2_script_fetch_ok | bool
- name: Report install script updated from official server
ansible.builtin.debug:
msg: Официальный install_server.sh обновлён в roles/hysteria2/files/
delegate_to: localhost
become: false
run_once: true
when:
- _hysteria2_script_fetch_ok | bool
- _hysteria2_script_updated.changed | default(false)
- name: Report install script already up to date
ansible.builtin.debug:
msg: >-
Локальный install_server.sh актуален (совпадает с {{ hysteria2_install_script_url }}).
delegate_to: localhost
become: false
run_once: true
when:
- _hysteria2_script_fetch_ok | bool
- not (_hysteria2_script_updated.changed | default(false))