Rewrite initd/systemd scripts interaction

main
Guido Grazioli 2021-12-14 16:01:41 +01:00
parent 26fe41595d
commit e14220a01b
3 changed files with 17 additions and 33 deletions

View File

@ -38,7 +38,7 @@ jobs:
working-directory: ./ansible_collections/middleware_automation/keycloak
- name: Run molecule test
run: molecule test --all -- -vvvvv
run: molecule test --all
working-directory: ./ansible_collections/middleware_automation/keycloak
env:
PY_COLORS: '1'

View File

@ -38,30 +38,12 @@
daemon_reload: yes
when: systemdunit.changed
- block:
- name: start keycloak
systemd:
name: keycloak
enabled: yes
state: started
become: yes
rescue:
- command: "systemctl status keycloak"
changed_when: False
ignore_errors: True
- command: "journalctl -xe -ukeycloak"
changed_when: False
ignore_errors: True
- command: "tail -n 100 /opt/keycloak/keycloak.log"
changed_when: False
ignore_errors: True
- debug:
msg: "Virt type: {{ ansible_facts.virtualization_type }} - {{ ansible_facts['virtualization_type'] }}"
changed_when: False
ignore_errors: True
- command: "cat /opt/keycloak/keycloak-service.sh"
changed_when: False
ignore_errors: True
- command: "systemctl status keycloak"
register: keycloak_service_status

View File

@ -75,14 +75,16 @@ startKeycloak() {
if [ "$(isKeyCloakRunning)" -eq 1 ]; then
statusKeycloak
else
JLAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=${KEYCLOAK_PIDFILE} ${KEYCLOAK_HOME}/bin/standalone.sh \
LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=${KEYCLOAK_PIDFILE} ${KEYCLOAK_HOME}/bin/standalone.sh \
-Djboss.bind.address=${KEYCLOAK_BIND_ADDRESS} \
-Djboss.http.port=${KEYCLOAK_HTTP_PORT} \
-Djboss.https.port=${KEYCLOAK_HTTPS_PORT} \
-Djboss.management.http.port=${KEYCLOAK_MANAGEMENT_HTTP_PORT} \
-Djboss.management.https.port=${KEYCLOAK_MANAGEMENT_HTTPS_PORT} \
-Djboss.node.name={{ inventory_hostname }} {% if ansible_facts.virtualization_type in ['docker','containerd'] %}-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true {% endif %}\
-Djboss.node.name={{ inventory_hostname }} \
{% if ansible_facts.virtualization_type in ['docker','oci','containerd'] %}-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true {% endif %}\
2>&1 >> "${KEYCLOAK_LOGFILE}" &
while [ ! -f ${KEYCLOAK_PIDFILE} ]; do sleep 1; done
fi
}