bdb35894b4
По умолчанию — Статистика: доступность TCP, IP, пользователи, матрица присутствия. Серверы открываются отдельными вкладками.
80 lines
2.7 KiB
YAML
80 lines
2.7 KiB
YAML
---
|
|
- name: Create local output directory for this server
|
|
ansible.builtin.file:
|
|
path: "{{ hysteria2_output_dir }}/{{ hysteria2_output_name }}"
|
|
state: directory
|
|
mode: "0700"
|
|
delegate_to: localhost
|
|
become: false
|
|
|
|
- name: Initialize export users list
|
|
ansible.builtin.set_fact:
|
|
hysteria2_export_users: []
|
|
|
|
- name: Prepare incremental export (remove deleted users, split new vs existing)
|
|
ansible.builtin.import_tasks: export_prepare.yml
|
|
|
|
- name: Install qrencode on server for PNG QR export
|
|
ansible.builtin.apt:
|
|
name: qrencode
|
|
state: present
|
|
update_cache: false
|
|
when:
|
|
- hysteria2_generate_qr_png | bool
|
|
- hysteria2_users_for_export | default([]) | length > 0
|
|
|
|
- name: Reuse existing export data for unchanged users
|
|
ansible.builtin.include_tasks: reuse_export_user.yml
|
|
loop: "{{ hysteria2_users_for_reuse | default([]) }}"
|
|
loop_control:
|
|
loop_var: hysteria2_reuse_user
|
|
label: "{{ hysteria2_reuse_user.name }}"
|
|
|
|
- name: Build client share data for new or changed users
|
|
ansible.builtin.include_tasks: share_user.yml
|
|
loop: "{{ hysteria2_users_for_export | default([]) }}"
|
|
loop_control:
|
|
loop_var: hysteria2_current_user
|
|
label: "{{ hysteria2_current_user.name }}"
|
|
|
|
- name: Save server summary locally
|
|
ansible.builtin.copy:
|
|
dest: "{{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/server-info.yml"
|
|
mode: "0600"
|
|
content: |
|
|
server: {{ hysteria2_output_name }}
|
|
domain: {{ hysteria2_domain }}
|
|
port: {{ hysteria2_listen_port }}
|
|
host_ip: "{{ ansible_host | default('') }}"
|
|
mode: masquerade
|
|
users:
|
|
{% for user in hysteria2_export_users %}
|
|
- name: {{ user.name }}
|
|
password: "{{ user.password }}"
|
|
url: "{{ user.url }}"
|
|
has_png: {{ user.has_png | bool | lower }}
|
|
url_file: {{ user.name }}.url
|
|
qr_png: {{ user.name }}.png
|
|
html: index.html
|
|
{% endfor %}
|
|
delegate_to: localhost
|
|
become: false
|
|
|
|
- name: Generate HTML summary page
|
|
ansible.builtin.template:
|
|
src: export/index.html.j2
|
|
dest: "{{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/index.html"
|
|
mode: "0644"
|
|
vars:
|
|
generated_at: "{{ now(utc=false, fmt='%Y-%m-%d %H:%M:%S') }}"
|
|
delegate_to: localhost
|
|
become: false
|
|
|
|
- name: Show export location
|
|
ansible.builtin.debug:
|
|
msg: >-
|
|
Экспорт: {{ hysteria2_users_for_export | default([]) | length }} пользователь(ей) обновлено,
|
|
{{ hysteria2_users_for_reuse | default([]) | length }} без изменений,
|
|
{{ _hysteria2_removed_users | default([]) | length }} удалено.
|
|
Каталог: {{ hysteria2_output_dir }}/{{ hysteria2_output_name }}/
|