454 lines
12 KiB
YAML
454 lines
12 KiB
YAML
- name: Configure Xplayer Server
|
|
hosts: localhost
|
|
become: yes
|
|
|
|
tasks:
|
|
- name: update script
|
|
shell:
|
|
cmd: |
|
|
/usr/bin/install_bluealsa_openaptx.sh
|
|
ignore_errors: yes
|
|
- name: switch mirror
|
|
copy:
|
|
src: ../files/sources.list.d/
|
|
dest: /etc/apt/sources.list.d/
|
|
mode: '0644'
|
|
tags: apt
|
|
|
|
- name: install dependencies
|
|
apt:
|
|
name:
|
|
- bluez
|
|
- mpc
|
|
- libasound2-dev
|
|
- libudev-dev
|
|
- libfmt-dev
|
|
- libfmt9
|
|
- libchromaprint1
|
|
- libupnp17
|
|
- libnfs14
|
|
- libavutil58
|
|
- libavformat60
|
|
- libavcodec60
|
|
- libcdio-paranoia2
|
|
- libcdio-cdda2
|
|
- libcdio19
|
|
- libmms0
|
|
- libsoxr0
|
|
- libid3tag0
|
|
- libiso9660-11
|
|
- libzzip-0-13
|
|
- libao4
|
|
- libjack-jackd2-0
|
|
- libpipewire-0.3-0
|
|
- libpulse0
|
|
- libshout3
|
|
- libsndio7.0
|
|
- libopenal1
|
|
- libavahi-common3
|
|
- libavahi-client3
|
|
- libadplug-2.3.3-0
|
|
- libflac12
|
|
- libfluidsynth3
|
|
- libaudiofile1
|
|
- libfaad2
|
|
- libgme0
|
|
- libmad0
|
|
- libmikmod3
|
|
- libmodplug1
|
|
- libmpcdec6
|
|
- libmpg123-0
|
|
- libopus0
|
|
- libsndfile1
|
|
- libogg0
|
|
- libvorbis0a
|
|
- libwavpack1
|
|
- libwildmidi2
|
|
- libvorbisenc2
|
|
- libmp3lame0
|
|
- libtwolame0
|
|
- libshine3
|
|
- net-tools
|
|
- libconfig9
|
|
- avahi-daemon
|
|
- libdbus-1-3
|
|
- libglib2.0-0
|
|
- libbluetooth3
|
|
- libsbc1
|
|
- libfdk-aac2
|
|
- libldacbt-abr2
|
|
- libldacbt-enc2
|
|
- cloud-guest-utils
|
|
# - upmpdcli
|
|
state: present
|
|
cache_valid_time: 1 # 365天缓存
|
|
update_cache: yes
|
|
become: yes
|
|
tags: apt
|
|
|
|
- name: Create directories
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
mode: "{{ item.mode | default('0755') }}"
|
|
recurse: yes
|
|
loop:
|
|
- path: /var/lib/mpd/playlists
|
|
- path: /var/lib/mpd/music
|
|
- path: /usr/local/lib/systemd/system
|
|
- path: /srv/login
|
|
- path: /usr/var/lib/bluealsa
|
|
- path: /srv/bluez-alsa
|
|
|
|
|
|
- name: Copy static files
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
loop:
|
|
- src: ../files/modules
|
|
dest: /etc/modules
|
|
- src: ../files/login/
|
|
dest: /srv/login/
|
|
- src: ../files/sshd_config
|
|
dest: /etc/ssh/sshd_config
|
|
mode: '0600'
|
|
- src: ../files/authorized_keys
|
|
dest: /root/.ssh/authorized_keys
|
|
mode: '0600'
|
|
- src: ../files/asound.conf
|
|
dest: /etc/asound.conf
|
|
- src: ../files/start_service.sh
|
|
dest: /etc/custom_service/start_service.sh
|
|
mode: '0755'
|
|
- src: ../files/ota
|
|
dest: /usr/bin/ota
|
|
mode: '0755'
|
|
- src: ../files/snd-aloop.conf
|
|
dest: /etc/modprobe.d/snd-aloop.conf
|
|
mode: '0644'
|
|
- src: ../files/cpufrequtils
|
|
dest: /etc/default/cpufrequtils
|
|
mode: '0644'
|
|
- src: ../files/led-startup.sh
|
|
dest: /usr/bin/led-startup.sh
|
|
mode: '0755'
|
|
- src: ../files/xplayer-start.sh
|
|
dest: /usr/local/bin/xplayer-start.sh
|
|
mode: '0755'
|
|
|
|
- name: update mpd data
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
loop:
|
|
- src: ../files/mpd.conf
|
|
dest: /etc/mpd.conf
|
|
- src: ../files/mpd.service
|
|
dest: /usr/local/lib/systemd/system/mpd.service
|
|
- src: ../files/mpd
|
|
dest: /usr/local/bin/mpd
|
|
mode: '0755'
|
|
- src: ../files/mpd.socket
|
|
dest: /usr/local/lib/systemd/system/mpd.socket
|
|
tags: mpd
|
|
notify:
|
|
- reload_systemd
|
|
- enable_mpd
|
|
- restart_mpd
|
|
register: copy_result
|
|
changed_when: copy_result.changed or (force_update | default(false) | bool)
|
|
|
|
|
|
- name: update bluetooth
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
loop:
|
|
- src: ../files/bluetooth.service
|
|
dest: /usr/lib/systemd/system/bluetooth.service
|
|
- src: ../files/main.conf
|
|
dest: /etc/bluetooth/main.conf
|
|
- src: ../files/input.conf
|
|
dest: /etc/bluetooth/input.conf
|
|
tags: bluetooth
|
|
notify:
|
|
- reload_systemd
|
|
- enable_bluetooth
|
|
- stop_bluetooth
|
|
- start_bluetooth
|
|
register: copy_result
|
|
changed_when: copy_result.changed or (force_update | default(false) | bool)
|
|
|
|
- name: update bluealsa
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
loop:
|
|
- src: ../files/bluealsa.service
|
|
dest: /etc/systemd/system/bluealsa.service
|
|
- src: ../files/install_bluealsa_openaptx.sh
|
|
dest: /usr/bin/install_bluealsa_openaptx.sh
|
|
mode: '0755'
|
|
- src: ../files/bluealsa_bundle.tar.gz
|
|
dest: /srv/bluez-alsa/bluealsa_bundle.tar.gz
|
|
tags: bluealsa
|
|
notify:
|
|
- install_bluealsa_openaptx
|
|
- reload_systemd
|
|
- enable_bluealsa
|
|
- stop_bluealsa
|
|
- start_bluealsa
|
|
register: copy_result
|
|
changed_when: copy_result.changed or (force_update | default(false) | bool)
|
|
|
|
- name: update camilladsp
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
loop:
|
|
- src: ../files/camilladsp.service
|
|
dest: /etc/systemd/system/camilladsp.service
|
|
- src: ../files/camilladsp.yml
|
|
dest: /etc/camilladsp.yml
|
|
- src: ../files/camilladsp
|
|
dest: /usr/local/bin/camilladsp
|
|
mode: '0755'
|
|
notify:
|
|
- reload_systemd
|
|
- enable_camilladsp
|
|
- restart_camilladsp
|
|
register: copy_result
|
|
changed_when: copy_result.changed or (force_update | default(false) | bool)
|
|
tags: camilladsp
|
|
|
|
# - name: update upmpdcli
|
|
# copy:
|
|
# src: "{{ item.src }}"
|
|
# dest: "{{ item.dest }}"
|
|
# mode: "{{ item.mode | default('0644') }}"
|
|
# loop:
|
|
# - src: ../files/upmpdcli.conf
|
|
# dest: /etc/upmpdcli.conf
|
|
|
|
- name: update usb-mount
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
loop:
|
|
- src: ../files/usb-mount.sh
|
|
dest: /usr/local/bin/usb-mount.sh
|
|
mode: '0755'
|
|
- src: ../files/99-usb-auto-mount.rules
|
|
dest: /etc/udev/rules.d/99-usb-auto-mount.rules
|
|
mode: '0644'
|
|
tags: usb
|
|
notify:
|
|
- reload_udev
|
|
register: copy_result
|
|
changed_when: copy_result.changed or (force_update | default(false) | bool)
|
|
|
|
- name: update network-tools
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
loop:
|
|
- src: ../files/sing-box
|
|
dest: /usr/bin/sing-box
|
|
mode: '0755'
|
|
- src: ../files/sing-box.service
|
|
dest: /etc/systemd/system/sing-box.service
|
|
mode: '0644'
|
|
tags: network-tools
|
|
notify:
|
|
- reload_systemd
|
|
- enable_sing-box
|
|
- start_sing-box
|
|
- restart_sing-box
|
|
register: copy_result
|
|
changed_when: copy_result.changed or (force_update | default(false) | bool)
|
|
|
|
- name: update shairport-sync
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
loop:
|
|
- src: ../files/shairport-sync.conf
|
|
dest: /etc/shairport-sync.conf
|
|
- src: ../files/shairport-sync
|
|
dest: /usr/local/bin/shairport-sync
|
|
mode: '0755'
|
|
- src: ../files/shairport-sync.service
|
|
dest: /usr/lib/systemd/system/shairport-sync.service
|
|
- src: ../files/shairport_monitor.sh
|
|
dest: /usr/bin/shairport_monitor.sh
|
|
mode: '0755'
|
|
notify:
|
|
- reload_systemd
|
|
- enable_shairport_sync
|
|
- start_shairport_sync
|
|
|
|
- name: update xplayer-server
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode | default('0644') }}"
|
|
loop:
|
|
- src: ../files/xplayer-server.service
|
|
dest: /etc/systemd/system/xplayer-server.service
|
|
mode: '0644'
|
|
- src: ../files/server
|
|
dest: /usr/local/bin/server
|
|
mode: '0755'
|
|
notify:
|
|
- reload_systemd
|
|
- enable_xplayer_server
|
|
- start_xplayer_server
|
|
- restart_xplayer_server
|
|
- reboot_required
|
|
register: copy_result
|
|
changed_when: copy_result.changed or (force_update | default(false) | bool)
|
|
|
|
- name: Update firmware
|
|
copy:
|
|
src: /lib/firmware/ap6276p/
|
|
dest: /lib/firmware/ap6275p/
|
|
remote_src: yes
|
|
|
|
handlers:
|
|
- name: cleanup_packages
|
|
apt:
|
|
autoremove: yes
|
|
autoclean: yes
|
|
|
|
- name: restart_ssh
|
|
shell:
|
|
cmd: systemctl restart ssh
|
|
|
|
- name: reload_systemd
|
|
shell:
|
|
cmd: systemctl daemon-reload
|
|
|
|
- name: enable_bluetooth
|
|
shell:
|
|
cmd: systemctl enable bluetooth
|
|
- name: stop_bluetooth
|
|
shell:
|
|
cmd: systemctl stop bluetooth
|
|
|
|
- name: start_bluetooth
|
|
shell:
|
|
cmd: systemctl start bluetooth
|
|
|
|
- name: enable_mpd
|
|
shell:
|
|
cmd: systemctl enable mpd
|
|
|
|
- name: stop_mpd
|
|
shell:
|
|
cmd: systemctl stop mpd
|
|
|
|
- name: start_mpd
|
|
shell:
|
|
cmd: systemctl start mpd
|
|
|
|
- name: restart_mpd
|
|
shell:
|
|
cmd: systemctl restart mpd
|
|
- name: enable_camilladsp
|
|
shell:
|
|
cmd: systemctl enable camilladsp
|
|
|
|
- name: stop_camilladsp
|
|
shell:
|
|
cmd: systemctl stop camilladsp
|
|
|
|
|
|
- name: start_camilladsp
|
|
shell:
|
|
cmd: systemctl start camilladsp
|
|
|
|
|
|
- name: restart_camilladsp
|
|
shell:
|
|
cmd: systemctl restart camilladsp
|
|
|
|
- name: restart_upmpdcli
|
|
shell:
|
|
cmd: systemctl restart upmpdcli
|
|
|
|
- name: reload_udev
|
|
shell:
|
|
cmd: udevadm control --reload-rules && udevadm trigger
|
|
|
|
- name: enable_shairport_sync
|
|
shell:
|
|
cmd: systemctl enable shairport-sync
|
|
|
|
- name: stop_shairport_sync
|
|
shell:
|
|
cmd: systemctl stop shairport-sync
|
|
|
|
- name: start_shairport_sync
|
|
shell:
|
|
cmd: systemctl start shairport-sync
|
|
|
|
- name: restart_shairport_sync
|
|
shell:
|
|
cmd: systemctl restart shairport-sync
|
|
- name: enable_sing-box
|
|
shell:
|
|
cmd: systemctl enable sing-box
|
|
|
|
- name: start_sing-box
|
|
shell:
|
|
cmd: systemctl start sing-box
|
|
|
|
- name: restart_sing-box
|
|
shell:
|
|
cmd: systemctl restart sing-box
|
|
|
|
- name: install_bluealsa_openaptx
|
|
shell:
|
|
cmd: /usr/bin/install_bluealsa_openaptx.sh
|
|
|
|
- name: enable_bluealsa
|
|
shell:
|
|
cmd: systemctl enable bluealsa
|
|
- name: stop_bluealsa
|
|
shell:
|
|
cmd: systemctl stop bluealsa
|
|
- name: start_bluealsa
|
|
shell:
|
|
cmd: systemctl start bluealsa
|
|
- name: restart_bluealsa
|
|
shell:
|
|
cmd: systemctl restart bluealsa
|
|
|
|
- name: enable_xplayer_server
|
|
shell:
|
|
cmd: systemctl enable xplayer-server
|
|
|
|
- name: start_xplayer_server
|
|
shell:
|
|
cmd: systemctl start xplayer-server
|
|
|
|
- name: restart_xplayer_server
|
|
shell:
|
|
cmd: systemctl restart xplayer-server
|
|
|
|
- name: reboot_required
|
|
shell:
|
|
cmd: echo "need reboot"
|
|
|
|
|
|
|