Replace yum with apt for Debian support

Guillaume Dott 2022-10-05 14:55:42 +02:00
parent 65da436d74
commit 91b37a910e
2 changed files with 9 additions and 9 deletions

View File

@ -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 }}"

View File

@ -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
when: packages_to_install | default([]) | length > 0