-
Notifications
You must be signed in to change notification settings - Fork 1
/
bluetooth.yml
88 lines (79 loc) · 2.44 KB
/
bluetooth.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
- name: Bluetooth
hosts: physical
become: true
vars:
confdir: /etc/systemd/system/bluetooth.service.d
dbusconf: /etc/dbus-1/system-local.conf
tasks:
# Remove old `bluez-utils` (exact-matched name), but not
# `bluez-utils-compat`, which "provides" `bluez-utils`
- name: Remove conflicting packages
shell: |
set -e -x
pacman -Qi bluez-utils 2>/dev/null |
grep -qx 'Name *: *bluez-utils' ||
exit 0
pacman -R --noconfirm bluez-utils
register: old_bluez_utils
changed_when: old_bluez_utils.stdout != ""
failed_when: old_bluez_utils.rc != 0
- name: Bluetooth packages
archpkg: name={{item}}
with_items:
- bluez
- aur/bluez-utils-compat # = `bluez-utils` with `--enable-deprecated`
- obexftp
- pulseaudio-bluetooth
- python-dbus
- python2-dbus
- ussp-push
- name: Service settings directory
file: dest={{confdir}} state=directory owner=root group=root mode=0755
notify: restart bluetoothd
- name: Bluetooth permissions
copy:
src: files/bluetooth.permissions.conf
dest: '{{dbusconf}}'
owner: root
group: root
mode: 0644
notify:
- reload systemd
- reload dbus
- name: Bluetooth ini config options
ini_file:
dest: '/etc/bluetooth/{{item.ini.0}}.conf'
section: '{{item.ini.1}}'
option: '{{item.ini.2}}'
value: '{{item.ini.3}}'
with_items:
- ini: [audio, General, Enable, 'Source,Sink,Media,Socket']
- ini: [main, Policy, AutoEnable, 'true']
- ini: [input, General, UserspaceHID, 'true']
notify: restart bluetoothd
- name: Enable daemon options
copy:
content: |
# Overrides for daemon settings
[Service]
# blank line removes upstream cmdline
ExecStart=
ExecStart=/usr/lib/bluetooth/bluetoothd --compat --experimental
dest: '{{confdir}}/cmdline.conf'
owner: root
group: root
mode: 0644
notify:
- reload systemd
- restart bluetoothd
- name: Bluetooth daemon
service: name=bluetooth state=started enabled=yes
handlers:
- name: reload systemd
command: systemctl daemon-reload
- name: restart bluetoothd
service: name=bluetooth state=restarted
- name: reload dbus
service:
name: dbus
state: reloaded