Goal
Provision and maintain a Keycloak application with a PostgreSQL DB using Docker.
Roles used
-
coopdevs.sys-admins-role
to manage the sys admin users -
geerlingguy.security
to configure security -
geerlingguy.docker
to configure Docker and Docker Compose -
keycloak
to manage Docker and the Keycloak instance -
coopdevs.monitoring_role
to expose metrics of itself
Requirements
Pyenv and virtualenv
We use Pyenv and Virtualenv to manage the Python version and isolate the project packages and dependencies:
- Install Pyenv + Virtualenv
curl https://pyenv.run | bash
- Install Python
pyenv install 3.9.13
- Create a virtualenv:
pyenv virtualenv 3.9.13 keycloak-provisioning
- Install Ansible and Galaxy dependencies:
pip install -r requirements.txt
ansible-galaxy install -r requirements.yml
Usage
- Execute SysAdmin playbook as root user the first time (⚠️ Only the first time ⚠️):
# First time
ansible-playbook playbooks/sys_admins.yml -l dev -u root
# Next times
ansible-playbook playbooks/sys_admins.yml -l dev
- Execute Provision
ansible-playbook playbooks/provision.yml -l dev
Development
Install devenv to run a local lxc container.
devenv
Once provisioned you'll have a Keycloak at http://keycloak.local:8080