f3bd4313df
Store install_server.sh in role files, compare SHA256 with get.hy2.sh on the control node before install/update, refresh the bundled copy when upstream changes, then copy and run it on VPS.
45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
---
|
|
- name: Update system and install dependencies
|
|
when: hysteria2_upgrade_system | bool
|
|
block:
|
|
- name: apt update
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
|
|
- name: apt upgrade
|
|
ansible.builtin.apt:
|
|
upgrade: dist
|
|
|
|
- name: Install curl, micro and qrencode
|
|
ansible.builtin.apt:
|
|
name: "{{ _hysteria2_apt_packages }}"
|
|
state: present
|
|
update_cache: "{{ not (hysteria2_upgrade_system | bool) }}"
|
|
vars:
|
|
_hysteria2_apt_packages: >-
|
|
{{
|
|
['curl', 'micro']
|
|
+ (['qrencode'] if hysteria2_generate_qr_png | bool else [])
|
|
}}
|
|
|
|
- name: Sync official Hysteria2 install script on control node
|
|
ansible.builtin.import_tasks: sync_install_script.yml
|
|
|
|
- name: Copy Hysteria2 install script to server
|
|
ansible.builtin.copy:
|
|
src: "{{ hysteria2_install_script_name }}"
|
|
dest: "{{ hysteria2_install_script_remote_path }}"
|
|
mode: "0755"
|
|
|
|
- name: Install Hysteria2 via official script
|
|
ansible.builtin.command:
|
|
cmd: "{{ hysteria2_install_script_remote_path }}"
|
|
creates: /usr/local/bin/hysteria
|
|
register: _hysteria2_install
|
|
|
|
- name: Show Hysteria2 install result
|
|
ansible.builtin.debug:
|
|
msg: "{{ _hysteria2_install.stdout_lines | default(['Hysteria2 already installed']) }}"
|
|
when: _hysteria2_install.stdout_lines is defined
|