From a9627cced7c768500d543bdd100a8e4dbe57eef0 Mon Sep 17 00:00:00 2001
From: donal <donalspring@gmail.com>
Date: Wed, 16 May 2018 15:18:07 +0200
Subject: [PATCH] REorder mongodb stuff

---
 1-the-manual-menace/README.md |   53 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/1-the-manual-menace/README.md b/1-the-manual-menace/README.md
index 5772f0f..3d35dd6 100644
--- a/1-the-manual-menace/README.md
+++ b/1-the-manual-menace/README.md
@@ -163,16 +163,16 @@
 ansible-galaxy install -r requirements.yml --roles-path=roles
 ```
 
-3. Apply the inventory by logging into OpenShift on the terminal and running the playbook as follows (<CLUSTER_URL> should be replaced with the one you've been sent): 
+3. Apply the inventory by logging into OpenShift on the terminal and running the playbook as follows (<CLUSTER_URL> should be replaced with the one you've been sent as shown below). Accept any insecure connection warning ����: 
 ```bash
-oc login <CLUSTER_URL>
+oc login https://console.lader.rht-labs.com
 ```
 ```bash
 ansible-playbook apply.yml -i inventory/ -e target=bootstrap
 ```
 where the `-e target=bootstrap` is passing an additional variable specifying that we run the `bootstrap` inventory
 
-3. Once successful you should see an output similar to this: ![playbook-success](../images/exercise1/play-book-success.png)
+3. Once successful you should see an output similar to this (Cow's not included): ![playbook-success](../images/exercise1/play-book-success.png)
 
 3. You can check to see the projects have been created successfully by running 
 ```bash
@@ -320,9 +320,47 @@
 git push -u origin --all
 ```
 
+#### 5 MongoDB for CI tests
+> In order to run our API tests in CI in later labs; we need there to be a MongoDB available for executing our tests. As this is part of our CI/CD Lifecycle; we will add it now.
+
+4. In our `enablement-ci-cd` repo; checkout the mongo templates as shown below to bring in the template and params. The mongodb template we're using is the same as the one for our `todolist-fe` created in previous exercise.
+```bash
+git checkout exercise3/mongodb params/mongodb templates/mongodb.yml
+```
+
+4. Open `enablement-ci-cd` in your favourite editor. Edit the `inventory/host_vars/ci-cd-tooling.yml` to include a new object for our mongodb  as shown below. This item can be added below the jenkins slave in the `ci-cd-builds` section.
+```yaml
+  - name: "jenkins-mongodb"
+    namespace: "{{ ci_cd_namespace }}"
+    template: "{{ playbook_dir }}/templates/mongodb.yml"
+    params: "{{ playbook_dir }}/params/mongodb"
+    tags:
+    - mongodb
+```
+![jenkins-mongo](../images/exercise3/jenkins-mongo.png)
+
+4. Git commit your updates to the inventory to git for traceability.
+```bash
+git add .
+```
+```bash
+git commit -m "ADD - mongodb for use in the pipeline"
+```
+```bash
+git push
+```
+
+4. Apply this change as done previously using ansible. The deployment can be validated by going to your `<YOUR_NAME>-ci-cd` namespace and checking if it is there! 
+```bash
+ansible-playbook apply.yml -e target=tools \
+  -i inventory/ \
+  -e "filter_tags=mongodb"
+```
+![ocp-mongo](../images/exercise3/ocp-mongo.png)
+
 **Note - When making changes to enablement-ci-cd you should frequently commit the changes to git.**
 
-### Part 4 - Jenkins & s2i
+### Part 6 - Jenkins & s2i
 > _Create a build and deployment config for Jenkins. Add new configuration and plugins to the OCP Stock Jenkins using s2i_
 
 5. Add the Jenkins Build & Deployment configs to the `enablement-ci-cd` repo by merging the contents `exercise1/jenkins` in
@@ -451,7 +489,7 @@
 
 5. When the Jenkins deployment has completed; login (using your openshift credentials) and accept the role permissions. You should now see a fairly empty Jenkins with just the seed job
 
-### Part 5 - Jenkins Hello World 
+### Part 7 - Jenkins Hello World 
 > _To test things are working end-to-end; create a hello world job that doesn't do much but proves we can pull code from git and that our balls are green._
 
 6. Log in to Jenkins and hit `New Item` ![new-item](../images/exercise1/new-item.png).
@@ -464,7 +502,7 @@
 
 6. Run the build and we should see if pass succesfully and with Green Balls! ![jenkins-green-balls](../images/exercise1/jenkins-green-balls.png)
 
-### Part 6 - Live, Die, Repeat
+### Part 8 - Live, Die, Repeat
 > _In this section you will proove the infra as code is working by deleting your Cluster Content and recreating it all_
 
 7. Commit your code to the new repo in GitLab
@@ -496,7 +534,7 @@
 
 7. Re-apply the inventory to re-create it all!
 ```bash
-oc login -p <password> -u <user> <cluster_url>
+oc login https://console.lader.rht-labs.com
 ```
 ```bash
 ansible-playbook apply.yml -i inventory/ -e target=bootstrap
@@ -510,6 +548,7 @@
 ## Extension Tasks
 > _Ideas for go-getters. Advanced topic for doers to get on with if they finish early. These will usually not have a solution and are provided for additional scope._
 
+ - Install Cowsay for 100% more Ansible Fun!
  - Add more secure access for Nexus (ie not admin / admin123) using the automation to drive secret creation
  - Add a SonarQube persistent deployment to the `ci-cd-deployments` section.
  - Add `jenkins.plugins.slack.SlackNotifier.xml` to `jenkins-s2i/configuration` to include URL of Slack for team build notifications and rebuild Jenkins S2I

--
Gitblit v1.9.3