Skip to content

Commit a2147d0

Browse files
committed
wip: keycloak
1 parent 7b04629 commit a2147d0

File tree

8 files changed

+71
-512
lines changed

8 files changed

+71
-512
lines changed

README.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ Install the Ansible requirements.
5050
ansible-galaxy collection install -r requirements.yml
5151
----
5252

53+
== Infrastructure
54+
55+
* link:./kubernetes[Kubernetes]
56+
* link:./ocp[OpenShift Container Platform]
57+
* link:./proxmox[Proxmox]
58+
59+
== Applications
60+
61+
* link:./keycloak[Keycloak]
62+
5363
== Other considerations
5464

5565
Check the link:./_local_config/README.adoc[`_local_config`] information.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010

1111
== Kubernetes
1212

13+
link:k8s[Keycloak on Kubernetes]

keycloak/k8s/ansible/defaults/main.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ app_version: "26.1.3"
44

55
db_name: keycloak
66
db_user: keycloak
7+
db_type: postgresql
78
# storage_class: local-storage
89

910
volumes:
@@ -13,4 +14,4 @@ volumes:
1314
owner_group: 26
1415
component: database
1516

16-
db_image_tag: 14
17+
db_image_tag: 17

keycloak/k8s/helm/ansible/keycloak-install-playbook.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,29 @@
2525
state: present
2626

2727
- name: "Deploy PostgreSQL"
28-
ansible.builtin.import_playbook: pgsql/k8s/helm/ansible/pgsql-install-playbook.yaml
28+
ansible.builtin.import_playbook: ../../../../pgsql/k8s/helm/ansible/pgsql-install-playbook.yaml
2929

3030
- name: "Install KEYCLOAK"
3131
hosts: "localhost"
3232
gather_facts: "{{ gathering_host_info | default('true') | bool == true }}"
3333

3434
tasks:
35+
36+
- name: "Template Keycloak Helm values file"
37+
ansible.builtin.template:
38+
src: "helm-keycloak-values.yaml.j2"
39+
dest: "/tmp/helm-keycloak-values.yaml"
40+
mode: '0644'
41+
3542
- name: "Deploy Keycloak with Helm"
3643
kubernetes.core.helm:
3744
name: "{{ app_name }}"
3845
chart_ref: "{{ trikora_helm_project_dir }}/charts/keycloak"
3946
release_namespace: "{{ app_namespace }}"
4047
wait: true
41-
# replace: true
48+
replace: true
4249
values_files:
43-
- /tmp/helm-keycloak-keycloak-values.yaml
50+
- "/tmp/helm-keycloak-values.yaml"
4451
register: keycloak_helm_res
4552

4653
- name: "Print Helm chart result"

keycloak/k8s/helm/ansible/keycloak-uninstall-playbook.yaml

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,50 +14,26 @@
1414

1515
tasks:
1616

17-
- name: "Uninstall GLPI with Helm"
17+
- name: "Uninstall Keycloak chart"
1818
kubernetes.core.helm:
19-
name: glpi
19+
name: "{{ app_name }}"
2020
release_namespace: "{{ app_namespace }}"
2121
state: absent
2222
wait: true
2323
register: glpi_helm_res
2424

25-
# - name: "Uninstall GLPI with Helm"
26-
# ansible.builtin.shell: |
27-
# helm uninstall --namespace glpi glpi
28-
# args:
29-
# chdir: "{{ trikora_helm_project_dir }}"
30-
# register: glpi_helm_res
31-
32-
- name: "Print GLPI uninstall result"
33-
ansible.builtin.debug:
34-
msg:
35-
- "glpi_helm_res: {{ glpi_helm_res }}"
36-
37-
- name: "Free the GLPI PV so they become available"
38-
ansible.builtin.shell: |
39-
kubectl patch pv {{ app_namespace }}-{{ item }}-pv -p '{"spec":{"claimRef": null}}'
40-
# kubernetes.core.k8s:
41-
# kind: PV
42-
# name: "{{ app_namespace }}-{{ item }}-pv"
43-
# definition:
44-
# spec:
45-
# claimRef: null
46-
loop:
47-
- glpi-config
48-
- glpi-files
49-
- glpi-log
50-
- glpi-marketplace
51-
- glpi-plugins
52-
53-
- name: "Patch the GLPI PV so they will be bound to the correct PVC"
54-
ansible.builtin.shell: |
55-
kubectl patch pv {{ app_namespace }}-{{ item }}-pv -p '{"spec":{"claimRef": {"name": "{{ item }}", "namespace": "{{ app_namespace }}"}}}'
56-
loop:
57-
- glpi-config
58-
- glpi-files
59-
- glpi-log
60-
- glpi-marketplace
61-
- glpi-plugins
25+
- name: "Uninstall PostgreSQL chart"
26+
kubernetes.core.helm:
27+
name: "postgresql"
28+
release_namespace: "{{ app_namespace }}"
29+
state: absent
30+
wait: true
31+
register: glpi_helm_res
6232

33+
- name: "Remove keycloak namespace"
34+
kubernetes.core.k8s:
35+
name: "{{ app_namespace }}"
36+
api_version: v1
37+
kind: Namespace
38+
state: absent
6339
...

keycloak/k8s/helm/ansible/templates/helm-keycloak-values.yaml.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ ingress:
1414
serviceName: http
1515
servicePort: 8080
1616

17+
persistence:
18+
dbType: {{ db_type }}
19+
dbPort: {{ db_port }}
20+
dbName: {{ db_name }}
21+
dbUser: {{ db_user }}}
22+
dbPassword: {{ db_password }}

keycloak/k8s/helm/ansible/templates/helm-postgresql-values.yaml.j2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,4 @@ persistence:
6969
dbUser: {{ db_user | default('keycloak') }}
7070
dbPassword: {{ db_password }}
7171
dbDataSize: 10Gi
72-
#mountPath: "/var/lib/mysql:Z"
73-
dbPassword: {{ db_password }}
7472
localDbUser: 1

0 commit comments

Comments
 (0)