blob: 59dcd7b9a7d755f71c12b07ed691fd21174b8251 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
---
- name: "create directory"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: _vpn
group: _vpn
mode: 0700
loop:
- "/var/reactance/hysteria"
- "/var/reactance/hysteria/bin"
- "/var/reactance/hysteria/etc"
- "/var/reactance/hysteria/certs"
- name: "setup log file"
ansible.builtin.file:
path: /var/log/hysteria.log
state: touch
mode: "0600"
changed_when: false
# this can remain here while hysteria is not being used
- name: "install necessary utils"
community.general.openbsd_pkg:
name:
- git--
- go--
- rsync--
state: present
- name: "create temporary directory"
ansible.builtin.tempfile:
state: directory
suffix: temp
register: hysteria_tempdir
notify:
- remove_hysteria_tempdir
- name: "clone hysteria"
ansible.builtin.shell: "git clone https://github.com/apernet/hysteria.git"
args:
chdir: "{{ hysteria_tempdir.path }}"
- name: "build hysteria"
ansible.builtin.shell: "python3 hyperbole.py build"
args:
chdir: "{{ hysteria_tempdir.path }}/hysteria"
- name: "install hysteria"
ansible.builtin.shell: "{{ item }}"
loop:
- "install -m 750 -o _vpn -g bin {{ hysteria_tempdir.path }}/hysteria/build/hysteria-openbsd-* /var/reactance/hysteria/bin/hysteria"
# Find the list of dependences through ldd and copy them over
- name: "copy chroot dependencies"
ansible.builtin.shell: "deps=$(ldd /var/reactance/hysteria/bin/hysteria | awk 'FNR > 3 {print $7}'); for dep in $deps; do rsync -av --relative $dep /var/reactance/hysteria; done"
- name: "template out init script"
ansible.builtin.template:
src: hysteria.rc.j2
dest: "{{ hysteria_tempdir.path }}/hysteria.rc"
- name: "install init script"
ansible.builtin.shell: "install -m 755 -g bin {{ hysteria_tempdir.path }}/hysteria.rc /etc/rc.d/hysteria"
|