Posts

Docker image shipping using save and laod commands

Image
  Docker shipping images Prerequisites There should be two docker installed boxes. Here in my case I'm using mstr, node1 boxes on my GCP. High level overview Docker images can be build based on the project requirements, Development team prepared a image which need to be ship to remote hosts. This is one of the key requirement for containerized micro-service applications. Docker shipping using docker save and docker load commands Step 1: In this post we will be creating a custom docker image name as 'dhanvi:1.0'. Step 2. Save the custom image to a tar file and also tar.gz file (docker save). Step 3. Ship the minimal size image file that is tar.gz file to a remote host (scp from mstr to node1). Step 4. On the remote host load the docker image file using (docker load). Step 5. List the docker images on the node1 and run the container. Custom Image creation  Docker image save Docker command CLI provides us to save a docker image to a user specified file using docker save comman...

Ansible Error Handling and Fail Handling

Image
Hello everyone!! In this post I would like to experiment with the failure handling with block-rescue-always block in a Ansible tasks in playbook.  Prerequisites * Ansible installed and their must be Target nodes * Basic understanding of any programming language that uses try- catch blocks Ansible stops playbook execution on a task failure and we can choose to ignore that using 'ignore_errors' to continue with remaining tasks. (in Python we have 'pass' similar to that). If you have couple of tasks in a playbook, when first task fails Ansible stops there. But if you want to execute the next tasks even though your first task failed. --- # File name: ignore_err.yml - name: check ignore errors hosts: localhost gather_facts: false tasks: - block: - command: "ls ~/" - command: "ls ~/bin" - command: "ls /etc/hosts" become_user: root become: yes ignore_errors: yes No...

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/...