--- - 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"