Connective Tissue

I am currently learning a piece of music on guitar that starts in A minor and then, some measures later, shifts to A# minor. Such a chromatic move is curiously compelling. It's not traditional by any means. However, when taken into conte

For me, one of the more enjoyable parts about music theory is figuring out how composers connect disparate tonal regions together. And that's the joy about this piece I am learning in particular. The connective musical tissue between these two tonal centers is what makes the piece that much more fascinating.

This is how I feel when I program. Just recently I played around with Ansible and having it provision AWS resources that are created by using an AWS CloudFormation template. Ansible relies on an inventory file to know what resources it has access to when I run commands through Ansible. The catch is that, to cut costs, I delete the AWS resources after each session. With the IP addresses of the VM's always changing, Ansible cannot rely on a static inventory file.

Ansible and AWS CloudFormation were my tonal centers in this case. The goal was to connect them together so that, once I deploy the AWS resources, I create a new inventory file with the information from the AWS CloudFormation API. Here's the jacked up bash script (with a lot of help from jq):

#!/bin/bash

output=$(aws cloudformation describe-stacks --stack-name ansible | jq '.Stacks[0] .Outputs')

value="[webservers]
app1 ansible_host=$(echo $output | jq -r '.[0].OutputValue')
app2 ansible_host=$(echo $output | jq -r '.[1].OutputValue')

[loadbalancers]
lb1 ansible_host=$(echo $output | jq -r '.[2].OutputValue')

[local]
control ansible-connection=local
"
# So apparently if you put quotes around a var it will keep the og spacing
echo "$value" > hosts.ini

# Run the playbook
ansible-playbook playbooks/run-the-playbook.yml

With programming I find the joy in creating connective tissue — be it a kludged together application or a one-off script. That part of programming feels very much like music, whether that be classical music or free jazz.