From 14576e842ecbb7baf2798820254ab37e558fa1e9 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sun, 29 Dec 2024 17:48:16 +0100 Subject: [PATCH] fix(editor_vscode): branch by package manager When installing VSCode via RPM or DEB package, branch by the package manager rather than the distribution. Signed-off-by: Matej Focko --- roles/editor_vscode/tasks/install_AlmaLinux.yml | 1 - roles/editor_vscode/tasks/install_CentOS.yml | 1 - roles/editor_vscode/tasks/install_Debian.yml | 1 - roles/editor_vscode/tasks/install_Fedora.yml | 1 - roles/editor_vscode/tasks/install_Rocky.yml | 1 - roles/editor_vscode/tasks/install_Ubuntu.yml | 1 - .../tasks/{install_deb.yml => install_apt.yml} | 0 roles/editor_vscode/tasks/install_dnf.yml | 1 + roles/editor_vscode/tasks/install_dnf5.yml | 1 + .../tasks/{install_rhel.yml => install_rpm.yml} | 11 ++++++++++- roles/editor_vscode/tasks/install_zypper.yml | 1 + roles/editor_vscode/tasks/main.yml | 2 +- 12 files changed, 14 insertions(+), 8 deletions(-) delete mode 120000 roles/editor_vscode/tasks/install_AlmaLinux.yml delete mode 120000 roles/editor_vscode/tasks/install_CentOS.yml delete mode 120000 roles/editor_vscode/tasks/install_Debian.yml delete mode 120000 roles/editor_vscode/tasks/install_Fedora.yml delete mode 120000 roles/editor_vscode/tasks/install_Rocky.yml delete mode 120000 roles/editor_vscode/tasks/install_Ubuntu.yml rename roles/editor_vscode/tasks/{install_deb.yml => install_apt.yml} (100%) create mode 120000 roles/editor_vscode/tasks/install_dnf.yml create mode 120000 roles/editor_vscode/tasks/install_dnf5.yml rename roles/editor_vscode/tasks/{install_rhel.yml => install_rpm.yml} (51%) create mode 120000 roles/editor_vscode/tasks/install_zypper.yml diff --git a/roles/editor_vscode/tasks/install_AlmaLinux.yml b/roles/editor_vscode/tasks/install_AlmaLinux.yml deleted file mode 120000 index c10604b..0000000 --- a/roles/editor_vscode/tasks/install_AlmaLinux.yml +++ /dev/null @@ -1 +0,0 @@ -install_rhel.yml \ No newline at end of file diff --git a/roles/editor_vscode/tasks/install_CentOS.yml b/roles/editor_vscode/tasks/install_CentOS.yml deleted file mode 120000 index c10604b..0000000 --- a/roles/editor_vscode/tasks/install_CentOS.yml +++ /dev/null @@ -1 +0,0 @@ -install_rhel.yml \ No newline at end of file diff --git a/roles/editor_vscode/tasks/install_Debian.yml b/roles/editor_vscode/tasks/install_Debian.yml deleted file mode 120000 index 38e6c00..0000000 --- a/roles/editor_vscode/tasks/install_Debian.yml +++ /dev/null @@ -1 +0,0 @@ -install_deb.yml \ No newline at end of file diff --git a/roles/editor_vscode/tasks/install_Fedora.yml b/roles/editor_vscode/tasks/install_Fedora.yml deleted file mode 120000 index c10604b..0000000 --- a/roles/editor_vscode/tasks/install_Fedora.yml +++ /dev/null @@ -1 +0,0 @@ -install_rhel.yml \ No newline at end of file diff --git a/roles/editor_vscode/tasks/install_Rocky.yml b/roles/editor_vscode/tasks/install_Rocky.yml deleted file mode 120000 index c10604b..0000000 --- a/roles/editor_vscode/tasks/install_Rocky.yml +++ /dev/null @@ -1 +0,0 @@ -install_rhel.yml \ No newline at end of file diff --git a/roles/editor_vscode/tasks/install_Ubuntu.yml b/roles/editor_vscode/tasks/install_Ubuntu.yml deleted file mode 120000 index 38e6c00..0000000 --- a/roles/editor_vscode/tasks/install_Ubuntu.yml +++ /dev/null @@ -1 +0,0 @@ -install_deb.yml \ No newline at end of file diff --git a/roles/editor_vscode/tasks/install_deb.yml b/roles/editor_vscode/tasks/install_apt.yml similarity index 100% rename from roles/editor_vscode/tasks/install_deb.yml rename to roles/editor_vscode/tasks/install_apt.yml diff --git a/roles/editor_vscode/tasks/install_dnf.yml b/roles/editor_vscode/tasks/install_dnf.yml new file mode 120000 index 0000000..463b6d3 --- /dev/null +++ b/roles/editor_vscode/tasks/install_dnf.yml @@ -0,0 +1 @@ +install_rpm.yml \ No newline at end of file diff --git a/roles/editor_vscode/tasks/install_dnf5.yml b/roles/editor_vscode/tasks/install_dnf5.yml new file mode 120000 index 0000000..463b6d3 --- /dev/null +++ b/roles/editor_vscode/tasks/install_dnf5.yml @@ -0,0 +1 @@ +install_rpm.yml \ No newline at end of file diff --git a/roles/editor_vscode/tasks/install_rhel.yml b/roles/editor_vscode/tasks/install_rpm.yml similarity index 51% rename from roles/editor_vscode/tasks/install_rhel.yml rename to roles/editor_vscode/tasks/install_rpm.yml index ddd8085..113447d 100644 --- a/roles/editor_vscode/tasks/install_rhel.yml +++ b/roles/editor_vscode/tasks/install_rpm.yml @@ -4,9 +4,18 @@ url: https://code.visualstudio.com/sha/download?build=insider&os=linux-rpm-x64 register: _vscode_rpm_response -- name: Install VSCode via RPM +- name: Install VSCode via dnf ansible.builtin.dnf: name: "{{ _vscode_rpm_response.url }}" disable_gpg_check: true state: present become: true + when: ansible_facts.pkg_mgr.startswith("dnf") + +- name: Install VSCode via zypper + community.general.zypper: + name: "{{ _vscode_rpm_response.url }}" + disable_gpg_check: true + state: present + become: true + when: ansible_facts.pkg_mgr == "zypper" diff --git a/roles/editor_vscode/tasks/install_zypper.yml b/roles/editor_vscode/tasks/install_zypper.yml new file mode 120000 index 0000000..463b6d3 --- /dev/null +++ b/roles/editor_vscode/tasks/install_zypper.yml @@ -0,0 +1 @@ +install_rpm.yml \ No newline at end of file diff --git a/roles/editor_vscode/tasks/main.yml b/roles/editor_vscode/tasks/main.yml index efb2aed..4a1f134 100644 --- a/roles/editor_vscode/tasks/main.yml +++ b/roles/editor_vscode/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Install VSCode - ansible.builtin.include_tasks: "install_{{ ansible_distribution }}.yml" + ansible.builtin.include_tasks: "install_{{ ansible_facts.pkg_mgr }}.yml" tags: install - name: Create directories for VSCode