Add Pulseaudio system-wide service and role
This commit is contained in:
parent
123683b0d9
commit
105753d17a
16
roles/pulseaudio/tasks/main.yml
Normal file
16
roles/pulseaudio/tasks/main.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env ansible-playbook
|
||||||
|
# vim:ft=ansible:
|
||||||
|
- name: assure pulse package
|
||||||
|
apt: name=pulseaudio
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
- name: template out configs
|
||||||
|
template: src={{ item.src }} dest={{ item.dest }} mode=0644
|
||||||
|
loop:
|
||||||
|
- { src: "pulse-client.conf", dest: "/etc/pulse/client.conf" }
|
||||||
|
- { src: "pulse-daemon.conf", dest: "/etc/pulse/daemon.conf" }
|
||||||
|
- { src: "pulse-default.pa", dest: "/etc/pulse/default.pa" }
|
||||||
|
- { src: "pulseaudio.service", dest: "/etc/systemd/system/pulseaudio.service" }
|
||||||
|
- name: assure pulse user
|
||||||
|
user: name=pulseaudio password="!" system=yes home=/var/lib/pulse groups=audio
|
||||||
|
- name: enable pulse service
|
||||||
|
systemd: name=pulseaudio enabled=yes state=started daemon_reload=yes
|
3
roles/pulseaudio/templates/pulse-client.conf
Normal file
3
roles/pulseaudio/templates/pulse-client.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Managed via Ansible
|
||||||
|
autospawn = no
|
||||||
|
default-server = unix:/tmp/pulse-server
|
23
roles/pulseaudio/templates/pulse-daemon.conf
Normal file
23
roles/pulseaudio/templates/pulse-daemon.conf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Configuration file for the PulseAudio daemon. See pulse-daemon.conf(5) for
|
||||||
|
# more information. Default values are commented out. Use either ; or # for
|
||||||
|
# commenting.
|
||||||
|
|
||||||
|
# Bugfixes for my desktop's audio card
|
||||||
|
realtime-scheduling = no # Fixes a weird stutter issue
|
||||||
|
|
||||||
|
# Sanity
|
||||||
|
flat-volumes = no
|
||||||
|
|
||||||
|
# Audio Quality
|
||||||
|
default-sample-format = s32le # Pulse does 16bit sampling by default for some reason
|
||||||
|
default-sample-rate = 48000 # Higher sample rate than default
|
||||||
|
alternate-sample-rate = 44100
|
||||||
|
resample-method = speex-float-5 # Increase resampling quality
|
||||||
|
avoid-resampling = true
|
||||||
|
|
||||||
|
default-fragments = 5 # Pulse, why are you so friggin latent by default?
|
||||||
|
default-fragment-size-msec = 10
|
||||||
|
|
||||||
|
high-priority = yes
|
||||||
|
nice-level = -19
|
||||||
|
|
77
roles/pulseaudio/templates/pulse-default.pa
Normal file
77
roles/pulseaudio/templates/pulse-default.pa
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#!/usr/bin/pulseaudio -nF
|
||||||
|
#!/usr/bin/pulseaudio -nF
|
||||||
|
#
|
||||||
|
.fail
|
||||||
|
|
||||||
|
load-module module-device-restore
|
||||||
|
load-module module-stream-restore
|
||||||
|
load-module module-card-restore
|
||||||
|
load-module module-augment-properties
|
||||||
|
### Should be after module-*-restore but before module-*-detect
|
||||||
|
load-module module-switch-on-port-available
|
||||||
|
### Use hot-plugged devices like Bluetooth or USB automatically (LP: #1702794)
|
||||||
|
.ifexists module-switch-on-connect.so
|
||||||
|
load-module module-switch-on-connect
|
||||||
|
.endif
|
||||||
|
|
||||||
|
# Device detection
|
||||||
|
.ifexists module-udev-detect.so
|
||||||
|
load-module module-udev-detect
|
||||||
|
.else
|
||||||
|
load-module module-detect
|
||||||
|
.endif
|
||||||
|
|
||||||
|
# Bluetooth
|
||||||
|
.ifexists module-bluetooth-policy.so
|
||||||
|
load-module module-bluetooth-policy
|
||||||
|
.endif
|
||||||
|
.ifexists module-bluetooth-discover.so
|
||||||
|
load-module module-bluetooth-discover
|
||||||
|
.endif
|
||||||
|
|
||||||
|
# Protocols
|
||||||
|
.ifexists module-esound-protocol-unix.so
|
||||||
|
load-module module-esound-protocol-unix
|
||||||
|
.endif
|
||||||
|
load-module module-native-protocol-unix auth-group=audio socket=/tmp/pulse-server
|
||||||
|
|
||||||
|
# Load GSettings/paprefs modules
|
||||||
|
.ifexists module-gsettings.so
|
||||||
|
.nofail
|
||||||
|
load-module module-gsettings
|
||||||
|
.fail
|
||||||
|
.endif
|
||||||
|
|
||||||
|
load-module module-default-device-restore
|
||||||
|
load-module module-always-sink
|
||||||
|
load-module module-intended-roles
|
||||||
|
load-module module-suspend-on-idle
|
||||||
|
|
||||||
|
### If autoexit on idle is enabled we want to make sure we only quit
|
||||||
|
### when no local session needs us anymore.
|
||||||
|
.ifexists module-console-kit.so
|
||||||
|
load-module module-console-kit
|
||||||
|
.endif
|
||||||
|
.ifexists module-systemd-login.so
|
||||||
|
load-module module-systemd-login
|
||||||
|
.endif
|
||||||
|
|
||||||
|
# Enable positioned event sounds
|
||||||
|
load-module module-position-event-sounds
|
||||||
|
# Cork music/video streams when a phone stream is active
|
||||||
|
load-module module-role-cork
|
||||||
|
# Block audio recording for snap confined packages
|
||||||
|
.ifexists module-snap-policy.so
|
||||||
|
load-module module-snap-policy
|
||||||
|
.endif
|
||||||
|
|
||||||
|
load-module module-filter-heuristics
|
||||||
|
load-module module-filter-apply
|
||||||
|
|
||||||
|
## Gets around a weird audio skipping bug on my desktop
|
||||||
|
.ifexists module-udev-detect.so
|
||||||
|
load-module module-udev-detect tsched=0
|
||||||
|
|
||||||
|
## My laptop gets sink suspension popping when using headphones
|
||||||
|
unload-module module-suspend-on-idle
|
||||||
|
|
23
roles/pulseaudio/templates/pulseaudio.service
Normal file
23
roles/pulseaudio/templates/pulseaudio.service
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# vim:ft=systemd
|
||||||
|
# NOTE: This service is ONLY useful IF you have the following:
|
||||||
|
# * client.conf is set to not autospawn and listen to a socket instead
|
||||||
|
# * default.pa is configured to start such a socket
|
||||||
|
# Using this unit file and complaining to me that it doesn't work without
|
||||||
|
# the other configs in place will result in me not giving a shit
|
||||||
|
|
||||||
|
## THIS UNIT DOES NOT START PULSE IN SYSTEM MODE
|
||||||
|
## THIS UNIT DOES NOT START PULSE IN SYSTEM MODE
|
||||||
|
## THIS UNIT DOES NOT START PULSE IN SYSTEM MODE
|
||||||
|
## THIS UNIT DOES NOT START PULSE IN SYSTEM MODE
|
||||||
|
## THIS UNIT DOES NOT START PULSE IN SYSTEM MODE
|
||||||
|
[Unit]
|
||||||
|
Description=Pulseaudio sound server
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=pulseaudio
|
||||||
|
Group=pulseaudio
|
||||||
|
ExecStart=/usr/bin/pulseaudio --disallow-exit
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
3
site.yml
3
site.yml
@ -41,6 +41,9 @@
|
|||||||
- SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0664", GROUP="plugdev"
|
- SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0664", GROUP="plugdev"
|
||||||
become: yes
|
become: yes
|
||||||
tags: [ desktop, udev ]
|
tags: [ desktop, udev ]
|
||||||
|
- role: pulseaudio
|
||||||
|
become: yes
|
||||||
|
tags: [ desktop, pulse, pulseaudio ]
|
||||||
- role: zerotier
|
- role: zerotier
|
||||||
become: yes
|
become: yes
|
||||||
tags: [ desktop, zerotier ]
|
tags: [ desktop, zerotier ]
|
||||||
|
Loading…
Reference in New Issue
Block a user