Jeremy Stanley f477e35561 Upgrade to Keycloak 23.0
This includes a switch from the "legacy" style Wildfly-based image
to a new setup using Quarkus.

Because Keycloak maintainers consider H2 databases as a test/dev
only option, there are no good migration and upgrade paths short of
export/import data. Go ahead and change our deployment model to rely
on a proper RDBMS, run locally from a container on the same server.

Change-Id: I01f8045563e9f6db6168b92c5a868b8095c0d97b
2024-02-06 05:33:37 +00:00

81 lines
1.8 KiB
YAML

- name: Ensure docker-compose directory exists
file:
state: directory
path: /etc/keycloak-docker
- name: Write settings file
template:
src: docker-compose.yaml.j2
dest: /etc/keycloak-docker/docker-compose.yaml
owner: root
group: root
mode: "0600"
notify: keycloak restart containers
# This deliberately does not set owner/group/mode, as the mariadb container
# chowns this directory to be owned by a container-internal user and drops
# root privileges. We don't want to reset this from outside the container.
- name: Ensure data directory exists
file:
state: directory
path: /var/lib/keycloak/db
- name: Copy our MariaDB config stub overriding bind-address
copy:
src: 99-bind-address.cnf
dest: /var/lib/keycloak/99-bind-address.cnf
owner: root
group: root
mode: "0644"
notify: keycloak restart containers
- name: Install apache2
apt:
name:
- apache2
- apache2-utils
state: present
- name: Apache modules
apache2_module:
state: present
name: "{{ item }}"
loop:
- rewrite
- proxy
- proxy_http
- ssl
- headers
- proxy_wstunnel
notify: keycloak restart apache2
- name: Copy apache config
template:
src: keycloak.vhost.j2
dest: /etc/apache2/sites-enabled/000-default.conf
owner: root
group: root
mode: 0644
notify: keycloak reload apache2
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/keycloak-docker/
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: /etc/keycloak-docker/
register: keycloak_dcup
- name: Wait for keycloak to start
wait_for:
host: "::1"
port: 8080
timeout: 300
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f