--- - name: define ocp_project set_fact: ocp_project: "optaweb-employee-rostering-{{guid}}" - name: Create project for OptaPlanner Employee Rostering Demo shell: | oc new-project {{ocp_project}} \ --display-name="OptaPlanner Employee Rostering Demo" \ --description="OptaPlanner Employee Rostering Demo" ignore_errors: true - name: "Label namespace" command: "oc label namespace {{ocp_project}} AAD='{{guid}}'" - name: "Create PostgreSQL database" shell: "oc new-app postgresql-persistent -n {{ocp_project}}" - name: "Create OptaWeb app" shell: "oc new-app --name employee-rostering \ --strategy=docker \ java:8~{{optaweb_git_repository}}#{{optaweb_git_branch}} \ -e JAVA_TOOL_OPTIONS=\"-XX:InitialHeapSize=4g -XX:MaxHeapSize=8g\" \ -n {{ocp_project}}" - name: "Share PostgreSQL secret with OptaWeb app" shell: "oc set env dc/employee-rostering --from=secret/postgresql -n {{ocp_project}}" - name: "Expose the service" shell: "oc expose svc/employee-rostering -n {{ocp_project}}" - name: Wait 10 seconds for the builds to be defined pause: seconds: 10 #### Wait for the build to complete before slapping on the quota .... - include_tasks: ./wait_for_build.yml vars: build_to_wait: - employee-rostering #### Wait for the deployment to complete before slapping on the quota ... - include_tasks: ./wait_for_deploy.yml vars: pod_to_wait: - employee-rostering - name: Annotate the completed project as requested by user shell: "oc annotate namespace {{ocp_project}} openshift.io/requester={{ocp_username}} --overwrite" - name: Give user access to the completed project shell: "oc policy add-role-to-user admin {{ocp_username}} -n {{ocp_project}}" - name: workload Tasks Complete debug: msg: workload Tasks Complete