From ea52d31e23abe6c1415af17e1521e881dd87b527 Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Wed, 5 Oct 2022 14:55:42 +0200 Subject: [PATCH] Replace yum with apt for Debian support --- roles/keycloak/defaults/main.yml | 2 +- roles/keycloak/tasks/fastpackages.yml | 16 ++++++++-------- roles/keycloak/tasks/prereqs.yml | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/roles/keycloak/defaults/main.yml b/roles/keycloak/defaults/main.yml index 7bb3bb8..9cb5002 100644 --- a/roles/keycloak/defaults/main.yml +++ b/roles/keycloak/defaults/main.yml @@ -8,7 +8,7 @@ keycloak_installdir: "{{ keycloak_dest }}/keycloak-{{ keycloak_version }}" keycloak_offline_install: False ### Install location and service settings -keycloak_jvm_package: java-1.8.0-openjdk-headless +keycloak_jvm_package: openjdk-17-jdk-headless keycloak_java_home: keycloak_dest: /opt/keycloak keycloak_jboss_home: "{{ keycloak_installdir }}" diff --git a/roles/keycloak/tasks/fastpackages.yml b/roles/keycloak/tasks/fastpackages.yml index 78bc556..e068834 100644 --- a/roles/keycloak/tasks/fastpackages.yml +++ b/roles/keycloak/tasks/fastpackages.yml @@ -2,21 +2,21 @@ - name: Check packages to be installed block: - name: "Check if packages are already installed" - ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}" + ansible.builtin.command: "dpkg -s {{ packages_list | join(' ') }}" args: warn: no - register: rpm_info - changed_when: rpm_info.failed + register: dpkg_info + changed_when: dpkg_info.failed rescue: - - name: "Add missing packages to the yum install list" + - name: "Add missing packages to the apt install list" ansible.builtin.set_fact: - packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | map('regex_findall', 'package (.+) is not installed$') | flatten }}" + packages_to_install: "{{ packages_to_install | default([]) + dpkg_info.stdout_lines | map('regex_findall', 'package (.+) is not installed and no information is available$') | flatten }}" when: rpm_info.failed -- name: "Install packages: {{ packages_to_install }}" +- name: Install packages become: yes - ansible.builtin.yum: + ansible.builtin.apt: name: "{{ packages_to_install }}" state: present - when: packages_to_install | default([]) | length > 0 \ No newline at end of file + when: packages_to_install | default([]) | length > 0 diff --git a/roles/keycloak/tasks/prereqs.yml b/roles/keycloak/tasks/prereqs.yml index c774c65..81b1e4e 100644 --- a/roles/keycloak/tasks/prereqs.yml +++ b/roles/keycloak/tasks/prereqs.yml @@ -42,5 +42,5 @@ packages_list: - "{{ keycloak_jvm_package }}" - unzip - - procps-ng - - initscripts \ No newline at end of file + - procps + - initscripts