From 4683c1cc863d20ca8f796283e70c0e6e7a831a9d Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 11 Apr 2019 18:52:29 +0200 Subject: [PATCH] add role laptop --- defaults/main.yml | 2 ++ handlers/main.yml | 9 +++++++++ tasks/main.yml | 34 ++++++++++++++++++++++++++++++++++ vars/main.yml | 2 ++ 4 files changed, 47 insertions(+) create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 tasks/main.yml create mode 100644 vars/main.yml diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..5964b01 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for bluetooth \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..9605021 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,9 @@ +--- +# handlers file for bluetooth + +- name: restart pulse as user + systemd: name=pulseaudio.service scope=user state=restarted + become: yes + become_user: "{{ user.name }}" + environment: + XDG_RUNTIME_DIR: "/run/user/{{ user.uid }}" \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..748c367 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,34 @@ +--- +# tasks file for bluetooth + +- name: Install Bluetooth packages + pacman: + name: + - bluez + - bluez-utils + - pulseaudio-bluetooth + become: yes + notify: + - restart pulse as user + +- name: Auto-switch between HSP/HSF and A2DP + lineinfile: + dest: /etc/pulse/default.pa + regex: "^load-module module-bluetooth-policy" + state: present + line: "load-module module-bluetooth-policy auto_switch=2" + notify: + - restart pulse as user + become: yes + + +- name: Unblock the bluetooth service + service: name="rfkill-block@bluetooth.service" enabled=no state=stopped + become: yes + + +- name: Enable and start the bluetooth service + service: name=bluetooth.service enabled=yes state=started + become: yes + + \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..897b8d8 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for bluetooth \ No newline at end of file