Replace yum with apt for Debian support

main
Guillaume Dott 2022-10-05 14:55:42 +02:00
parent 65da436d74
commit ea52d31e23
3 changed files with 11 additions and 11 deletions

View File

@ -8,7 +8,7 @@ keycloak_installdir: "{{ keycloak_dest }}/keycloak-{{ keycloak_version }}"
keycloak_offline_install: False keycloak_offline_install: False
### Install location and service settings ### 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_java_home:
keycloak_dest: /opt/keycloak keycloak_dest: /opt/keycloak
keycloak_jboss_home: "{{ keycloak_installdir }}" keycloak_jboss_home: "{{ keycloak_installdir }}"

View File

@ -2,21 +2,21 @@
- name: Check packages to be installed - name: Check packages to be installed
block: block:
- name: "Check if packages are already installed" - name: "Check if packages are already installed"
ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}" ansible.builtin.command: "dpkg -s {{ packages_list | join(' ') }}"
args: args:
warn: no warn: no
register: rpm_info register: dpkg_info
changed_when: rpm_info.failed changed_when: dpkg_info.failed
rescue: rescue:
- name: "Add missing packages to the yum install list" - name: "Add missing packages to the apt install list"
ansible.builtin.set_fact: 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 when: rpm_info.failed
- name: "Install packages: {{ packages_to_install }}" - name: Install packages
become: yes become: yes
ansible.builtin.yum: ansible.builtin.apt:
name: "{{ packages_to_install }}" name: "{{ packages_to_install }}"
state: present state: present
when: packages_to_install | default([]) | length > 0 when: packages_to_install | default([]) | length > 0

View File

@ -42,5 +42,5 @@
packages_list: packages_list:
- "{{ keycloak_jvm_package }}" - "{{ keycloak_jvm_package }}"
- unzip - unzip
- procps-ng - procps
- initscripts - initscripts