fix: пересборка output/index.html при uninstall с LIMIT
Второй play перенесён на hysteria2_servers с run_once на localhost, чтобы LIMIT не пропускал пересборку. Пустой index.html удаляется. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -276,7 +276,8 @@ hysteria2_user_passwords:
|
|||||||
На **control node**:
|
На **control node**:
|
||||||
|
|
||||||
- удаляется `output/<имя_сервера>/`;
|
- удаляется `output/<имя_сервера>/`;
|
||||||
- пересобирается общий `output/index.html`.
|
- пересобирается общий `output/index.html` (сервер убирается из списка; при `LIMIT=...` тоже);
|
||||||
|
- если серверов не осталось — `output/index.html` удаляется.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+13
-8
@@ -10,14 +10,19 @@
|
|||||||
tasks_from: uninstall.yml
|
tasks_from: uninstall.yml
|
||||||
|
|
||||||
- name: Rebuild global output index after uninstall
|
- name: Rebuild global output index after uninstall
|
||||||
hosts: localhost
|
hosts: hysteria2_servers
|
||||||
connection: local
|
gather_facts: false
|
||||||
gather_facts: true
|
|
||||||
become: false
|
|
||||||
tags: [uninstall]
|
tags: [uninstall]
|
||||||
tasks:
|
tasks:
|
||||||
- name: Regenerate output/index.html from remaining servers
|
- name: Regenerate output/index.html without removed server
|
||||||
ansible.builtin.include_role:
|
block:
|
||||||
name: hysteria2
|
- name: Run global export tasks
|
||||||
tasks_from: export_global.yml
|
ansible.builtin.include_role:
|
||||||
|
name: hysteria2
|
||||||
|
tasks_from: export_global.yml
|
||||||
|
vars:
|
||||||
|
hysteria2_open_browser: false
|
||||||
|
run_once: true
|
||||||
|
delegate_to: localhost
|
||||||
|
become: false
|
||||||
when: hysteria2_uninstall_rebuild_global_index | default(true) | bool
|
when: hysteria2_uninstall_rebuild_global_index | default(true) | bool
|
||||||
|
|||||||
@@ -54,6 +54,13 @@
|
|||||||
when: hysteria2_global_servers | default([]) | length > 0
|
when: hysteria2_global_servers | default([]) | length > 0
|
||||||
become: false
|
become: false
|
||||||
|
|
||||||
|
- name: Remove global HTML index when no servers remain
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ hysteria2_output_dir }}/index.html"
|
||||||
|
state: absent
|
||||||
|
when: hysteria2_global_servers | default([]) | length == 0
|
||||||
|
become: false
|
||||||
|
|
||||||
- name: Open global index in default browser (macOS)
|
- name: Open global index in default browser (macOS)
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: open "{{ hysteria2_output_dir }}/index.html"
|
cmd: open "{{ hysteria2_output_dir }}/index.html"
|
||||||
@@ -85,6 +92,6 @@
|
|||||||
|
|
||||||
- name: Skip global index when no servers exported
|
- name: Skip global index when no servers exported
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Глобальный index.html не создан — нет server-info.yml в {{ hysteria2_output_dir }}/"
|
msg: "Глобальный {{ hysteria2_output_dir }}/index.html удалён — нет server-info.yml в output/"
|
||||||
when: hysteria2_global_servers | default([]) | length == 0
|
when: hysteria2_global_servers | default([]) | length == 0
|
||||||
become: false
|
become: false
|
||||||
|
|||||||
@@ -133,5 +133,5 @@
|
|||||||
Hysteria2 полностью удалён с {{ inventory_hostname }}.
|
Hysteria2 полностью удалён с {{ inventory_hostname }}.
|
||||||
Локальная папка {{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/ удалена.
|
Локальная папка {{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/ удалена.
|
||||||
{% if hysteria2_uninstall_rebuild_global_index | default(true) | bool %}
|
{% if hysteria2_uninstall_rebuild_global_index | default(true) | bool %}
|
||||||
Глобальный {{ hysteria2_output_dir }}/index.html будет пересобран.
|
{{ hysteria2_output_dir }}/index.html будет пересобран без этого сервера.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user