sargo-temp/ansible/audio.yml

155 lines
4.3 KiB
YAML
Raw Normal View History

2024-07-16 23:17:32 +00:00
---
2024-08-31 23:32:07 +00:00
- hosts: all
2024-07-16 23:17:32 +00:00
tasks:
### ALSA Config ###
- name: "Remove previously downloaded version of alsa ucm configs"
2024-08-08 13:47:55 +00:00
ansible.builtin.file:
path: "/root/alsa-ucm-conf-master.tar.gz"
state: absent
2024-07-16 23:17:32 +00:00
- name: "Download https://gitlab.com/sdm670-mainline/alsa-ucm-conf/-/archive/master/alsa-ucm-conf-master.tar.gz"
ansible.builtin.get_url:
url: "https://gitlab.com/sdm670-mainline/alsa-ucm-conf/-/archive/master/alsa-ucm-conf-master.tar.gz"
dest: /root/alsa-ucm-conf-master.tar.gz
2024-08-08 13:47:55 +00:00
force: true # overwrite if the already have a previous version
2024-07-16 23:17:32 +00:00
mode: '0440'
delay: 2
2024-07-20 00:39:08 +00:00
retries: 20
2024-07-16 23:17:32 +00:00
- name: "Remove alsa ucm configs"
ansible.builtin.file:
path: "/usr/share/alsa/{{ item }}"
state: absent
loop:
- ucm
- ucm2
- name: "Unpack alsa-ucm-conf-master.tar.gz to /usr/share/alsa"
ansible.builtin.shell: |
tar xvzf /root/alsa-ucm-conf-master.tar.gz -C /usr/share/alsa --strip-components=1 --wildcards "*/ucm" "*/ucm2"
args:
chdir: /usr/share/alsa
### Wireplumber Config ###
- name: "Copy Wireplumber Config"
ansible.builtin.copy:
src: 51-qcom-sdm845.conf
dest: "/usr/share/wireplumber/wireplumber.conf.d/51-qcom-sdm845.conf"
owner: root
group: root
mode: u+rw
force: true
register: wireplumber_config
- name: "Restart Wireplumber on config change"
ansible.builtin.systemd_service:
name: wireplumber.service
state: restarted
scope: user
become_user: "{{ ansible_env.SUDO_USER }}"
when: wireplumber_config.changed
2024-07-20 00:39:08 +00:00
### Remove Remnants Of Previous Playbook Versions ###
- name: "Deactivate systemd unit if it exists, ignore errors if it does not"
ansible.builtin.systemd_service:
name: q6voiced-temp.service
state: stopped
enabled: false
masked: true
ignore_errors: true
- name: "Remove remnants of previous versions of this playbook"
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- "/opt/tinyalsa"
- "/opt/q6voiced"
- "/etc/systemd/system/q6voiced-temp.service"
2024-07-16 23:17:32 +00:00
### Call Audio ###
2024-07-20 00:39:08 +00:00
- name: "Install dependencies"
2024-07-16 23:17:32 +00:00
ansible.builtin.apt:
pkg:
- gcc
- git
- libdbus-1-dev
- libdbus-cpp-dev
- make
2024-07-20 00:39:08 +00:00
- devscripts
- doxygen
2024-07-16 23:17:32 +00:00
state: present
update_cache: true
- name: "Add directory that the repos get cloned into"
ansible.builtin.file:
path: "/opt/repos"
state: "directory"
owner: nobody
group: nogroup
- name: "chown repo directories to nobody:nogroup"
ansible.builtin.file:
path: "/opt/repos/"
recurse: true
owner: nobody
group: nogroup
2024-08-31 23:32:07 +00:00
- name: "Remove repos that already exist"
2024-07-20 00:39:08 +00:00
ansible.builtin.file:
2024-08-31 23:32:07 +00:00
path: "/opt/repos/{{ item }}"
state: "absent"
2024-07-20 00:39:08 +00:00
owner: nobody
group: nogroup
loop:
2024-08-31 23:32:07 +00:00
- "tinyalsa"
- "q6voiced"
2024-07-20 00:39:08 +00:00
2024-07-16 23:17:32 +00:00
- name: "Clone tinyalsa repo"
ansible.builtin.git:
2024-07-20 00:39:08 +00:00
repo: 'https://salsa.debian.org/erebion/tinyalsa.git'
dest: /opt/repos/tinyalsa
2024-07-20 12:05:42 +00:00
version: mobian-git20240621
become_user: nobody
delay: 2
2024-07-20 00:39:08 +00:00
retries: 20
2024-07-16 23:17:32 +00:00
- name: "Clone q6voiced repo"
ansible.builtin.git:
2024-07-20 00:39:08 +00:00
repo: 'https://salsa.debian.org/erebion/q6voiced.git'
dest: /opt/repos/q6voiced
version: mobian-git20240607
become_user: nobody
delay: 2
2024-07-20 00:39:08 +00:00
retries: 20
- name: "Build Debian packages for tinyalsa"
2024-07-16 23:17:32 +00:00
ansible.builtin.shell:
2024-07-20 00:39:08 +00:00
cmd: debuild -i -us -uc -b
chdir: "/opt/repos/tinyalsa/"
2024-07-20 00:39:08 +00:00
become_user: nobody
- name: "Install tinyalsa"
2024-07-20 00:39:08 +00:00
ansible.builtin.apt:
deb: "/opt/repos/{{ item }}"
loop:
- "libtinyalsa_2.0.0+git20240621-7f06b2f-3_arm64.deb"
- "libtinyalsa-dev_2.0.0+git20240621-7f06b2f-3_arm64.deb"
- "tinyalsa_2.0.0+git20240621-7f06b2f-3_arm64.deb"
- name: "Build Debian package for q6voiced"
ansible.builtin.shell:
cmd: debuild -i -us -uc -b
chdir: "/opt/repos/q6voiced/"
become_user: nobody
- name: "Install tinyalsa and q6voiced"
ansible.builtin.apt:
deb: "/opt/repos/q6voiced_0~0+git20240607-75ae4079-1_arm64.deb"