Now `update` variable is split in `updatethemes`, `updatemodule` and `updateear` to fine tune the behavior. New refactoring will split the entire role in 3 with common tasks
This commit is contained in:
parent
250db48e09
commit
2f4f3b22b4
|
@ -3,4 +3,6 @@ keycloak_home: "/opt/keycloak/keycloak-10.0.2"
|
||||||
keycloak_modules: "{{ keycloak_home }}/modules"
|
keycloak_modules: "{{ keycloak_home }}/modules"
|
||||||
keycloak_themes: "{{ keycloak_home }}/themes"
|
keycloak_themes: "{{ keycloak_home }}/themes"
|
||||||
keycloak_deployments: "{{ keycloak_home }}/standalone/deployments"
|
keycloak_deployments: "{{ keycloak_home }}/standalone/deployments"
|
||||||
update: false
|
updatethemes: true
|
||||||
|
updatemodule: false
|
||||||
|
updateear: false
|
||||||
|
|
|
@ -8,10 +8,16 @@
|
||||||
state: stopped
|
state: stopped
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: "Git checkout of d4sceicne themes"
|
- name: "Check if the themes are already installed"
|
||||||
|
stat:
|
||||||
|
path: "{{ keycloak_themes }}/d4science"
|
||||||
|
register: d4sciencethemes
|
||||||
|
|
||||||
|
- name: "Git checkout of d4science themes"
|
||||||
git:
|
git:
|
||||||
repo: 'https://code-repo.d4science.org/gCubeSystem/d4science-keycloak-themes.git'
|
repo: 'https://code-repo.d4science.org/gCubeSystem/d4science-keycloak-themes.git'
|
||||||
dest: "/tmp/checkout/d4science-keycloak-themes"
|
dest: "/tmp/checkout/d4science-keycloak-themes"
|
||||||
|
when: not d4sciencethemes.stat.exists or updatethemes
|
||||||
|
|
||||||
- name: "Copy themes in the proper folder"
|
- name: "Copy themes in the proper folder"
|
||||||
copy:
|
copy:
|
||||||
|
@ -22,17 +28,18 @@
|
||||||
directory_mode: "yes"
|
directory_mode: "yes"
|
||||||
mode: "u=rwx,g=rwx,o="
|
mode: "u=rwx,g=rwx,o="
|
||||||
remote_src: "yes"
|
remote_src: "yes"
|
||||||
|
when: not d4sciencethemes.stat.exists or updatethemes
|
||||||
|
|
||||||
- name: "Check if the avatar-storage module is already installed"
|
- name: "Check if the avatar-storage module is already installed"
|
||||||
stat:
|
stat:
|
||||||
path: "{{ keycloak_modules }}/org/gcube/keycloak/avatar-storage/main"
|
path: "{{ keycloak_modules }}/org/gcube/keycloak/avatar-storage/main"
|
||||||
register: storagemodule
|
register: storagemodule
|
||||||
|
|
||||||
- name "Remove old avatar-storage module"
|
- name: "Remove old avatar-storage module"
|
||||||
ansible.builtin.file:
|
file:
|
||||||
path: "{{ keycloak_modules }}/org/gcube/keycloak/avatar-storage"
|
path: "{{ keycloak_modules }}/org/gcube/keycloak/avatar-storage"
|
||||||
state: absent
|
state: absent
|
||||||
when: storagemodule.stat.exists and update
|
when: storagemodule.stat.exists and updatemodule
|
||||||
|
|
||||||
- name: "Download avatar-storage JAR from Maven repo"
|
- name: "Download avatar-storage JAR from Maven repo"
|
||||||
maven_artifact:
|
maven_artifact:
|
||||||
|
@ -42,13 +49,13 @@
|
||||||
repository_url: 'https://maven.research-infrastructures.eu/nexus/content/repositories/gcube-staging-jenkins'
|
repository_url: 'https://maven.research-infrastructures.eu/nexus/content/repositories/gcube-staging-jenkins'
|
||||||
dest: "/tmp/avatar-storage.jar"
|
dest: "/tmp/avatar-storage.jar"
|
||||||
verify_checksum: "always"
|
verify_checksum: "always"
|
||||||
when: not storagemodule.stat.exists or update
|
when: not storagemodule.stat.exists or updatemodule
|
||||||
|
|
||||||
- name: "Install avatar-storage Keycloak module"
|
- name: "Install avatar-storage Keycloak module"
|
||||||
shell:
|
shell:
|
||||||
cmd: './bin/jboss-cli.sh --command="module add --name=org.gcube.keycloak.avatar-storage --resources=/tmp/avatar-storage.jar --dependencies=org.keycloak.keycloak-core,org.keycloak.keycloak-services,org.keycloak.keycloak-server-spi,org.keycloak.keycloak-server-spi-private,org.jboss.logging"'
|
cmd: './bin/jboss-cli.sh --command="module add --name=org.gcube.keycloak.avatar-storage --resources=/tmp/avatar-storage.jar --dependencies=org.keycloak.keycloak-core,org.keycloak.keycloak-services,org.keycloak.keycloak-server-spi,org.keycloak.keycloak-server-spi-private,org.jboss.logging"'
|
||||||
chdir: "{{ keycloak_home }}"
|
chdir: "{{ keycloak_home }}"
|
||||||
when: not storagemodule.stat.exists or update
|
when: not storagemodule.stat.exists or updatemodule
|
||||||
|
|
||||||
- name: "Switch ON Keycloak server instance"
|
- name: "Switch ON Keycloak server instance"
|
||||||
service:
|
service:
|
||||||
|
@ -58,7 +65,7 @@
|
||||||
|
|
||||||
- name: "Waiting for server start"
|
- name: "Waiting for server start"
|
||||||
pause:
|
pause:
|
||||||
seconds: 15
|
seconds: 20
|
||||||
|
|
||||||
- name: "Enable avatar-storage module in Keycloak conf"
|
- name: "Enable avatar-storage module in Keycloak conf"
|
||||||
shell:
|
shell:
|
||||||
|
@ -71,11 +78,18 @@
|
||||||
name: keycloak
|
name: keycloak
|
||||||
state: stopped
|
state: stopped
|
||||||
become: true
|
become: true
|
||||||
|
when: not storagemodule.stat.exists
|
||||||
|
|
||||||
- service:
|
- service:
|
||||||
name: keycloak
|
name: keycloak
|
||||||
state: started
|
state: started
|
||||||
become: true
|
become: true
|
||||||
|
when: not storagemodule.stat.exists
|
||||||
|
|
||||||
|
- name: "Waiting for server start"
|
||||||
|
pause:
|
||||||
|
seconds: 20
|
||||||
|
when: not storagemodule.stat.exists
|
||||||
|
|
||||||
- name: "Download keycloak-d4science-bundle EAR from Maven repo"
|
- name: "Download keycloak-d4science-bundle EAR from Maven repo"
|
||||||
maven_artifact:
|
maven_artifact:
|
||||||
|
@ -85,6 +99,7 @@
|
||||||
repository_url: 'https://maven.research-infrastructures.eu/nexus/content/repositories/gcube-staging-jenkins'
|
repository_url: 'https://maven.research-infrastructures.eu/nexus/content/repositories/gcube-staging-jenkins'
|
||||||
dest: "/tmp/keycloak-d4science-bundle.ear"
|
dest: "/tmp/keycloak-d4science-bundle.ear"
|
||||||
verify_checksum: "always"
|
verify_checksum: "always"
|
||||||
|
when: updateear
|
||||||
|
|
||||||
- name: "Deploy keycloak-d4science-bundle EAR on Keycloak"
|
- name: "Deploy keycloak-d4science-bundle EAR on Keycloak"
|
||||||
copy:
|
copy:
|
||||||
|
@ -95,4 +110,5 @@
|
||||||
directory_mode: "yes"
|
directory_mode: "yes"
|
||||||
mode: "u=rw,g=rw,o="
|
mode: "u=rw,g=rw,o="
|
||||||
remote_src: "yes"
|
remote_src: "yes"
|
||||||
|
when: updateear
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue