This commit is contained in:
Guido Grazioli 2024-03-25 10:19:28 +01:00
parent dd6171f024
commit 3b1534d700
6 changed files with 9 additions and 44 deletions

View file

@ -1,6 +1,6 @@
---
- name: Include firewall config tasks
ansible.builtin.include_tasks: iptables.yml
when: keycloak_configure_iptables
when: keycloak_quarkus_configure_iptables
tags:
- firewall

View file

@ -13,7 +13,7 @@
- name: "Install packages: {{ packages_to_install }}"
become: true
ansible.builtin.yum:
ansible.builtin.dnf:
name: "{{ packages_to_install }}"
state: present
when:

View file

@ -4,16 +4,10 @@
ansible.builtin.include_tasks: prereqs.yml
tags:
- prereqs
- always
- name: Debian specific tasks
ansible.builtin.include_tasks: debian.yml
when: ansible_facts.os_family == "Debian"
tags:
- unbound
- name: RedHat specific tasks
ansible.builtin.include_tasks: redhat.yml
when: ansible_facts.os_family == "RedHat"
ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml"
tags:
- unbound

View file

@ -1,43 +1,14 @@
---
- name: Determine JAVA_HOME for selected JVM RPM
ansible.builtin.set_fact:
rpm_java_home: "/etc/alternatives/jre_{{ keycloak_quarkus_jvm_package | regex_search('(?<=java-)[0-9.]+') }}"
when:
- ansible_facts.os_family == "RedHat"
- name: Determine JAVA_HOME for selected JVM RPM
ansible.builtin.set_fact:
rpm_java_home: "/lib/jvm/java-{{ keycloak_quarkus_jvm_package | regex_search('(?!:openjdk-)[0-9.]+') }}-openjdk-{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
when:
- ansible_facts.os_family == "Debian"
- name: "Configure sysconfig file for {{ keycloak.service_name }} service"
become: true
ansible.builtin.template:
src: keycloak-sysconfig.j2
dest: /etc/default/keycloak
dest: "{{ keycloak_quarkus_sysconf_file }}"
owner: root
group: root
mode: 0644
vars:
keycloak_rpm_java_home: "{{ rpm_java_home }}"
when:
- ansible_facts.os_family == "Debian"
notify:
- restart keycloak
- name: "Configure sysconfig file for {{ keycloak.service_name }} service"
become: true
ansible.builtin.template:
src: keycloak-sysconfig.j2
dest: /etc/sysconfig/keycloak
owner: root
group: root
mode: 0644
vars:
keycloak_rpm_java_home: "{{ rpm_java_home }}"
when:
- ansible_facts.os_family == "RedHat"
keycloak_pkg_java_home: "{{ keycloak_quarkus_pkg_java_home }}"
notify:
- restart keycloak

View file

@ -1,6 +1,6 @@
{{ ansible_managed | comment }}
KEYCLOAK_ADMIN={{ keycloak_quarkus_admin_user }}
KEYCLOAK_ADMIN_PASSWORD='{{ keycloak_quarkus_admin_pass }}'
PATH={{ keycloak_quarkus_java_home | default(keycloak_rpm_java_home, true) }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
JAVA_HOME={{ keycloak_quarkus_java_home | default(keycloak_rpm_java_home, true) }}
PATH={{ keycloak_quarkus_java_home | default(keycloak_pkg_java_home, true) }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
JAVA_HOME={{ keycloak_quarkus_java_home | default(keycloak_pkg_java_home, true) }}
JAVA_OPTS_APPEND={{ keycloak_quarkus_java_opts }}

View file

@ -5,7 +5,7 @@ After=network.target
[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/keycloak
EnvironmentFile=-{{ keycloak_quarkus_sysconf_file }}
PIDFile={{ keycloak_quarkus_service_pidfile }}
{% if keycloak_quarkus_start_dev %}
ExecStart={{ keycloak.home }}/bin/kc.sh start-dev