---
|
- name: Check BusinessCentral is running
|
command: >
|
oc rollout status DeploymentConfig/rhpam-authoring-rhpamcentr --watch=true -n "{{ _namespace }}"
|
|
- name: Get Business Central route host
|
command: >
|
oc get route/rhpam-authoring-rhpamcentr -o jsonpath='{.spec.host}' -n "{{ _namespace }}"
|
register: businesscentral_host
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until: businesscentral_host.stdout != ""
|
|
- name: Wait for Business Central route to respond with 200
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}"
|
method: GET
|
validate_certs: false
|
follow_redirects: yes
|
register: bizcentralresult
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until: bizcentralresult.status == 200
|
|
- name: Check space exists in Business Central (note; error can be ignored)
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/spaces/workshop"
|
method: GET
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
register: bizcentralspace
|
ignore_errors: true
|
|
- name: Create space in Business Central
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/spaces"
|
method: POST
|
body: "{{ body }}"
|
body_format: json
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
status_code: 202
|
register: bizcentralclone
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until: bizcentralclone.status == 202
|
when: bizcentralspace.status == 404
|
vars:
|
body:
|
name: "workshop"
|
description: "Proactive Fraud Management with Case Management, Kafka and DMN Services"
|
owner: "admin"
|
defaultGroupId: "com.demo"
|
|
- name: Check project exists in Business Central (note; error can be ignored)
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/spaces/workshop/projects/{{ _kie_container_id }}"
|
method: GET
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
register: bizcentralproject
|
ignore_errors: true
|
|
### todo: only clone if it doesnt exist
|
|
- name: Clone case into Business Central
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/spaces/workshop/git/clone"
|
method: POST
|
body: "{{ body }}"
|
body_format: json
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
status_code: 202
|
register: bizcentralclone
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until: bizcentralclone.status == 202
|
when: bizcentralproject.status == 404
|
vars:
|
body:
|
name: "proactive-fraud-detection-case"
|
description: "proactive-fraud-detection-case"
|
gitURL: "http://mygitea.gitea.svc.cluster.local:3000/{{ _namespace }}/proactive-fraud-detection-case.git"
|
|
- name: Check job status for clone case in Business Central
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/jobs/{{ bizcentralclone.json.jobId }}"
|
method: GET
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
register: bizcentralclone_job
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until:
|
- bizcentralclone_job is not failed
|
- bizcentralclone_job.json is defined
|
- bizcentralclone_job.json.status == "SUCCESS"
|
when: bizcentralproject.status == 404
|
|
- name: Maven install for project proactive-fraud-detection-case
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/spaces/workshop/projects/{{ _kie_project_id }}/maven/install"
|
method: POST
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
status_code: 202
|
register: bizcentralinstall
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until: bizcentralinstall.status == 202
|
|
- name: Check job status for maven install for project proactive-fraud-detection-case
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/jobs/{{ bizcentralinstall.json.jobId }}"
|
method: GET
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
register: bizcentralinstall_job
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until:
|
- bizcentralinstall_job is not failed
|
- bizcentralinstall_job.json is defined
|
- bizcentralinstall_job.json.status == "SUCCESS"
|
|
- name: Maven deploy for project proactive-fraud-detection-case
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/spaces/workshop/projects/{{ _kie_project_id }}/maven/deploy"
|
method: POST
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
status_code: 202
|
register: bizcentraldeploy
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until: bizcentraldeploy.status == 202
|
|
- name: Check job status for maven deplop for project proactive-fraud-detection-case
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/jobs/{{ bizcentraldeploy.json.jobId }}"
|
method: GET
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
register: bizcentraldeploy_job
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until:
|
- bizcentraldeploy_job is not failed
|
- bizcentraldeploy_job.json is defined
|
- bizcentraldeploy_job.json.status == "SUCCESS"
|
|
- name: Delete KIE Container proactive-fraud-detection-case (note; error can be ignored)
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/controller/management/servers/{{ _kie_server_id }}/containers/{{ _kie_container_id }}"
|
method: DELETE
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
status_code: 200
|
register: bizcentraldelete_container
|
ignore_errors: true
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until: bizcentraldelete_container.status == 404
|
|
- name: Create KIE Container proactive-fraud-detection-case
|
uri:
|
url: "https://{{ businesscentral_host.stdout }}/rest/controller/management/servers/{{ _kie_server_id }}/containers/{{ _kie_container_id }}"
|
method: PUT
|
body: "{{ body }}"
|
body_format: json
|
validate_certs: false
|
follow_redirects: yes
|
user: "{{ _namespace }}"
|
password: "{{ _account_password }}"
|
force_basic_auth: true
|
status_code: 201
|
register: bizcentralcreate_container
|
retries: "{{ _retry }}"
|
delay: "{{ _delay }}"
|
until: bizcentralcreate_container.status == 201
|
vars:
|
body:
|
container-id: "{{ _kie_container_id }}"
|
container-name: "{{ _kie_container_id }}"
|
server-template-key :
|
server-id: '{{ _kie_server_id }}'
|
status: "STARTED"
|
release-id:
|
group-id: "{{ _kjar_group_id }}"
|
artifact-id: "{{ _kjar_artefact_id }}"
|
version: "{{ _kjar_version }}"
|
configuration:
|
'RULE':
|
'org.kie.server.controller.api.model.spec.RuleConfig':
|
'pollInterval': null
|
'scannerStatus': "STOPPED"
|
'PROCESS':
|
'org.kie.server.controller.api.model.spec.ProcessConfig':
|
'runtimeStrategy': "SINGLETON"
|
kbase: ''
|
ksession: ''
|
'mergeMode': "MERGE_COLLECTIONS"
|