Added update option to update env.

This commit is contained in:
Mauro Mugnaini 2021-01-28 18:30:39 +01:00
parent 7b362926e5
commit 250db48e09
2 changed files with 12 additions and 8 deletions

View File

@ -3,3 +3,4 @@ keycloak_home: "/opt/keycloak/keycloak-10.0.2"
keycloak_modules: "{{ keycloak_home }}/modules"
keycloak_themes: "{{ keycloak_home }}/themes"
keycloak_deployments: "{{ keycloak_home }}/standalone/deployments"
update: false

View File

@ -23,11 +23,17 @@
mode: "u=rwx,g=rwx,o="
remote_src: "yes"
- name: "Check if the storage-module is already installed"
- name: "Check if the avatar-storage module is already installed"
stat:
path: "{{ keycloak_modules }}/org/gcube/keycloak/avatar-storage/main"
register: storagemodule
- name "Remove old avatar-storage module"
ansible.builtin.file:
path: "{{ keycloak_modules }}/org/gcube/keycloak/avatar-storage"
state: absent
when: storagemodule.stat.exists and update
- name: "Download avatar-storage JAR from Maven repo"
maven_artifact:
group_id: org.gcube
@ -36,13 +42,13 @@
repository_url: 'https://maven.research-infrastructures.eu/nexus/content/repositories/gcube-staging-jenkins'
dest: "/tmp/avatar-storage.jar"
verify_checksum: "always"
when: not storagemodule.stat.exists
when: not storagemodule.stat.exists or update
- name: "Install avatar-storage Keycloak module"
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"'
chdir: "{{ keycloak_home }}"
when: not storagemodule.stat.exists
when: not storagemodule.stat.exists or update
- name: "Switch ON Keycloak server instance"
service:
@ -58,6 +64,7 @@
shell:
cmd: './bin/jboss-cli.sh --connect --controller=localhost:9990 --command="/subsystem=keycloak-server:list-add(name=providers, value=module:org.gcube.keycloak.avatar-storage)"'
chdir: "{{ keycloak_home }}"
when: not storagemodule.stat.exists
- name: "Restart Keycloak server instance to load new provider configuration"
service:
@ -77,7 +84,7 @@
extension: ear
repository_url: 'https://maven.research-infrastructures.eu/nexus/content/repositories/gcube-staging-jenkins'
dest: "/tmp/keycloak-d4science-bundle.ear"
verify_checksum: "always"
verify_checksum: "always"
- name: "Deploy keycloak-d4science-bundle EAR on Keycloak"
copy:
@ -89,7 +96,3 @@
mode: "u=rw,g=rw,o="
remote_src: "yes"
- name: "Waiting for EAR deploy"
pause:
seconds: 15