mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2026-08-01 04:14:48 +00:00
Fixing linting issues
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: "Initialize configuration key store variables to be written"
|
||||
ansible.builtin.set_fact:
|
||||
store_items:
|
||||
keycloak_quarkus_store_items:
|
||||
- key: "kc.db-password"
|
||||
value: "{{ keycloak_quarkus_db_pass }}"
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
changed_when: keycloak_quarkus_show_deprecation_warnings
|
||||
ansible.builtin.set_fact:
|
||||
keycloak_quarkus_https_key_store_file: "{{ keycloak_quarkus_key_store_file }}"
|
||||
deprecated_variable: "keycloak_quarkus_key_store_file" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_key_store_file" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
changed_when: keycloak_quarkus_show_deprecation_warnings
|
||||
ansible.builtin.set_fact:
|
||||
keycloak_quarkus_https_key_store_password: "{{ keycloak_quarkus_key_store_password }}"
|
||||
deprecated_variable: "keycloak_quarkus_key_store_password" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_key_store_password" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
run_once: true
|
||||
changed_when: keycloak_quarkus_show_deprecation_warnings
|
||||
ansible.builtin.set_fact:
|
||||
deprecated_variable: "keycloak_quarkus_proxy_mode" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_proxy_mode" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
changed_when: keycloak_quarkus_show_deprecation_warnings
|
||||
ansible.builtin.set_fact:
|
||||
keycloak_quarkus_hostname: "{{ keycloak_quarkus_frontend_url }}"
|
||||
deprecated_variable: "keycloak_quarkus_frontend_url" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_frontend_url" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
{% set protocol = 'http://' %}
|
||||
{% endif %}
|
||||
{{ protocol }}{{ keycloak_quarkus_host }}:{{ keycloak_quarkus_port }}/{{ keycloak_quarkus_path }}
|
||||
deprecated_variable: "keycloak_quarkus_hostname_strict_https or keycloak_quarkus_frontend_url or keycloak_quarkus_frontend_url or keycloak_quarkus_hostname" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_hostname_strict_https or keycloak_quarkus_frontend_url or keycloak_quarkus_frontend_url or keycloak_quarkus_hostname" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
changed_when: keycloak_quarkus_show_deprecation_warnings
|
||||
ansible.builtin.set_fact:
|
||||
keycloak_quarkus_hostname_admin: "{{ keycloak_quarkus_admin_url }}"
|
||||
deprecated_variable: "keycloak_quarkus_admin_url" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_admin_url" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
changed_when: keycloak_quarkus_show_deprecation_warnings
|
||||
ansible.builtin.set_fact:
|
||||
keycloak_quarkus_hostname_backchannel_dynamic: "{{ keycloak_quarkus_hostname_strict_backchannel == False }}"
|
||||
deprecated_variable: "keycloak_quarkus_hostname_backchannel_dynamic" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_hostname_backchannel_dynamic" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
changed_when: keycloak_quarkus_show_deprecation_warnings
|
||||
ansible.builtin.set_fact:
|
||||
keycloak_quarkus_bootstrap_admin_user: "{{ keycloak_quarkus_admin_user }}"
|
||||
deprecated_variable: "keycloak_quarkus_admin_user" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_admin_user" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
changed_when: keycloak_quarkus_show_deprecation_warnings
|
||||
ansible.builtin.set_fact:
|
||||
keycloak_quarkus_bootstrap_admin_user: "{{ keycloak_quarkus_admin_pass }}"
|
||||
deprecated_variable: "keycloak_quarkus_admin_pass" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_admin_pass" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
changed_when: keycloak_quarkus_show_deprecation_warnings
|
||||
ansible.builtin.set_fact:
|
||||
keycloak_quarkus_http_host: "{{ keycloak_quarkus_bind_address }}"
|
||||
deprecated_variable: "keycloak_quarkus_bind_address" # read in deprecation handler
|
||||
keycloak_quarkus_deprecated_variable: "keycloak_quarkus_bind_address" # read in deprecation handler
|
||||
notify:
|
||||
- print deprecation warning
|
||||
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
---
|
||||
- name: "Check if packages are already installed" # noqa command-instead-of-module this runs faster
|
||||
ansible.builtin.command: "rpm -q {{ packages_list | join(' ') }}"
|
||||
register: rpm_info
|
||||
register: keycloak_quarkus_rpm_info
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when: ansible_facts.os_family == "RedHat"
|
||||
|
||||
- name: "Add missing packages to the yum install list"
|
||||
ansible.builtin.set_fact:
|
||||
packages_to_install: "{{ packages_to_install | default([]) + rpm_info.stdout_lines | \
|
||||
keycloak_quarkus_packages_to_install: "{{ keycloak_quarkus_packages_to_install | default([]) + keycloak_quarkus_rpm_info.stdout_lines | \
|
||||
map('regex_findall', 'package (.+) is not installed$') | default([]) | flatten }}"
|
||||
when: ansible_facts.os_family == "RedHat"
|
||||
|
||||
- name: "Install packages: {{ packages_to_install }}"
|
||||
- name: "Install packages: {{ keycloak_quarkus_packages_to_install }}"
|
||||
become: "{{ keycloak_quarkus_fastpackages_require_privilege_escalation | default(true) }}"
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ packages_to_install }}"
|
||||
name: "{{ keycloak_quarkus_packages_to_install }}"
|
||||
state: present
|
||||
when:
|
||||
- packages_to_install | default([]) | length > 0
|
||||
- keycloak_quarkus_packages_to_install | default([]) | length > 0
|
||||
- ansible_facts.os_family == "RedHat"
|
||||
|
||||
- name: "Install packages: {{ packages_list }}"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: "Configure firewall for {{ keycloak.service_name }} http port"
|
||||
- name: "Configure firewall for http port: {{ keycloak.service_name }}"
|
||||
become: "{{ keycloak_quarkus_firewalld_require_privilege_escalation | default(true) }}"
|
||||
ansible.posix.firewalld:
|
||||
port: "{{ item }}"
|
||||
@@ -23,7 +23,7 @@
|
||||
- "{{ keycloak_quarkus_http_port }}/tcp"
|
||||
when: keycloak_quarkus_http_enabled | bool
|
||||
|
||||
- name: "Configure firewall for {{ keycloak.service_name }} ports"
|
||||
- name: "Configure firewall for ports: {{ keycloak.service_name }}"
|
||||
become: "{{ keycloak_quarkus_firewalld_require_privilege_escalation | default(true) }}"
|
||||
ansible.posix.firewalld:
|
||||
port: "{{ item }}"
|
||||
|
||||
@@ -8,25 +8,25 @@
|
||||
- keycloak_quarkus_archive is defined
|
||||
- keycloak_quarkus_download_url is defined
|
||||
- keycloak_quarkus_version is defined
|
||||
- local_path is defined
|
||||
- keycloak_quarkus_local_path is defined
|
||||
quiet: true
|
||||
|
||||
- name: Check for an existing deployment
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
ansible.builtin.stat:
|
||||
path: "{{ keycloak.home }}"
|
||||
register: existing_deploy
|
||||
register: keycloak_quarkus_existing_deploy
|
||||
|
||||
- name: Stop and restart if existing deployment exists and install forced
|
||||
when: existing_deploy.stat.exists and keycloak_quarkus_force_install | bool
|
||||
when: keycloak_quarkus_existing_deploy.stat.exists and keycloak_quarkus_force_install | bool
|
||||
block:
|
||||
- name: "Stop the old {{ keycloak.service_name }} service"
|
||||
- name: "Stop the old service: {{ keycloak.service_name }}"
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
failed_when: false
|
||||
ansible.builtin.systemd:
|
||||
name: keycloak
|
||||
state: stopped
|
||||
- name: "Remove the old {{ keycloak.service_name }} deployment"
|
||||
- name: "Remove the old deployment: {{ keycloak.service_name }}"
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
ansible.builtin.file:
|
||||
path: "{{ keycloak_quarkus_home }}"
|
||||
@@ -36,9 +36,9 @@
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
ansible.builtin.stat:
|
||||
path: "{{ keycloak_quarkus_home }}"
|
||||
register: existing_deploy
|
||||
register: keycloak_quarkus_existing_deploy
|
||||
|
||||
- name: "Create {{ keycloak.service_name }} service user/group"
|
||||
- name: "Create service user/group: {{ keycloak.service_name }}"
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
ansible.builtin.user:
|
||||
name: "{{ keycloak.service_user }}"
|
||||
@@ -46,7 +46,7 @@
|
||||
system: true
|
||||
create_home: false
|
||||
|
||||
- name: "Create {{ keycloak.service_name }} install location"
|
||||
- name: "Create install location: {{ keycloak.service_name }}"
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
ansible.builtin.file:
|
||||
dest: "{{ keycloak_quarkus_dest }}"
|
||||
@@ -65,29 +65,30 @@
|
||||
## check remote archive
|
||||
- name: Set download archive path
|
||||
ansible.builtin.set_fact:
|
||||
archive: "{{ keycloak_quarkus_dest }}/{{ keycloak.bundle }}"
|
||||
keycloak_quarkus_archive_full_path: "{{ keycloak_quarkus_dest }}/{{ keycloak.bundle }}"
|
||||
|
||||
- name: Check download archive path
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
ansible.builtin.stat:
|
||||
path: "{{ archive }}"
|
||||
register: archive_path
|
||||
path: "{{ keycloak_quarkus_archive_full_path }}"
|
||||
register: keycloak_quarkus_archive_path
|
||||
|
||||
## download to controller
|
||||
- name: Download keycloak archive
|
||||
ansible.builtin.get_url: # noqa risky-file-permissions delegated, uses controller host user
|
||||
url: "{{ keycloak_quarkus_download_url }}"
|
||||
dest: "{{ local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
dest: "{{ keycloak_quarkus_local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
mode: '0640'
|
||||
url_username: "{{ keycloak_quarkus_binary_download_user | default(omit) }}"
|
||||
url_password: "{{ keycloak_quarkus_binary_download_pass | default(omit) }}"
|
||||
validate_certs: false
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
run_once: true
|
||||
when:
|
||||
- archive_path is defined
|
||||
- archive_path.stat is defined
|
||||
- not archive_path.stat.exists
|
||||
- keycloak_quarkus_archive_path is defined
|
||||
- keycloak_quarkus_archive_path.stat is defined
|
||||
- not keycloak_quarkus_archive_path.stat.exists
|
||||
- not keycloak.offline_install
|
||||
- not rhbk_enable is defined or not rhbk_enable
|
||||
|
||||
@@ -95,9 +96,9 @@
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
when:
|
||||
- archive_path is defined
|
||||
- archive_path.stat is defined
|
||||
- not archive_path.stat.exists
|
||||
- keycloak_quarkus_archive_path is defined
|
||||
- keycloak_quarkus_archive_path.stat is defined
|
||||
- not keycloak_quarkus_archive_path.stat.exists
|
||||
- rhbk_enable is defined and rhbk_enable
|
||||
- not keycloak.offline_install
|
||||
- keycloak_quarkus_alternate_download_url is undefined
|
||||
@@ -109,14 +110,14 @@
|
||||
product_type: DISTRIBUTION
|
||||
product_version: "{{ rhbk_version }}"
|
||||
product_category: "{{ rhbk_product_category }}"
|
||||
register: rhn_products
|
||||
register: keycloak_quarkus_rhn_products
|
||||
no_log: "{{ omit_rhn_output | default(true) }}"
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
|
||||
- name: Determine install zipfile from search results
|
||||
ansible.builtin.set_fact:
|
||||
rhn_filtered_products: "{{ rhn_products.results | selectattr('file_name', 'match', '[^/]*/' + rhbk_archive + '$') }}"
|
||||
keycloak_quarkus_rhn_filtered_products: "{{ keycloak_quarkus_rhn_products.results | selectattr('file_name', 'match', '[^/]*/' + rhbk_archive + '$') }}"
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
|
||||
@@ -125,7 +126,7 @@
|
||||
client_id: "{{ rhn_username }}"
|
||||
client_secret: "{{ rhn_password }}"
|
||||
product_id: "{{ (rhn_filtered_products | first).id }}"
|
||||
dest: "{{ local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
dest: "{{ keycloak_quarkus_local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
mode: '0640'
|
||||
no_log: "{{ omit_rhn_output | default(true) }}"
|
||||
delegate_to: localhost
|
||||
@@ -137,15 +138,15 @@
|
||||
run_once: true
|
||||
become: false
|
||||
when:
|
||||
- archive_path is defined
|
||||
- archive_path.stat is defined
|
||||
- not archive_path.stat.exists
|
||||
- keycloak_quarkus_archive_path is defined
|
||||
- keycloak_quarkus_archive_path.stat is defined
|
||||
- not keycloak_quarkus_archive_path.stat.exists
|
||||
- rhbk_enable is defined and rhbk_enable
|
||||
- not keycloak.offline_install
|
||||
- keycloak_quarkus_alternate_download_url is defined
|
||||
ansible.builtin.get_url: # noqa risky-file-permissions delegated, uses controller host user
|
||||
url: "{{ keycloak_quarkus_alternate_download_url }}"
|
||||
dest: "{{ local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
dest: "{{ keycloak_quarkus_local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
mode: '0640'
|
||||
url_username: "{{ keycloak_quarkus_download_user | default(omit) }}"
|
||||
url_password: "{{ keycloak_quarkus_download_pass | default(omit) }}"
|
||||
@@ -153,8 +154,8 @@
|
||||
|
||||
- name: Check downloaded archive
|
||||
ansible.builtin.stat:
|
||||
path: "{{ local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
register: local_archive_path
|
||||
path: "{{ keycloak_quarkus_local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
register: keycloak_quarkus_local_archive_path
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
run_once: true
|
||||
@@ -162,35 +163,35 @@
|
||||
## copy and unpack
|
||||
- name: Copy archive to target nodes
|
||||
ansible.builtin.copy:
|
||||
src: "{{ local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
dest: "{{ archive }}"
|
||||
src: "{{ keycloak_quarkus_local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
dest: "{{ keycloak_quarkus_archive_full_path }}"
|
||||
owner: "{{ keycloak.service_user }}"
|
||||
group: "{{ keycloak.service_group }}"
|
||||
mode: '0640'
|
||||
register: new_version_downloaded
|
||||
register: keycloak_quarkus_new_version_downloaded
|
||||
when:
|
||||
- not archive_path.stat.exists
|
||||
- local_archive_path.stat is defined
|
||||
- local_archive_path.stat.exists
|
||||
- not keycloak_quarkus_archive_path.stat.exists
|
||||
- keycloak_quarkus_local_archive_path.stat is defined
|
||||
- keycloak_quarkus_local_archive_path.stat.exists
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
|
||||
- name: "Check target directory: {{ keycloak.home }}/bin/"
|
||||
- name: "Check target directory /bin/: {{ keycloak.home }}"
|
||||
ansible.builtin.stat:
|
||||
path: "{{ keycloak.home }}/bin/"
|
||||
register: path_to_workdir
|
||||
register: keycloak_quarkus_path_to_workdir
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
|
||||
- name: "Extract Keycloak archive on target" # noqa no-handler need to run this here
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "{{ archive }}"
|
||||
src: "{{ keycloak_quarkus_archive_full_path }}"
|
||||
dest: "{{ keycloak_quarkus_dest }}"
|
||||
creates: "{{ keycloak.home }}/bin/"
|
||||
owner: "{{ keycloak.service_user }}"
|
||||
group: "{{ keycloak.service_group }}"
|
||||
become: "{{ keycloak_quarkus_install_require_privilege_escalation | default(true) }}"
|
||||
when:
|
||||
- (not path_to_workdir.stat.exists) or new_version_downloaded.changed
|
||||
- (not keycloak_quarkus_path_to_workdir.stat.exists) or keycloak_quarkus_new_version_downloaded.changed
|
||||
notify:
|
||||
- restart keycloak
|
||||
|
||||
@@ -198,7 +199,7 @@
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ keycloak.home }} already exists and version unchanged, skipping decompression"
|
||||
when:
|
||||
- (not new_version_downloaded.changed) and path_to_workdir.stat.exists
|
||||
- (not keycloak_quarkus_new_version_downloaded.changed) and keycloak_quarkus_path_to_workdir.stat.exists
|
||||
|
||||
- name: "Copy private key to target"
|
||||
ansible.builtin.copy:
|
||||
@@ -226,7 +227,7 @@
|
||||
- keycloak_quarkus_cert_file_copy_enabled is defined and keycloak_quarkus_cert_file_copy_enabled
|
||||
- keycloak_quarkus_cert_file_src | length > 0
|
||||
|
||||
- name: "Install {{ keycloak_quarkus_db_engine }} JDBC driver"
|
||||
- name: "Install JDBC driver: {{ keycloak_quarkus_db_engine }}"
|
||||
ansible.builtin.include_tasks: jdbc_driver.yml
|
||||
when:
|
||||
- rhbk_enable is defined and rhbk_enable
|
||||
@@ -254,7 +255,7 @@
|
||||
version: "{{ item.maven.version | default(omit) }}"
|
||||
username: "{{ item.maven.username | default(omit) }}"
|
||||
password: "{{ item.maven.password | default(omit) }}"
|
||||
dest: "{{ local_path.stat.path }}/{{ item.id }}.jar"
|
||||
dest: "{{ keycloak_quarkus_local_path.stat.path }}/{{ item.id }}.jar"
|
||||
delegate_to: "localhost"
|
||||
run_once: true
|
||||
loop: "{{ keycloak_quarkus_providers }}"
|
||||
@@ -263,7 +264,7 @@
|
||||
|
||||
- name: "Copy maven providers"
|
||||
ansible.builtin.copy:
|
||||
src: "{{ local_path.stat.path }}/{{ item.id }}.jar"
|
||||
src: "{{ keycloak_quarkus_local_path.stat.path }}/{{ item.id }}.jar"
|
||||
dest: "{{ keycloak.home }}/providers/{{ item.id }}.jar"
|
||||
owner: "{{ keycloak.service_user }}"
|
||||
group: "{{ keycloak.service_group }}"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# you can do so by deleting the data/tmp/kc-gzip-cache directory of the server distribution
|
||||
# It can be useful for instance if you redeployed custom providers or custom themes without
|
||||
# disabling themes caching in the previous server executions.
|
||||
- name: "Delete {{ keycloak.service_name }} theme cache directory"
|
||||
- name: "Delete theme cache directory: {{ keycloak.service_name }}"
|
||||
ansible.builtin.file:
|
||||
path: "{{ keycloak.home }}/data/tmp/kc-gzip-cache"
|
||||
state: absent
|
||||
|
||||
@@ -123,13 +123,13 @@
|
||||
- name: Check service status
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ keycloak.service_name }}"
|
||||
register: keycloak_service_status
|
||||
register: keycloak_quarkus_service_status
|
||||
changed_when: false
|
||||
|
||||
- name: "Notify to remove `keycloak_quarkus_bootstrap_admin_user[_password]` env vars"
|
||||
when:
|
||||
- not ansible_local.keycloak.general.bootstrapped | default(false) | bool # it was not bootstrapped prior to the current role's execution
|
||||
- keycloak_service_status.status.ActiveState == "active" # but it is now
|
||||
- keycloak_quarkus_service_status.status.ActiveState == "active" # but it is now
|
||||
ansible.builtin.assert: { that: true, quiet: true }
|
||||
changed_when: true
|
||||
notify:
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
- name: Check local download archive path
|
||||
ansible.builtin.stat:
|
||||
path: "{{ keycloak_quarkus_download_path }}"
|
||||
register: local_path
|
||||
register: keycloak_quarkus_local_path
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
become: false
|
||||
@@ -65,9 +65,9 @@
|
||||
- name: Validate local download path
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- local_path.stat.exists
|
||||
- local_path.stat.readable
|
||||
- keycloak_quarkus_offline_install or local_path.stat.writeable
|
||||
- keycloak_quarkus_local_path.stat.exists
|
||||
- keycloak_quarkus_local_path.stat.readable
|
||||
- keycloak_quarkus_offline_install or keycloak_quarkus_local_path.stat.writeable
|
||||
quiet: true
|
||||
fail_msg: "Defined controller path for downloading resources is incorrect or unreadable: {{ keycloak_quarkus_download_path }}"
|
||||
success_msg: "Will download resource to controller path: {{ keycloak_quarkus_download_path }}"
|
||||
@@ -76,20 +76,20 @@
|
||||
|
||||
- name: Check downloaded archive if offline
|
||||
ansible.builtin.stat:
|
||||
path: "{{ local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
path: "{{ keycloak_quarkus_local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
when: keycloak_quarkus_offline_install
|
||||
register: local_archive_path_check
|
||||
register: keycloak_quarkus_local_archive_path_check
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
|
||||
- name: Validate local downloaded archive if offline
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- local_archive_path_check.stat.exists
|
||||
- local_archive_path_check.stat.readable
|
||||
- keycloak_quarkus_local_archive_path_check.stat.exists
|
||||
- keycloak_quarkus_local_archive_path_check.stat.readable
|
||||
quiet: true
|
||||
fail_msg: "Configured for offline install but install archive not found at: {{ local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
success_msg: "Will install offline with expected archive: {{ local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
fail_msg: "Configured for offline install but install archive not found at: {{ keycloak_quarkus_local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
success_msg: "Will install offline with expected archive: {{ keycloak_quarkus_local_path.stat.path }}/{{ keycloak.bundle }}"
|
||||
when: keycloak_quarkus_offline_install
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
@@ -100,11 +100,11 @@
|
||||
- name: "Check run keytool"
|
||||
changed_when: false
|
||||
ansible.builtin.command: keytool -help
|
||||
register: keytool_check
|
||||
register: keycloak_quarkus_keytool_check
|
||||
ignore_errors: true
|
||||
|
||||
- name: "Fail when no keytool found"
|
||||
when: keytool_check.rc != 0
|
||||
when: keycloak_quarkus_keytool_check.rc != 0
|
||||
ansible.builtin.fail:
|
||||
msg: "keytool NOT found in the PATH, but is required for setting up the configuration key store"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
# cf. https://www.keycloak.org/server/configuration#_optimize_the_keycloak_startup
|
||||
- name: "Rebuild {{ keycloak.service_name }} config"
|
||||
- name: "Rebuild config: {{ keycloak.service_name }}"
|
||||
ansible.builtin.shell: | # noqa blocked_modules shell is necessary here
|
||||
env -i bash -c "set -a ; source {{ keycloak_quarkus_sysconf_file }} ; {{ keycloak.home }}/bin/kc.sh build "
|
||||
become: "{{ keycloak_quarkus_rebuild_config_require_privilege_escalation | default(true) }}"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
- name: "Restart and enable {{ keycloak.service_name }} service"
|
||||
- name: "Restart and enable service: {{ keycloak.service_name }}"
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ keycloak.service_name }}"
|
||||
enabled: true
|
||||
@@ -7,11 +7,11 @@
|
||||
daemon_reload: true
|
||||
become: "{{ keycloak_quarkus_restart_require_privilege_escalation | default(true) }}"
|
||||
|
||||
- name: "Wait until {{ keycloak.service_name }} service becomes active {{ keycloak.health_url }}"
|
||||
- name: "Wait until service becomes active: {{ keycloak.service_name }}"
|
||||
ansible.builtin.uri:
|
||||
url: "{{ keycloak.health_url }}"
|
||||
register: keycloak_status
|
||||
until: keycloak_status.status == 200
|
||||
register: keycloak_quarkus_status
|
||||
until: keycloak_quarkus_status.status == 200
|
||||
retries: "{{ keycloak_quarkus_restart_health_check_retries }}"
|
||||
delay: "{{ keycloak_quarkus_restart_health_check_delay }}"
|
||||
when: internal_force_health_check | default(keycloak_quarkus_restart_health_check)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
- name: "Restart services in serial, with optional healtch check (keycloak_quarkus_restart_health_check)"
|
||||
throttle: 1
|
||||
block:
|
||||
- name: "Restart and enable {{ keycloak.service_name }} service"
|
||||
- name: "Restart and enable service: {{ keycloak.service_name }}"
|
||||
ansible.builtin.include_tasks:
|
||||
file: restart.yml
|
||||
apply:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Verify first restarted service with health URL, then rest restart in parallel
|
||||
block:
|
||||
- name: "Restart and enable {{ keycloak.service_name }} service on initial host"
|
||||
- name: "Restart and enable service on initial host: {{ keycloak.service_name }}"
|
||||
ansible.builtin.include_tasks:
|
||||
file: restart.yml
|
||||
apply:
|
||||
@@ -10,7 +10,7 @@
|
||||
vars:
|
||||
internal_force_health_check: true
|
||||
|
||||
- name: "Restart and enable {{ keycloak.service_name }} service on other hosts"
|
||||
- name: "Restart and enable service on other hosts: {{ keycloak.service_name }}"
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ keycloak.service_name }}"
|
||||
enabled: true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
- name: "Start {{ keycloak.service_name }} service"
|
||||
- name: "Start service: {{ keycloak.service_name }}"
|
||||
ansible.builtin.systemd:
|
||||
name: keycloak
|
||||
enabled: true
|
||||
@@ -7,11 +7,11 @@
|
||||
daemon_reload: true
|
||||
become: "{{ keycloak_quarkus_start_require_privilege_escalation | default(true) }}"
|
||||
|
||||
- name: "Wait until {{ keycloak.service_name }} becomes active {{ keycloak.health_url }}"
|
||||
- name: "Wait until service becomes active: {{ keycloak.service_name }}"
|
||||
ansible.builtin.uri:
|
||||
url: "{{ keycloak.health_url }}"
|
||||
register: keycloak_status
|
||||
until: keycloak_status.status == 200
|
||||
register: keycloak_quarkus_status
|
||||
until: keycloak_quarkus_status.status == 200
|
||||
retries: 25
|
||||
delay: 10
|
||||
when: internal_force_health_check | default(keycloak_quarkus_restart_health_check)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
- name: "Configure sysconfig file for {{ keycloak.service_name }} service"
|
||||
- name: "Configure sysconfig file for service: {{ keycloak.service_name }}"
|
||||
become: "{{ keycloak_quarkus_systemd_require_privilege_escalation | default(true) }}"
|
||||
ansible.builtin.template:
|
||||
src: keycloak-sysconfig.j2
|
||||
@@ -21,7 +21,7 @@
|
||||
group: root
|
||||
mode: '0644'
|
||||
become: "{{ keycloak_quarkus_systemd_require_privilege_escalation | default(true) }}"
|
||||
register: systemdunit
|
||||
register: keycloak_quarkus_systemdunit
|
||||
notify:
|
||||
- rebuild keycloak config
|
||||
- restart keycloak
|
||||
|
||||
Reference in New Issue
Block a user