How to create Ansible roles

Ansible Role is set of directory structures and yml files

Roles help to organize set of tasks and group it

command (to create role):

Ansible-galaxy init /etc/ansible/roles/project1 –offline

now, project1 directory has 8 directories:
1.defaults
2.files
3.handlers
4.meta
5.tasks
6.templates
7.tests
8.vars

except files and templates, all other directories have main.yml file

defaults and vars carry variables. priority goes
to vars

task stores all playbook tasks grouped and maintained

Terraform Jenkins pipeline setup

Terraform Jenkins pipeline setup

Assume Jenkins server is already setup

Dowload and install terraform cli.
Note the path of terraform binary downloaded

Install Terraform plugin from Jenkins plugin Manager.

Navigate to Global tool configuration in jenkins.
in terraform section, map the terraform binary folder path

create pipeline jenkins job

write pipeline script, utilize pipeline script
generator’s option ‘Declarative Directive Generator’ for terraform scripting

utilize pipeline script generator, create different CI/CDstages like git checkout, sonar, image publish

OpenShift Container Platform

What is Openshift Container Platform?

Openshift Container platform is Red Hat’s PaaS for Applocation development and deployment.

OCP supports various deployment strategy with help of Docker(Pods) and Jenkins under the hood.

Openshift Container platform (OCP) Build
Deployment pipeline:

After login to OCP

  1. Follow YAML build strategy, git connections etc
  2. Add Jenkins deployment startegy in YAML

“Creat Deployment” option in console will change to “Start pipeline” as YAML build config is created

Click “Start Pipeline”, wait for build to create
pods. A link for Jenkins dashboard will be disaplyed in OCP console

Enable Webhook integration with OCP endpoint
for triggering jobs on git commits

here after on every Git code commits would
build and deploys using OCP