Trying to fix within pulseaudio script.

This commit is contained in:
Emiliano Vavassori 2016-10-04 00:37:58 +02:00
parent ac221f15ad
commit 65fa352717
2 changed files with 62 additions and 10 deletions

View File

@ -1,11 +1,13 @@
---
# Manages reactivation of pulseaudio as system daemon
- name: "Allowing pulseaudio to run at startup"
replace:
regexp: '^#start on runlevel.*$'
replace: 'start on runlevel [2345]'
- name: "Changing pulseaudio upstart script"
template:
src: pulseaudio.conf
dest: /etc/init/pulseaudio.conf
owner: root
group: root
mode: 0644
- name: "Checking if pulseaudio is started"
shell: /sbin/status pulseaudio
@ -27,9 +29,9 @@
- name: Disabling pulseaudio startup on lightdm
shell: chmod -x /usr/bin/start-pulseaudio-x11
- name: Adding pulseaudio fixing script at reboot.
lineinfile:
line: '@reboot root curl -sSL http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/pulseaudio-perms.sh | bash >/dev/null 2>&1'
dest: /etc/cron.d/pulseaudio-perms
create: yes
state: present
#- name: Adding pulseaudio fixing script at reboot.
# lineinfile:
# line: '@reboot root curl -sSL http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/pulseaudio-perms.sh | bash >/dev/null 2>&1'
# dest: /etc/cron.d/pulseaudio-perms
# create: yes
# state: present

View File

@ -0,0 +1,50 @@
# System PulseAudio service
description "System PulseAudio sound server"
author "Pali Rohár <pali.rohar@gmail.com>"
# uncomment the 'start on' to start pulseaudio in system mode
# (enables the pulseaudio init script - requires that users be in the
# pulse-access group)
# System mode is not the recommended way to run PulseAudio as it has some
# limitations (such as no shared memory access) and could potentially allow
# users to disconnect or redirect each others' audio streams. The
# recommended way to run PulseAudio is as a per-session daemon. For GNOME/KDE/
# Xfce sessions in Ubuntu Lucid/10.04, /etc/xdg/autostart/pulseaudio.desktop
# handles this function of automatically starting PulseAudio on login, and for
# it to work correctly your user must *not* have "autospawn = no" set in
# ~/.pulse/client.conf (or in /etc/pulse/client.conf). By default, autospawn
# is enabled. For other sessions, you can simply start PulseAudio with
# "pulseaudio --daemonize".
start on (started winbind)
stop on runlevel [016]
expect daemon
respawn
# Prevent users from dynamically loading modules into the PulseAudio sound
# server. Dynamic module loading enhances the flexibility of the PulseAudio
# system, but may pose a security risk.
# 0 = no, 1 = yes
env DISALLOW_MODULE_LOADING=1
# extra arguments to pass to the daemon
env PULSEAUDIO_ARGS=
pre-start exec install -d -m755 -o pulse -g pulse /run/pulse
exec /usr/bin/pulseaudio --system --daemonize --high-priority --log-target=syslog --disallow-exit --disallow-module-loading=$DISALLOW_MODULE_LOADING $PULSEAUDIO_ARGS
post-start script
if [ -e /var/run/pulse/.esd_auth ]; then
chown pulse:pulse-access /var/run/pulse/.esd_auth
chmod 640 /var/run/pulse/.esd_auth
fi
if [ -e /var/run/pulse/.pulse-cookie ]; then
chown pulse:pulse-access /var/run/pulse/.pulse-cookie
chmod 640 /var/run/pulse/.pulse-cookie
fi
# Run script to fix permissions on the pulseaudio stack
/usr/bin/curl -sSL http://{{ ansible_local.domain.serverfqdn }}/ks/preseed/pulseaudio-perms.sh >/dev/null | /bin/bash &
end script