Improved bluetooth's ansible play

This commit is contained in:
Michele Cereda
2022-05-10 23:49:27 +02:00
parent d8f5dcc5e3
commit a94fbc6268

View File

@@ -25,7 +25,22 @@
- when: ansible_system == 'Linux' - when: ansible_system == 'Linux'
tags: linux tags: linux
block: block:
- name: Configure how long to stay in discoverable mode before going back to non-discoverable
tags: discoverable_timeout
when: discoverable_timeout is defined
become: true
notify: Restart Bluez
ansible.builtin.lineinfile:
path: "/etc/bluetooth/main.conf"
line: "DiscoverableTimeout = {{ discoverable_timeout|string|lower }}"
regexp: '^.*DiscoverableTimeout\s*=\s*.*$'
insertafter: '^[General]$'
mode: '0644'
create: true
backup: true
- name: Configure faster Bluetooth connection to devices - name: Configure faster Bluetooth connection to devices
tags: fast_connectable
when: fast_connectable is defined
become: true become: true
notify: Restart Bluez notify: Restart Bluez
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
@@ -36,7 +51,22 @@
mode: '0644' mode: '0644'
create: true create: true
backup: true backup: true
- name: Enable all Bluetooth devices as soon as they are found - name: Configure the default adapter's name
tags: name
when: name is defined
become: true
notify: Restart Bluez
ansible.builtin.lineinfile:
path: "/etc/bluetooth/main.conf"
line: "Name = {{ name|string|lower }}"
regexp: '^.*Name\s*=\s*.*$'
insertafter: '^[General]$'
mode: '0644'
create: true
backup: true
- name: Enable Bluetooth adapters as soon as they are found
tags: auto_enable
when: auto_enable is defined
become: true become: true
notify: Restart Bluez notify: Restart Bluez
ansible.builtin.lineinfile: ansible.builtin.lineinfile: