Posts

Showing posts from January, 2022

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