In this lab learners will use Ansible to drive automated provisioning of Projects, Access Control, Git, Jenkins and Nexus
As a learner you will be able to
npm
and Docker
registries.This exercise begins with an empty Cluster
TODO - add big picture here...
This lab is aimed at the creation of the tooling that will be used to support the rest of the Exercises. The highlevel goal is to create a collection of project namespaces and populate them with Git, Jenkins & Nexus.
If you're feeling confident and don't want to follow the step-by-step guide these highlevel instructions should provide a challenge for you:
git@github.com:rht-labs/enablement-ci-cd.git
which contains the scaffold of the project.<your-name>-ci-cd
, <your-name>-dev
and <your-name>-test
project namespaces using the inventory and run them with the OpenShift Applier to populate the cluster<your-name>-ci-cd
for:
enablement-ci-cd
repository to the GitLab Instance you've createdThis is a structured guide with references to exact filenames and explanations.
Clone the scaffold project to your local machine and open it in your favourite editor.bash git clone git@github.com:rht-labs/enablement-ci-cd.git
The project is laid out as follows . ├── README.md ├── docker │ └── jenkins-slave-node ├── inventory │ ├── group_vars │ │ └── all.yml │ └── hosts ├── jenkins-s2i │ ├── configuration ├── params │ └── project-requests-ci-cd ├── requirements.yml └── templates └── project-requests.yml
docker
folder contains our jenkins-slave images that will be used by the builds.jenkins-s2i
contains the configuration and plugins we want to bring jenkins to life withparams
houses the variables we will load the templates withtemplates
is a collection of OpenShift templatesinventory/group_vars/all.yml
is the collection of objects we want to insert into the cluster.requirements.yml
is a manifest which contains the ansible modules needed to run the playbookinventory/group_vars/all.yml
file; you should see a some variables setup to create the ci-cd
namespace. This calls the templates/project-requests.yml
template with the params/project-requests-ci-cd
parameters. We will add some additional content here but first let's explore the parameters and the templateOpen the params/project-requests-ci-cd
and replace the <your name or initials>
with your name to create the correstponding projects in the cluster.
Create another two params files for params/project-requests-dev
& params/project-requests-test
and add the NAMESPACE=<your name>-dev
&& NAMESPACE=<your name>-test
and update their Display names.
In the inventory/group_vars/all.yml
file; add the new inventory items for the projects you want to create (dev & test) by adding another object to the content array. You can copy and paste them from the ci-cd
example and update them accordingly eg
```yaml
With the configuration in place; install the OpenShift Applier dependencybash $ ansible-galaxy install -r requirements.yml --roles-path=roles
Apply the inventory by logging into OpenShift and then runningbash $ oc login -p <password> -u <user> <cluster_url> $ ansible-playbook roles/casl-ansible/playbooks/openshift-cluster-seed.yml -i inventory/
Once successful you should see an output similar to this
Now that we have our Projects setup; we can start to populate them with Apps to be used in our dev lifecycle
In the enablement-ci-cd
repo, checkout the templates for GitLab and Nexus by runningbash $ git checkout
Commit your code to the new repo in GitLab
Burn it to the ground
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.
> List of links or other reading that might be of use / reference for the exercise