diff --git a/goploader.yml b/goploader.yml new file mode 100644 index 0000000..9f3d396 --- /dev/null +++ b/goploader.yml @@ -0,0 +1,10 @@ +--- + +- name: "Testing goploader role" + hosts: localhost + become: true + roles: + - role: common + - role: goploader + vars: + hostname: :8000 diff --git a/roles/goploader/defaults/main.yml b/roles/goploader/defaults/main.yml new file mode 100644 index 0000000..57cefdc --- /dev/null +++ b/roles/goploader/defaults/main.yml @@ -0,0 +1,2 @@ +--- +hostname: :8000 \ No newline at end of file diff --git a/roles/goploader/handlers/main.yml b/roles/goploader/handlers/main.yml new file mode 100644 index 0000000..3aa5745 --- /dev/null +++ b/roles/goploader/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: Restart goploader + service: + name: goploader + state: restarted diff --git a/roles/goploader/meta/main.yml b/roles/goploader/meta/main.yml new file mode 100644 index 0000000..267f8b3 --- /dev/null +++ b/roles/goploader/meta/main.yml @@ -0,0 +1,7 @@ +--- +dependencies: + - role: caddy + vars: + caddy_config: | + {{ hostname }} + reverse_proxy / 127.0.0.1:8008 \ No newline at end of file diff --git a/roles/goploader/tasks/main.yml b/roles/goploader/tasks/main.yml new file mode 100644 index 0000000..82ffd08 --- /dev/null +++ b/roles/goploader/tasks/main.yml @@ -0,0 +1,36 @@ +--- + +- name: ensure goploader user is present + user: + name: "goploader" + home: "/srv/goploader" + shell: "/bin/bash" + state: present + +- name: Download Goploader + get_url: + url: https://gpldr.in/releases/servers/server_amd64.tar.gz + dest: /srv/goploader/server.tgz + become: true + become_user: goploader + +- name: Unarchive goploader + unarchive: + src: /srv/goploader/server.tgz + dest: /srv/goploader + owner: goploader + group: goploader + + +- name: Template systemd service + template: + src: goploader.service + dest: /etc/systemd/system/goploader.service + owner: root + group: root + mode: 0644 + notify: + - Restart goploader + + + diff --git a/roles/goploader/templates/goploader.service b/roles/goploader/templates/goploader.service new file mode 100644 index 0000000..515a9b5 --- /dev/null +++ b/roles/goploader/templates/goploader.service @@ -0,0 +1,11 @@ +[Unit] +Description=goploader + +[Service] +Type=simple +User=goploader +WorkingDirectory=/srv/goploader/goploader-server +ExecStart=/srv/goploader/goploader-server/server + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/roles/up1/defaults/main.yml b/roles/up1/defaults/main.yml index d5c4206..872fc49 100644 --- a/roles/up1/defaults/main.yml +++ b/roles/up1/defaults/main.yml @@ -1,5 +1,4 @@ --- api_key: "{{lookup('password', './.pass/up1_api_key')}}" maximum_file_size: 500000000 -port: 31337 footer: Source Code - Contact diff --git a/roles/up1/main.yml b/roles/up1/main.yml new file mode 100644 index 0000000..03798cc --- /dev/null +++ b/roles/up1/main.yml @@ -0,0 +1,4 @@ +--- +api_key: "{{lookup('password', './.pass/up1_api_key')}}" +maximum_file_site: 500000000 +footer: "Source Code - Contact" diff --git a/roles/up1/tasks/main.yml b/roles/up1/tasks/main.yml index 80b19a7..7ca818b 100644 --- a/roles/up1/tasks/main.yml +++ b/roles/up1/tasks/main.yml @@ -1,6 +1,6 @@ --- -- name: ensure lufi user is present +- name: ensure up1 user is present user: name: "up1" home: "/srv/up1" @@ -19,16 +19,16 @@ src: server.conf.j2 dest: /srv/up1/up1/server/server.conf owner: up1 - group: up1 - mode: 0600 + group: www-data + mode: 0660 - name: copy client settings template: src: config.js.j2 dest: /srv/up1/up1/client/config.js owner: up1 - group: up1 - mode: 0600 + group: www-data + mode: 0660 - name: Install up1 deps become: true diff --git a/roles/up1/templates/server.conf.j2 b/roles/up1/templates/server.conf.j2 index 00c441b..0072243 100644 --- a/roles/up1/templates/server.conf.j2 +++ b/roles/up1/templates/server.conf.j2 @@ -10,7 +10,7 @@ "http": { "enabled": true, - "listen": "127.0.0.1:{{ port }}" + "listen": "127.0.0.1:31337" }, "https": { diff --git a/up1.playbook.yml b/up1.playbook.yml index b7d719e..65bab1b 100644 --- a/up1.playbook.yml +++ b/up1.playbook.yml @@ -1,7 +1,7 @@ --- - name: "Testing up1 role" - hosts: localhost + hosts: jolly become: true roles: - role: common