Posts

Showing posts from 2021

Jenkins integration with GitHub and build with Maven

Image
 Git integration with Jenkins the main objective here is how GitHub connects with Jenkins, once build tool maven works and then Java artifacts generated ready for deploy the application (.war file). This post is 2 mins read. Jenkins integration with GitHub Code repo build with maven Prerequisites: You should have been Signup either on GitHub or Bitbucket GitHub repo url: https://github.com/BhavaniShekhar/my-app Global Tool configuration To configure the following we have installed on the Jenkins Master here I've used CentOS box. And while configuring these we need to provide the installed location for each. Java - defined name as LocalJDK8 or JDK8 /JDK11/JDK18 Maven - defined name can be as LocalMaven or maven3 Git - name defined as LocalGit or default  How to configure JDK as Global tool in Jenkins? You need to navigate in the Jenkins Dashboard select Manage Jenkins and from the options select Configure Global tools. In the Configure Global tool  page goto the JDK s...

Jenkins Active choices parameter - Dynamic input

Image
Hello DevOps team!! Today I've revisited the experiment with the Jenkins ACTIVE CHOICE Parameter  to get the Dynamic parameters effect on the Build Job parameters. Installation Active Choice parameter - Groovy Script Prerequisite: Jenkins installed Up and running on your target master machine. Jenkins URL accessible   Step 1: Install Active Choice plugin On the Jenkins Dashboard, select the Manage Jenkins, Plugin- Manager, In the Available tab search for word 'Active', where you can see Active Choice plugin and choose installation option, and this will enables three different parameters in the "Add Paramters" list. They are : 1. Active choice parameter 2. Active Choice Reactive parameter 3. Active choice Reactive Reference parameter Here In my example I will use two of them, Firstly Active Choice Parameter for "environment". Create new item Name: active_project select a freestyle project click OK button. In the General tab, select the checkbo...

Ansible variables, Lists, Dictionaries

Image
 There are many boring tasks in your daily job which can be automated easily if you know some of the tools like here, Ansible. Let's explore more on how to use the variables in the playbooks. In this post we will be covering : Basic datatypes List variables and using them Dictionary variable and accessing them Variables and Datatypes in Ansible In Ansible variables can be defined under global tasks or they can be defined at local to a task level. support all the Python supported datatypes. --- # Filename: varibles_datatypes.yml - name: varibles in ansible hosts: localhost gather_facts: false vars: a: "Vybhava Technologies" b: yes n: 100 m: 500.99 tasks: - debug: msg: - "a= {{ a }} a type: {{ a |type_debug }}" - "b= {{ b }} b type: {{ b |type_debug }}" - "n= {{ n }} n type: {{ n |type_debug }}" - "m= {{ m }} m type: {{ m |type_debug }}" The...

Ansible packages and service modules

Image
Ansible packages and service modules In this post I would like to take you to the most important Linux administration tasks which can be used regularly in their daily activities that can be automated with Ansible.  How do Linux Package Managers works? Every Linux Operating system allow us to install any software using package managers such as yum, dnf, apt, deb or apk any other option.  Here I've explored more details about this package mangers how they are working. If we take RedHat flavor Linux systems such as CentOS, SuSe, RHEL uses actually RPM as package manager. But the CLI clients are available such as yum (Yellowdog updater modified) and in the latest versions using improved yum that is dnf command utility which is known as "Dandified Yum".  The service or systemctl commands After installation we need to start, stop or restart or check status that service using systemctl or service command as per the System availability. Ansible package manager modules connectio...

Ansible Configuration and inventory

Image
In this post I would like to explain about what I had explored on the Ansible Configuration changes at different scopes. Also see the impact of different parameter customizations related to the ansible host inventories. Working with Ansible Configuration - ansible.cfg  This ansible.cfg file will be available in the default location (ANSIBLE_HOME/ Ansible.cfg) when you install with yum. It is not available when you use pip installation. To get a copy of the ansible.cfg you can see a ' rpmsave ' file in the default ANSIBLE_HOME location /etc/ansible. The ANSIBLE_HOME can be changed as per the requirements we can defined in the configuration file. Ansible inventory   Learning about the inventory setup for Ansible controller, first it will look into the ansible.cfg about where is the inventory location defined. If no line mentioned in the configuration file then default inventory location will be used as  /etc/ansible/...

Comparing file changes with git diff command

Image
Hello Guys, in this post we will explore about git diff command options when to use what option etc. Git basic work flow is going happen initially starts at work area. When you add the files then it will be in the stage area. Once you feel everything is good then we will commit those changes then it will goes to local repository area. In simple words we can say work area -> stage area -> repo area.   The pictorial representation of my understanding about the git workflow: Work flow for git diff command exeuction   How to Compare files in git to get the last changes? In git we have this nice feature to compare a file what has been changed who did the changes we can track them with the inputs we can pass as options to the 'git diff' command. Syntax: git diff [code-file] Examples: You can compare and see all the files which are changed with the last commit. git diff You can compare and see specific file, for example we consider index.html file recently modified and ...

HEALTHCHECK Instructions in Dockerfile

Image
 Hello Guys in this post I wish to explore more intresting instructions HEALTHCHECK which can be used in Dockerfile.  The most common requirement for any real-time projects monitoring using a side-car container which could run in parallel and try to check the process or application URL check or container reachability using ping command etc.  Dockerfie instruction HEALTHCHECK In Dockerfile we can have HEALTHCHECK instruction that allows us to know the condition of an application test runs as expected or not, when a container runs this will be returns a status as healthy, unhealthy based on the HEALTHCHECK command exit code. If the exit code 0 then returns healthy otherwise unhealthy. HEALTHCHECK [options] CMD [health check command] Example: HEALTHCHECK --interval=3s CMD ping c1 172.17.0.2 here are the Healthcheck options   --interval=time in sec (duration 30s is default)  --timeout=time in sec (duration 30s is default)  --start-period=time in ...

HAProxy on Docker load balance Swarm Nginx web services

Image
What is HAProxy do? HAProxy is a free and open-source load balancer that enables DevOps/SRE professionals to distribute TCP-based traffic across many backend servers. And also it works for Layer 7 load balancer for HTTP loads. HAProxy runs on Docker The goal of this post is to learn more about HAProxy, how to configure with a set of web servers as backend. It will accept requests from HTTP protocol. Generally, it will use the default port 80 to serve the real-time application requirement. HAProxy supports multiple balancing methods. While doing this experiment Nginx web app load balance with Swarm Ingress to HA proxy In this post, we have two phases first prepare the web applications running on high availability that is using multiple Docker machines to form a Swarm Cluster and then a web application deployment done using the 'docker service' command. Step 1: Create swarm Cluster on 3 machines using the following commands docker swarm init --advertise-addr=192.168.0.10 join...

Step by Step installation of Ansible Tower opensource version AWX

Image
Hello Guys, In this post, I would like to experiment with the installation of AWX on a new variety of Linux that is Alpine Linux. Prerequisites Here I will go with the Alpine Linux which is the default Operating System on  Play with  Docker  alternatively, You must have at least 3 boxes on either vagrant  or Any cloud instances (AWS) 1 Ansible engine remaining 2 for remote nodes AWX is GUI/web tool which is currently broken down to AWX-operator and AWX Task The AWX up to 18 version installations used docker based environments, where it uses the following Docker images from the Docker hub Postgress SQL Rabbit MQ MemCache Steps to install AWX 1. Update the repo on the Alpine Linux apk update 2. Installing with apk package manager 'add' subcommand will do the installation. apk add ansible This will be installing Ansible on Alpine Linux. Ansible installation on Play with Docker (PWD) instance   3. Validate the ansible installation using the version option. an...

Ansible the lineinfile, blockinfile and replace modules

Image
 Hello !! This post is for exploring the "lineinfile" vs 'blockinfile' and "replace" modules. The replace and the lineinfile use the path parameter to mark: The file to modify. lineinfile module is used to ensure[s] a particular line is in a file, or [to] replace an existing line using a back-referenced (backref) regular expression (regex). Use the replace module if you want to change multiple, similar lines The "dest" parameter is used for modules creating new files like template or copy modules. Just replace dest with path and both provided examples should work as expected. Adding lines in the file Adding a line in a file, if a file does not exist then it will create it. --- # Filename: adding_line.yml - name: testing LineInFile module hosts: localhost tasks: - name: Add a line to a file if the file does not exist lineinfile: path: /tmp/hosts line: 192.168.1.99 ansiblectl.devopshunter.com ctl cre...