sargo-temp/ansible/audio.yml

128 lines
3.6 KiB
YAML

---
- hosts: 10.66.0.1
tasks:
### ALSA Config ###
- name: "Remove previously downloaded version of alsa ucm configs"
ansible.builtin.file:
path: "/root/alsa-ucm-conf-master.tar.gz"
state: absent
- 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
force: true # overwrite if the already have a previous version
mode: '0440'
delay: 2
retries: 20
- 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
### 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"
### Call Audio ###
- name: "Install dependencies"
ansible.builtin.apt:
pkg:
- gcc
- git
- libdbus-1-dev
- libdbus-cpp-dev
- make
- devscripts
- doxygen
state: present
update_cache: true
- name: "Create directory for the repos (first delete it to make it empty)"
ansible.builtin.file:
path: "/opt/repos/"
state: "{{ item }}"
owner: nobody
group: nogroup
loop:
- "absent"
- "directory"
- name: "Clone tinyalsa repo"
ansible.builtin.git:
repo: 'https://salsa.debian.org/erebion/tinyalsa.git'
dest: /opt/repos/tinyalsa
version: mobian-git20240621
become_user: nobody
delay: 2
retries: 20
- name: "Clone q6voiced repo"
ansible.builtin.git:
repo: 'https://salsa.debian.org/erebion/q6voiced.git'
dest: /opt/repos/q6voiced
version: mobian-git20240607
become_user: nobody
delay: 2
retries: 20
- name: "chown repo directories to nobody:nogroup"
ansible.builtin.file:
path: "/opt/repos/"
recurse: true
owner: nobody
group: nogroup
- name: "Build Debian packages for tinyalsa"
ansible.builtin.shell:
cmd: debuild -i -us -uc -b
chdir: "/opt/repos/tinyalsa/"
become_user: nobody
- name: "Install tinyalsa"
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"