Photo by Raphaël Biscaldi on Unsplash
Photo by Raphaël Biscaldi on Unsplash
Photo by Raphaël Biscaldi on Unsplash

Ansible is an agentless open-source automation tool including configuration management, application deployment, and infrastructure orchestration through playbooks running tasks sequentially :

---
- name: Install and Start Apache # Name of the playbook
hosts: webservers # Host group name
tasks:
# Play to install apache with yum module
- name: Ensure apache is installed
yum:
name: httpd
state enabled
# Play to start apache with service module
- name: Ensure apache is running
service:
name: httpd
state: started

Over time the complexity of playbooks can begin hard to read and complex to maintain. In addition, you can have some redundant…


Programming

Photo by Micheile Henderson on Unsplash
Photo by Micheile Henderson on Unsplash
Photo by Micheile Henderson on Unsplash

Cloud computing is awesome for growing and scaling up infrastructure quickly to follow product needs. However, this elasticity and flexibility come at a cost. Reviewing your bill daily is crucial to avoid unpleasant surprises at the end of the month. Cloud providers offer tools ( here some examples for AWS) and good practices to help you saving money.

Most of the time, infrastructure as code (IaC) is employed to maintain and facilitate the evolution of this underlying. Like any other type of language, it should follow the same good practices and pass the code review step with other contributors. As…


Photo by CHUTTERSNAP on Unsplash

This article is a continuation of two previous articles. In the first one, we created an Ansible role including tests with the Molecule framework. From this base, we saw how to build a Docker image with Packer and Ansible in the second article. Now we have the WordPress image present in the AWS Elastic Container Registry (ECR).

Here we are going to write the Terraform code to deploy WordPress with Elastic Container Service (ECS). ECS is a fully managed container orchestration service. We will use AWS Fargate for containers for serverless compute engine. …


Photo by Danist Soh on Unsplash
Photo by Danist Soh on Unsplash
Photo by Danist Soh on Unsplash

In a previous article, we have seen how to create a testable Ansible role with Molecule and Docker. This role installs and configures WordPress in a Docker image. This part was only covered tests using Molecule. Here we are going to go further to reuse this work to build the Docker image with Packer.

We will see how to configure Packer through manifests. There will be two manifests, one to build the image locally and the other remotely. We will persist the remote image in AWS Elastic Registry (ECR). For both manifests, we will use the Ansible provisioner and Docker…


CODEX

Representation of the possibility to deploy Kubernetes cluster in Docker with Kind
Representation of the possibility to deploy Kubernetes cluster in Docker with Kind
Photo by Call Me Fred on Unsplash

In this article, we’ll have a look at how to deploy a Kubernetes cluster from scratch for a testing strategy. When developing Kubernetes-dependent features as Helm charts for example you need a cluster to test them. We don’t always have a reserved cluster for CI or maybe you want to have isolated tests to avoid side effects.

At the beginning of Kubernetes popularity raise, an easy way to play and learn was to deploy a cluster using Minikube. We’ll see why it is not the most suitable solution for pipelines compared to currently available solutions. Now it is possible to…


Figurine made of Amazon boxes
Figurine made of Amazon boxes
Photo by Daniel Eledut on Unsplash.

Do you need to test some pieces of code interacting with AWS? In this article, I’m going to introduce the Moto library whose aim is to mock out AWS services. That means you won’t have to deploy anything in the AWS cloud to test your code.

In the first part, we’ll create a simple piece of code interacting with the Elastic Compute (EC2) service. We’ll examine the different ways of mocking provided by Moto. This will give you an overview of its possibilities.

Next, we’ll couple the Moto library and pytest framework to have clean and scalable unit tests.

Prerequisites

First…


Photo by Danil Shostak on Unsplash
Photo by Danil Shostak on Unsplash
Photo by Danil Shostak on Unsplash

In a previous article, I presented to you coding-style importance and pre-commit framework. Today, we’re going to handle pre-commit for Terraform code. It will be in charge of validating code using linters and scanners. For any new git commit, we’ll be able to ensure there is no regression and keep a constant quality.

First of all, we’ll create a Terraform module for having something to test. The modules are good to not duplicate code and should be hardly tested to be reliable. We’ll have a look at which pre-commit plugins to use for Terraform.

Once the module in place, we’ll…


Cloud, Infrastructure as Code

Photo by Piret Ilver on Unsplash
Photo by Piret Ilver on Unsplash
Photo by Piret Ilver on Unsplash

Recently I have confronted myself with the need of using a static IP with load-balancers. The reason was to be able to whitelist IP addresses in firewalls. By making some researches, I have discovered that ELBv1 does not support this feature. ELBs manage IP addresses behind the scene you have no control over it.

The first step was to migrate to a network load-balancer (NLB). In the first section, we’re going to inspect its characteristics. Then we put in place a small Terraform project to assigned reserved public IP to an NLB.

Network Load Balancer

At first view, the NLB looks like ELBv1…


IoT, Programming, Technology

Photo by Luke Chesser on Unsplash

Prometheus is an open-source project for monitoring and alerting metrics. It relies on a time-series database that is well suited to IoT purposes. In this article, we’ll see how to collect temperature and humidity from a Raspberry Pi. These metrics are collecting from a DHT22/AM2302 sensor. We’re going to see how to connect the sensor to the card and confirm data acquisition.

The next step is the implementation of a Prometheus exporter in Golang. An exporter exposes the metrics through an HTTP server with good format. The Prometheus server calls the exporter to collect and stores the metrics. …


DevOps, Containers

Photo by ines mills on Unsplash

In December 2020, the Kubernetes project has deprecated docker. Through this lecture, we are going to have a first look at the dockerhistory to understand the reasons for this deprecation. This will bring us next to discover containerdand figure out its advantages.

We will practice containerd by installing it on a Raspberry Pi. This target platform is a good scenario to dig into the different components needed to use containerd. There are no available binaries so we will build them from the sources. …

Guillaume Vincent

DevOps Engineer & AWS Certified Solution Architect. Cloud enthusiast and automation addict. Find out more content at https://getbetterdevops.io/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store