forked from Sunbird-Lern/sunbird-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue Sunbird-Lern#28 chore: Deployment script for sunbird auth package
- Loading branch information
Showing
8 changed files
with
153 additions
and
69 deletions.
There are no files selected for viewing
6 changes: 0 additions & 6 deletions
6
keycloak/scripts/ansible/inventories/dev/group_vars/dev-es.yml
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
keycloak/scripts/ansible/inventories/dev/group_vars/dev-kong-api.yml
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
keycloak/scripts/ansible/inventories/dev/group_vars/dev-log-es.yml
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
keycloak/scripts/ansible/inventories/dev/group_vars/dev-postgresql-master.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
- hosts: all | ||
- hosts: localhost | ||
become: true | ||
vars_files: | ||
- ['{{inventory_dir}}/secrets.yml'] | ||
|
69 changes: 69 additions & 0 deletions
69
keycloak/scripts/ansible/roles/keycloak/tasks/auth-deploy-config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
- name: status service | ||
become: yes | ||
command: /etc/init.d/keycloak status | ||
register: keycloak | ||
poll: 5 | ||
async: 10 | ||
|
||
- name: stop service | ||
become: yes | ||
command: /etc/init.d/keycloak stop && Pkill keycloak | ||
when: "keycloak.stdout.find('running') != -1" | ||
poll: 5 | ||
async: 10 | ||
ignore_errors: yes | ||
|
||
- name: Paste keycloak config package on server | ||
copy: src="sunbird_auth_{{sunbird_auth_version}}.config.zip" dest="/tmp/" force=no owner={{wildfly_user}} group={{wildfly_group}} | ||
|
||
- name: extarct the folder | ||
unarchive: src="/tmp/sunbird_auth_{{sunbird_auth_version}}.config.zip" dest=/tmp/ copy=no owner={{wildfly_user}} group={{wildfly_group}} | ||
|
||
- name: Keycloak configuration XML file | ||
copy: | ||
src: "/tmp/sunbird_auth_{{sunbird_auth_version}}.config/standalone-ha.xml" | ||
dest: "{{keycloak_home}}/standalone/configuration/standalone-ha.xml" | ||
mode: 0750 | ||
owner: "{{wildfly_user}}" | ||
group: "{{wildfly_group}}" | ||
remote_src: yes | ||
|
||
- name: Postgresql Configuration- module.xml | ||
copy: | ||
src: "/tmp/sunbird_auth_{{sunbird_auth_version}}.config/module.xml" | ||
dest: "{{keycloak_home}}/modules/system/layers/keycloak/org/postgresql/main/module.xml" | ||
mode: 0750 | ||
owner: "{{wildfly_user}}" | ||
group: "{{wildfly_group}}" | ||
remote_src: yes | ||
|
||
- name: Create a directory for SMS provider configuration | ||
file: | ||
path: "{{keycloak_home}}/bin/sms-provider" | ||
state: directory | ||
mode: 0755 | ||
|
||
- name: SMS provider configuration file | ||
copy: | ||
src: "/tmp/sunbird_auth_{{sunbird_auth_version}}.config/Msg91Creds.json" | ||
dest: "{{keycloak_home}}/bin/sms-provider/Msg91Creds.json" | ||
owner: "{{wildfly_user}}" | ||
group: "{{wildfly_group}}" | ||
mode: 0755 | ||
remote_src: yes | ||
|
||
- name: Delete config directory | ||
file: | ||
path: "/tmp/sunbird_auth_{{sunbird_auth_version}}.config" | ||
state: absent | ||
|
||
- name: Delete config directory zip | ||
file: | ||
path: "/tmp/sunbird_auth_{{sunbird_auth_version}}.config.zip" | ||
state: absent | ||
|
||
- name: start service | ||
become: yes | ||
command: /etc/init.d/keycloak start | ||
poll: 5 | ||
async: 5 |
57 changes: 57 additions & 0 deletions
57
keycloak/scripts/ansible/roles/keycloak/tasks/auth-deploy.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
- stat: | ||
path: /etc/init.d/keycloak | ||
register: keycloak_service | ||
|
||
- name: status service | ||
become: yes | ||
command: /etc/init.d/keycloak status | ||
register: keycloak | ||
poll: 5 | ||
async: 10 | ||
when: keycloak_service.stat.islnk is defined | ||
|
||
- name: stop service | ||
become: yes | ||
command: /etc/init.d/keycloak stop && Pkill keycloak | ||
when: "keycloak.stdout.find('running') != -1" | ||
poll: 5 | ||
async: 10 | ||
ignore_errors: yes | ||
when: keycloak_service.stat.islnk is defined | ||
|
||
- name: remove keycloak | ||
become: yes | ||
file: path="{{keycloak_home}}" state=absent | ||
|
||
- name: change build script permissions | ||
become: yes | ||
file: path=/opt owner={{wildfly_user}} group={{wildfly_group}} mode=0755 recurse=yes | ||
|
||
- name: Paste keycloak package on server | ||
copy: src="sunbird_auth_{{sunbird_auth_version}}.zip" dest="/opt/" force=no owner={{wildfly_user}} group={{wildfly_group}} | ||
|
||
- name: extarct the folder | ||
unarchive: src="/opt/sunbird_auth_{{sunbird_auth_version}}.zip" dest=/opt/ copy=no owner={{wildfly_user}} group={{wildfly_group}} | ||
|
||
- name: move the folder name | ||
command: mv sunbird_auth_{{sunbird_auth_version}} keycloak | ||
args: | ||
chdir: /opt | ||
|
||
- name: remove the sunbird_auth_{{sunbird_auth_version}} | ||
become: yes | ||
file: path=/opt/sunbird_auth_{{sunbird_auth_version}} state=absent | ||
|
||
- name: Create admin user | ||
become_user: "{{ wildfly_user }}" | ||
command: "{{ wildfly_dir }}/bin/add-user-keycloak.sh -r master -u {{ keycloak_management_user }} -p {{ keycloak_management_password }}" | ||
when: keycloak_management_user is defined and | ||
keycloak_management_password is defined | ||
ignore_errors: yes | ||
|
||
- name: start service | ||
become: yes | ||
command: /etc/init.d/keycloak start | ||
poll: 5 | ||
async: 5 | ||
when: keycloak_service.stat.islnk is defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters