local/roles/sunshine/tasks/Debian.yaml

44 lines
1.1 KiB
YAML

---
# FIXME: This will only work for Debian or Ubuntu but not Ubuntu derived distros
- set_fact:
assets: '{{latest.json.assets}}'
asset_name: 'sunshine-{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-amd64.deb'
- set_fact:
asset_query: '[?contains(name, `{{asset_name}}`)] | [0]'
- set_fact:
asset: '{{assets | json_query(asset_query)}}'
- name: download deb file
get_url:
url: '{{asset.browser_download_url}}'
dest: '/tmp/{{asset_name}}'
environment: '{{proxy_environment}}'
- 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