Skip to content

Instantly share code, notes, and snippets.

Avatar

DevOps School devops-school

View GitHub Profile
@devops-school
devops-school / condition
Last active Sep 24, 2022
Jenkins Pipeline Example Code
View condition
How to apply conditions aka Flow Control in jenkins scripted pipeline?
========================================================
node {
stage('Example') {
if (env.BRANCH_NAME == 'master') {
echo 'I only execute on the master branch'
} else {
echo 'I execute elsewhere'
}
@devops-school
devops-school / shell.condition.sh
Created Sep 21, 2022
Linux Tutorials: Conditional statatement using if
View shell.condition.sh
# Program - 1 - Format
if [condition]
then
statement1
else
statement2
fi
# Program - 2 - Using if-else to check whether two numbers are equal
@devops-school
devops-school / elasticsearch.txt
Created Sep 21, 2022
Elasticsearch 8.X in Centos 7
View elasticsearch.txt
Elasticsearch 8.X in Centos 7
-------------------------------
192.168.1.8
https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html
$ yum install wget unzip -y
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.4.2-linux-x86_64.tar.gz
@devops-school
devops-school / nginx.conf
Created Sep 19, 2022
Example of Nginx configuration
View nginx.conf
user www www; ## Default: nobody
worker_processes 5; ## Default: 1
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
@devops-school
devops-school / azure-multiple-vm.tf
Created Sep 17, 2022
Terraform: Example Code for Create Multiple Azure Linux Vms
View azure-multiple-vm.tf
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.12.0"s
}
}
}
@devops-school
devops-school / pre-receive-1.sh
Last active Sep 9, 2022
Gitlab Server Side Hooks
View pre-receive-1.sh
#!/bin/bash
zero_commit="0000000000000000000000000000000000000000"
excludeExisting="--not --all"
while read oldrev newrev refname; do
# echo "payload"
echo $refname $oldrev $newrev
# branch or tag get deleted
@devops-school
devops-school / .gitlab-ci.yml
Created Sep 7, 2022
GitLab Tutorials: Example of .gitlab-ci.yml
View .gitlab-ci.yml
# This file is a template, and might need editing before it works on your project.
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
#
@devops-school
devops-school / Conditional-output.yaml
Last active Sep 3, 2022
Elastic Logstash Input Filter and Output Example
View Conditional-output.yaml
output {
if [fieldName] == "stringA" {
output for this type of message
}
if [fieldName] == "stringB" {
output for this type of message
}
if [fieldName] == "stringN" {
output for this type of message
}
@devops-school
devops-school / terraform-ebs-ec2.tf
Created Aug 27, 2022
Terraform Example - AWS EC2 Instance with EBS
View terraform-ebs-ec2.tf
resource "aws_ebs_volume" "example" {
availability_zone = "ap-south-1a"
size = 40
tags = {
Name = "HelloWorld"
}
}
resource "aws_volume_attachment" "ebs_att" {
@devops-school
devops-school / git-assignment.sh
Created Jul 24, 2022
Git Lab Exercise & Assignment: Git Diff and Undoing: Part - 9
View git-assignment.sh
Excercise 1 - Module 1 - Simple Commit
# 0. Clone from github
$ git clone http://github.com/stephenh/git-workshop.git
$ cd git-workshop
# 1. Tell git who you are (once per machine)
$ git config --global user.name "Your Name"
$ git config --global user.email your.email@example.com
$ git config --global color.ui auto