Created
December 7, 2021 16:38
-
-
Save tobiasmcnulty/666a302e1cd8a3021d88b221c90ae02b to your computer and use it in GitHub Desktop.
Revisions
-
tobiasmcnulty created this gist
Dec 7, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ - name: Disable onboard audio replace: path: /boot/config.txt regexp: '^dtparam=audio=on$' replace: '#dtparam=audio=on' register: disable_onboard when: dac_type is defined - name: Enable DAC ({{ dac_type }}) lineinfile: path: /boot/config.txt line: 'dtoverlay={{ dac_type }}' register: enable_dac when: dac_type is defined - name: Add asound.conf blockinfile: path: /etc/asound.conf block: | pcm.!default { type hw card 0 } ctl.!default { type hw card 0 } create: yes register: asound_conf when: dac_type is defined - name: Rebooting machine reboot: when: dac_type is defined and (disable_onboard.changed or enable_dac.changed or asound_conf.changed) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ # see https://support.hifiberry.com/hc/en-us/articles/205377651-Configuring-Linux-4-x-or-higher dac_type: hifiberry-dac # raspotify bit rate raspotify_bitrate: 320 raspotify_volume: 100 raspotify_volume_args: --enable-volume-normalisation --linear-volume --initial-volume={{ raspotify_volume }} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ - name: Make sure apt can use https sources apt: name: apt-transport-https state: present - name: Add signing key apt_key: url: https://dtcooper.github.io/raspotify/key.asc state: present - name: Add repo apt_repository: repo: deb https://dtcooper.github.io/raspotify raspotify main state: present - name: Install package apt: name: raspotify state: present - name: Set DEVICE_NAME for each device replace: path: /etc/default/raspotify regexp: '#?DEVICE_NAME=.+$' replace: 'DEVICE_NAME="{{ raspotify_device_name }}"' backup: yes register: raspotify_devname - name: Set BITRATE for each device replace: path: /etc/default/raspotify regexp: '#?BITRATE=.+$' replace: 'BITRATE={{ raspotify_bitrate }}' backup: yes register: raspotify_bitrate - name: Set VOLUME_ARGS for each device replace: path: /etc/default/raspotify regexp: '#?VOLUME_ARGS=.+$' replace: 'VOLUME_ARGS="{{ raspotify_volume_args }}"' backup: yes register: raspotify_bitrate - name: Restart raspotify systemd: name: raspotify state: restarted when: raspotify_bitrate.changed or raspotify_devname.changed