2021-12-14 10:26:42 +00:00
---
2022-03-24 16:44:13 +00:00
- name : Validate admin console password
ansible.builtin.assert :
that :
- keycloak_admin_password | length > 12
quiet : True
2022-05-09 13:57:12 +00:00
fail_msg : "The console administrator password is empty or invalid. Please set the keycloak_admin_password variable to a 12+ char long string"
2022-03-24 16:44:13 +00:00
success_msg : "{{ 'Console administrator password OK' }}"
2022-01-04 15:01:37 +00:00
- name : Validate configuration
2022-02-24 14:00:10 +00:00
ansible.builtin.assert :
2021-12-17 13:56:28 +00:00
that :
- (keycloak_ha_enabled and keycloak_db_enabled) or (not keycloak_ha_enabled and keycloak_db_enabled) or (not keycloak_ha_enabled and not keycloak_db_enabled)
quiet : True
2021-12-20 14:55:05 +00:00
fail_msg : "Cannot install HA setup without a backend database service. Check keycloak_ha_enabled and keycloak_db_enabled"
2021-12-17 13:56:28 +00:00
success_msg : "{{ 'Configuring HA' if keycloak_ha_enabled else 'Configuring standalone' }}"
2022-01-04 15:01:37 +00:00
- name : Validate credentials
2022-02-24 14:00:10 +00:00
ansible.builtin.assert :
2021-12-17 13:56:28 +00:00
that :
2022-01-27 11:00:11 +00:00
- (rhn_username is defined and keycloak_rhsso_enable) or not keycloak_rhsso_enable or keycloak_offline_install
- (rhn_password is defined and keycloak_rhsso_enable) or not keycloak_rhsso_enable or keycloak_offline_install
2021-12-17 13:56:28 +00:00
quiet : True
fail_msg : "Cannot install Red Hat SSO without RHN credentials. Check rhn_username and rhn_password are defined"
2022-01-27 11:00:11 +00:00
success_msg : "{{ 'Installing Red Hat Single Sign-On' if keycloak_rhsso_enable else 'Installing keycloak.org' }}"
2021-12-17 13:56:28 +00:00
2022-05-09 13:57:12 +00:00
- name : Validate persistence configuration
ansible.builtin.assert :
that :
- keycloak_jdbc_engine is defined and keycloak_jdbc_engine in [ 'postgres', 'mariadb' ]
- keycloak_jdbc_url | length > 0
- keycloak_db_user | length > 0
- keycloak_db_pass | length > 0
quiet : True
fail_msg : "Configuration for the JDBC persistence is invalid or incomplete"
success_msg : "Configuring JDBC persistence using {{ keycloak_jdbc_engine }} database"
2022-05-09 15:26:20 +00:00
when : keycloak_db_enabled
2022-05-09 13:57:12 +00:00
2022-03-24 16:44:13 +00:00
- name : Ensure required packages are installed
2022-03-11 14:57:10 +00:00
ansible.builtin.include_tasks : fastpackages.yml
2021-12-14 10:26:42 +00:00
vars :
2022-03-11 14:57:10 +00:00
packages_list :
2022-03-24 16:00:30 +00:00
- "{{ keycloak_jvm_package }}"
2022-03-11 14:57:10 +00:00
- unzip
- procps-ng
- initscripts