Add subshine role, not enabled by default
This commit is contained in:
parent
9fee00b0d8
commit
32bef2d7f3
52
roles/sunshine/tasks/main.yaml
Normal file
52
roles/sunshine/tasks/main.yaml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
---
|
||||||
|
- set_fact:
|
||||||
|
# TODO: Construct this out of information in ansible_facts
|
||||||
|
asset_name: sunshine-ubuntu-22.04-amd64.deb
|
||||||
|
|
||||||
|
- name: get latest version
|
||||||
|
uri:
|
||||||
|
url: https://api.github.com/repos/LizardByte/Sunshine/releases/latest
|
||||||
|
headers: '{{github_auth_headers}}'
|
||||||
|
register: latest
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
assets: '{{latest.json.assets}}'
|
||||||
|
asset_query: '[?contains(name, `{{asset_name}}`)] | [0]'
|
||||||
|
- debug: var=assets
|
||||||
|
- debug: var=asset_query
|
||||||
|
- set_fact:
|
||||||
|
asset: '{{assets | json_query(asset_query)}}'
|
||||||
|
- debug: var=asset
|
||||||
|
|
||||||
|
- name: download deb file
|
||||||
|
get_url:
|
||||||
|
url: '{{asset.browser_download_url}}'
|
||||||
|
dest: '/tmp/{{asset_name}}'
|
||||||
|
|
||||||
|
- name: install package from deb file
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
deb: '/tmp/{{asset_name}}'
|
||||||
|
|
||||||
|
- name: remove deb file
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: '/tmp/{{asset_name}}'
|
||||||
|
|
||||||
|
- name: fix systemd unit
|
||||||
|
become: true
|
||||||
|
copy:
|
||||||
|
path: /usr/lib/systemd/user/sunshine.service
|
||||||
|
content: |
|
||||||
|
[Unit]
|
||||||
|
Description=Sunshine is a self-hosted game stream host for Moonlight.
|
||||||
|
StartLimitIntervalSec=500
|
||||||
|
StartLimitBurst=5
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/sunshine
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=xdg-desktop-autostart.target
|
Loading…
x
Reference in New Issue
Block a user