Home

Awesome

OpenShift Demos Ansible Roles and Playbooks

Build Status

Deploy CoolStore Microservices with CI/CD

In order to deploy the complete demo infrastructure for demonstrating Microservices, CI/CD, agile integrations and more, either order the demo via RHPDS or use the following script to provision the demo on any OpenShift environment:

Prerequisites

The following imagestreams should be installed on OpenShift:

oc login -u system:admin
oc create -n openshift -f https://raw.githubusercontent.com/jboss-fuse/application-templates/master/fis-image-streams.json
oc create -n openshift -f https://raw.githubusercontent.com/jboss-openshift/application-templates/ose-v1.4.14/eap/eap64-image-stream.json
oc create -n openshift -f https://raw.githubusercontent.com/jboss-openshift/application-templates/ose-v1.4.14/openjdk/openjdk18-image-stream.json
oc create -n openshift -f https://raw.githubusercontent.com/jboss-openshift/application-templates/ose-v1.4.14/processserver/processserver64-image-stream.json
oc create -n openshift -f https://raw.githubusercontent.com/jboss-openshift/application-templates/ose-v1.4.14/webserver/jws31-tomcat8-image-stream.json
oc create -n openshift -f https://raw.githubusercontent.com/jboss-openshift/application-templates/ose-v1.4.14/eap/eap70-image-stream.json
oc create -n openshift -f https://raw.githubusercontent.com/jboss-openshift/application-templates/ose-v1.4.14/decisionserver/decisionserver64-image-stream.json
oc create -n openshift -f https://raw.githubusercontent.com/jboss-openshift/application-templates/ose-v1.4.14/datagrid/datagrid65-image-stream.json

Run Playbooks Locally (Ansible installed)

$ git clone https://github.com/siamaksade/openshift-demos-ansible.git
$ cd openshift-demos-ansible
$ git checkout ocp-3.10
$ oc login http://openshiftmaster
$ ansible-galaxy install -r playbooks/coolstore/requirements.yml
$ ansible-playbook playbooks/coolstore/msa-cicd-eap-min.yml

Run Playbooks Locally (Docker installed)

$ oc login http://openshiftmaster
$ docker run --rm -it siamaksade/openshift-demos-ansible:ocp-3.10 playbooks/coolstore/msa-cicd-eap-min.yml \
      -e "openshift_master=$(oc whoami --show-server)" \
      -e "oc_token=$(oc whoami -t)"

Run Playbooks on OpenShift (with cluster admin)

The provided templates creates an OpenShift Job to run the Ansible playbooks. Check out the template for the complete list of parameters available.

$ oc login -u system:admin
$ oc new-project demo-installer
$ oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccount:demo-installer:default

$ oc new-app -f helpers/coolstore-ansible-installer.yaml \
    --param=DEMO_NAME=msa-full \
    --param=PROJECT_ADMIN=developer \
    --param=COOLSTORE_GITHUB_REF=ocp-3.10
    --param=ANSIBLE_PLAYBOOKS_VERSION=ocp-3.10

$ oc logs -f jobs/coolstore-ansible-installer

Playbooks

CoolStore Demo

Demo repository: https://github.com/jbossdemocentral/coolstore-microservice

PlaybookDescriptionMemoryCPU
coolstore/msa-min.ymlDeploys CoolStore with min required services4 GB1 cores
coolstore/msa-full.ymlDeploys CoolStore with all services8 GB2 cores
coolstore/msa-cicd-eap-min.ymlDeploys CoolStore with CI/CD and min services (Dev-Prod)8 GB2 cores
coolstore/msa-cicd-eap-full.ymlDeploys CoolStore with CI/CD and all services (Dev-Test-Prod)20 GB8 cores
coolstore/undeploy.ymlDelete the demo--

Monolith CI/CD Demo

Demo repisotory: https://github.com/OpenShiftDemos/openshift-cd-demo

PlaybookDescriptionMemoryCPU
cd/deploy.ymlDeploys Monolith CI/CD demo8 GB2 cores
cd/undeploy.ymlDelete the demo--

Variables

You can modify the playbooks behavior by specifying extra variables

$ ansible-playbook demos/coolstore/msa-min.yml -e "github_ref=stable-ocp-3.10 ephemeral=true project_suffix=demo1"
VariableDefaultDescription
openshift_masternoneOpenShift master url. Not required if playbooks run on a host that is already authenticated to OpenShift
oc_tokennoneAuthentication token for OpenShift. Not required if playbooks run on a host that is already authenticated to OpenShift
oc_kube_confignonePath to .kube config if not using the default
project_suffixdemoA suffix to be added to all project names e.g. cicd-demo
ephemeralfalseIf set to true, all pods will be deployed without persistent storage
maven_mirror_urlfalseMaven repository for Java S2I builds. If empty, Sonatype Nexus gets deployed and used
github_accountmasterGitHub account to deploy from in forked: https://github.com/[github-account]/coolstore-microservice
github_refmasterGitHub branch to deploy from: https://github.com/jbossdemocentral/coolstore-microservice
project_adminnoneOpenShift user to be assigned as the project admin. Default is the logged-in user
deploy_guidestrueDeploy demo guides as a pod in the CI/CD project

For a list of all options, check demo variables