Jeff Bride
2018-12-21 a5847c95743ce301e833231a875322007a1cc9e1
Merge pull request #301 from diego-torres/development

Development
2 files modified
85 ■■■■■ changed files
ansible/roles/ocp-workload-bxms-dm/defaults/main.yml 7 ●●●● patch | view | raw | blame | history
ansible/roles/ocp-workload-bxms-dm/tasks/workload.yml 78 ●●●●● patch | view | raw | blame | history
ansible/roles/ocp-workload-bxms-dm/defaults/main.yml
@@ -41,7 +41,10 @@
#DM_IMAGE_REGISTRY: registry.redhat.io
DM_IMAGE_REGISTRY: registry.access.redhat.com
# DM_TEMPLATE_URL: https://raw.githubusercontent.com/gpe-mw-training/bxms_decision_mgmt_foundations_lab/master/resources/rhdm7-full-ng.yaml
DM_TEMPLATE_URL: https://raw.githubusercontent.com/hwurht/bxms_decision_mgmt_foundations_lab/master/resources/rhdm7-full-ng.yaml
SECRETS_TEMPLATE_URL: https://raw.githubusercontent.com/jboss-container-images/rhdm-7-openshift-image/7.1.1.GA/example-app-secret-template.yaml
# DM_TEMPLATE_URL: https://raw.githubusercontent.com/gpe-mw-training/bxms_decision_mgmt_foundations_lab/master/resources/rhdm7-full-ng.yaml
DM_TEMPLATE_URL: https://raw.githubusercontent.com/gpe-mw-training/bxms_decision_mgmt_foundations_lab/master/resources/rhdm7-only.yaml
NG_TEMPLATE_URL: https://raw.githubusercontent.com/gpe-mw-training/gpte-ng-dmf/master/ng-dmf-template.yaml
ocp_apps_domain: apps.{{subdomain_base}}
ansible/roles/ocp-workload-bxms-dm/tasks/workload.yml
@@ -12,6 +12,11 @@
- name: Make sure we go back to default project
  shell: "oc project default"
- name: Prep local filesystem for temp files
  file:
    path: "/tmp/{{guid}}"
    state: directory
# Note; depending on the environment, OCP projects may or may not have default limit ranges
- name: Delete default limitrange
  shell: |
@@ -25,7 +30,6 @@
- shell: |
    oc create -f /tmp/{{ocp_project}}_limitrange.yaml -n {{ocp_project}}
# Imagestreams are beginning to reference the new and secured registry.redhat.io .
# Will switch this back to registry.access.redhat.com  (until GPTE has an elab solution that allows for pull down from secured registries that is seemless to student
- name: Update DM image streams
@@ -36,53 +40,71 @@
- name: Load dm imagestream
  shell: "oc create -f {{DM_IS_URL}} -n {{ocp_project}}"
- name: Initialize the project template
- name: Create the Angular Application Template
  shell: oc create -f {{NG_TEMPLATE_URL}} -n {{ocp_project}}
- name: Fire and forget to install Angular application container
  async: 3600
  poll: 0
  shell: |
      oc new-app --template=ng-dmf-template --name=angular-dmf -n {{ocp_project}} \
      -p APPLICATION_NAME=angular-dmf \
      -p KIE_ADMIN_PWD=r3dh4t1! \
      -p KIE_ROUTE=http://dm-foundations-kieserver-{{ocp_project}}.{{ocp_apps_domain}}  > /tmp/{{guid}}/angular-dmf.txt
- name: Create the Decision Manager Template
  shell: "oc create -f {{DM_TEMPLATE_URL}} -n {{ocp_project}}"
- name: Prep local filesystem for temp files
  file:
    path: "/tmp/{{guid}}"
    state: directory
- name: Initialize secrets template
  shell: "oc create -f {{SECRETS_TEMPLATE_URL}} -n {{ocp_project}}"
- name: Initialize OCP resources from the project template using CLUSTER {{ ocp_apps_domain }}
- name: Create Decision Central Secret
  shell: "oc new-app --template=example-app-secret -n {{ocp_project}} -p SECRET_NAME=decisioncentral-app-secret"
- name: Create Kie Server Secret
  shell: "oc new-app --template=example-app-secret -n {{ocp_project}} -p SECRET_NAME=kieserver-app-secret"
- name: Create service account
  shell: "oc create sa dm-foundations-rhdmsvc -n {{ocp_project}}"
- name: Use Decision Central Secret for pull
  shell: "oc secrets link --for=pull dm-foundations-rhdmsvc decisioncentral-app-secret -n {{ocp_project}}"
- name: Use Decision Central Secret for mount
  shell: "oc secrets link --for=mount dm-foundations-rhdmsvc decisioncentral-app-secret -n {{ocp_project}}"
- name: Grant view access to service account
  shell: "oc policy add-role-to-user view system:serviceaccount:{{ocp_project}}:dm-foundations-rhdmsvc -n {{ocp_project}}"
- name: Create Decision Manager containers based in template {{DM_TEMPLATE_URL}}
  shell: |
      oc new-app --name=dm-demo -n {{ocp_project}} --template=rhdm7-full-ng \
      oc new-app --template=rhdm7-only --name=dm-foundations -n {{ocp_project}} \
      -p RHT_IMAGE_STREAM_NAMESPACE={{ocp_project}} \
      -p KIE_ADMIN_PWD=test1234! \
      -p MAVEN_REPO_PASSWORD=test1234! \
      -p CLUSTER={{ocp_apps_domain}} \
      -p APPLICATION_NAME=gpte > /tmp/{{guid}}/gpte-dm-demo.txt
      -p KIE_ADMIN_PWD=r3dh4t1! \
      -p MAVEN_REPO_PASSWORD=r3dh4t1! \
      -p APPLICATION_NAME=dm-foundations > /tmp/{{guid}}/dm-foundations.txt
- include_tasks: ./wait_for_build.yml
  static: no
  vars:
    build_to_wait:
      - gpte-custom-kieserver
      - gpte-ng-dmf
      - dm-foundations-custom-kieserver
- name: resume gpte-rhdmcentr
  shell: oc rollout resume dc/gpte-rhdmcentr -n {{ocp_project}}
- name: resume dm-foundations-rhdmcentr
  shell: oc rollout resume dc/dm-foundations-rhdmcentr -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - gpte-rhdmcentr
      - dm-foundations-rhdmcentr
- name: resume gpte-kieserver
  shell: oc rollout resume dc/gpte-kieserver -n {{ocp_project}}
- name: resume dm-foundations-kieserver
  shell: oc rollout resume dc/dm-foundations-kieserver -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - gpte-kieserver
- name: resume gpte-ng-dmf
  shell: oc rollout resume dc/gpte-ng-dmf -n {{ocp_project}}
- include_tasks: ./wait_for_deploy.yml
  static: no
  vars:
    pod_to_wait:
      - gpte-ng-dmf
      - dm-foundations-kieserver
- name: Annotate the empty project as requested by user
  shell: "oc annotate namespace {{ocp_project}} openshift.io/requester={{ocp_username}} --overwrite"