From 63ad11323ca580a7c9f13dba26ed35a67af02a83 Mon Sep 17 00:00:00 2001 From: Bluemedia Date: Sun, 26 Nov 2023 23:01:59 +0100 Subject: [PATCH] Add role for media tools --- main.yml | 3 +- roles/media-tools/files/spotify.desktop | 11 +++++++ roles/media-tools/tasks/main.yml | 39 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 roles/media-tools/files/spotify.desktop create mode 100644 roles/media-tools/tasks/main.yml diff --git a/main.yml b/main.yml index 0be47f4..233012c 100644 --- a/main.yml +++ b/main.yml @@ -2,4 +2,5 @@ roles: - common - desktop-environment - - essential-tools # Thunar File Manager, Firefox, KeePassXC, Nextcloud Desktop \ No newline at end of file + - essential-tools # Thunar File Manager, Firefox, KeePassXC, Nextcloud Desktop + #- media-tools # Spotify, VLC \ No newline at end of file diff --git a/roles/media-tools/files/spotify.desktop b/roles/media-tools/files/spotify.desktop new file mode 100644 index 0000000..bc895ba --- /dev/null +++ b/roles/media-tools/files/spotify.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Name=Spotify +GenericName=Music Player +Icon=spotify-client +TryExec=spotify +Exec=spotify --uri=%U +Terminal=false +MimeType=x-scheme-handler/spotify; +Categories=Audio;Music;Player;AudioVideo; +StartupWMClass=spotify \ No newline at end of file diff --git a/roles/media-tools/tasks/main.yml b/roles/media-tools/tasks/main.yml new file mode 100644 index 0000000..10ec4fa --- /dev/null +++ b/roles/media-tools/tasks/main.yml @@ -0,0 +1,39 @@ +- name: Add Spotify repository + block: + - name: Download Spotify signing key + become: yes + ansible.builtin.get_url: + url: https://download.spotify.com/debian/pubkey_7A3A762FAFD4A51F.gpg + dest: /tmp/spotify.gpg + + - name: Dearmor Spotify signing key + become: yes + ansible.builtin.command: "cat /tmp/spotify.gpg | gpg --dearmor --yes -o /etc/apt/keyrings/spotify.asc" + + - name: Add Spotify repository + become: yes + ansible.builtin.apt_repository: + repo: "deb [signed-by=/etc/apt/keyrings/spotify.asc] http://repository.spotify.com stable non-free" + state: present + filename: spotify + +- name: Install packages + become: yes + apt: + state: latest + install_recommends: false + name: + - vlc + - vlc-plugin-pipewire + - spotify-client + +- name: Ensure that directory for desktop entries exists + file: + path: "{{ ansible_env.HOME }}/.local/share/applications" + recurse: yes + state: directory + +- name: Create Spotify desktop entry + copy: + src: "{{ role_path }}/files/spotify.desktop" + dest: "{{ ansible_env.HOME }}/.local/share/applications/spotify.desktop" \ No newline at end of file