Strategy for Migrating to Infrastructure as Code

There are several existing resources that document strategies for migrating infrastructure to code. This post is about my experiences based on the reality, the challenges and best practices.

The Setting

You’re in charge of the infrastructure that the entire organization relies upon. Your product is a 24/7 web application, service or destination. The internet property is secure and five nines of uptime is expected. During a meeting with Sr. Leadership, a directive comes down: “We’re moving to the cloud”.

Read more

Bash Scripts for Cloudinary

Cloudinary is an amazing image hosting service that offers both a highly functional free tier in addition to a paid enterprise grade image hosting and transformation service.

In this tutorial I demonstrate a few simple bash shell scripts to interface with Cloudinary.

Read more

Speeding up Ansible Playbook runs

Ansible is a great tool for configuration management but because of the way it’s designed a common complaint is that it’s not as fast as other tools like Salt, Chef or Puppet. This is because Ansible doesn’t have an agent that listens (although it can) on a host and uses a different type of deployment methodology that is based on SSH. This post isn’t about the pros and cons of each tool, but rather about ways to improve upon Ansible’s default configuration values. By default Ansible ships with very conservative default values. This is smart in my opinion because it offers greater compatibility out-of-the-box. Here I highlight some safe adjustments that can be made to the default configuration for improved performance (speed!)

Real World Playbook Test

For this test I’m using a real-world playbook that I use in my homelab when provisioning a new CentOS VM. It configures some basic things (hostname, ssh keys, etc), installs common packages/utilities and tunes some OS configurations.

Read more

Dynamic DNS via Digital Ocean API

This is a quick tutorial about setting up a simple shell script that runs periodically to update a DNS record on the internet with the IP address of your network. If you’ve ever wanted to have myhome.mydomain.com always updated with your home IP address, this is one way you can do it. There are paid and free services that offer this functionality, but I choose to use this method because it gives me ultimate flexibility over my domain.
This tutorial assumes you have your own Top Level Domain (TLD) and that you’ve configured it to use Digital Ocean as the authoritative DNS for it. Here, I’ll use “example.com” as the top level domain.

Generate a Personal Access Token

Log in to Digital Ocean and click on API from the top Menu. Click the Generate New Token button and give it a name. The name is not parsed, it’s just for your own reference. I like to give it something descriptive to my application. For this example, I’ll use MyDNS. Be sure to check the box next to Write so we can update the records using this API Key.

Once you have the API Key, save it somewhere for reference. It’s one of the 3 variables we’ll need to update in the update_do_dns.sh script.

The API Key will look something like this:
fe3aeda96b7wer8wer1e6bb5erae528sdf3a6120dfrf7e492bwer6343fsdf

Read more

Inxi - a utility for viewing system information

Inxi

inxi is a super handy system info utility. These days I typically work with ephemeral instances / microservers, so I just dispose of infrastructure that flakes out. Occassionally I’ll need to see what’s up with a box so I’ve put together some common invocations of inxi below for reference:

Common Invocations

Read more