Terraform and Libvirt provider demo

Terraform is a great tool to build infrastructures. You will see many tutorials on how to use it with AWS, Azure or GCP. But you can do more. I use it to quickly create KVM virtual machines for ansible roles testing, and fun ! Thanks to the Terraform libvirt provider I will explain here how to create a sandbox of three machines. I used it to develop my etcd ansible role....

<span title='2021-08-13 15:00:00 +0000 UTC'>August 13, 2021</span>&nbsp;·&nbsp;4 min&nbsp;·&nbsp;JC

L'homme pressé refait deux fois la même chose

Le site où se trouvait le post qui suit n’existe plus. On peut en trouver une archive ici. Vous avez un objectif, un truc qui semble simple, tellement simple que vous foncez, vous foncez et BOOM, un obstacle. Regardez la suite en 4 images, ça fait mal mais c’est tellement vrai… Acte 1 : Vous regardez votre objectif Acte 2 : Vous essayez d’atteindre votre objectif Acte 3 : En bon soldat, vous y retournez tête baissée Acte 4 : Vu de loin, on ne comprend pas trop ce que vous faites Acte 5 : La morale Cette situation est un grand classique :...

<span title='2021-07-27 05:00:00 +0000 UTC'>July 27, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;JC

Paste a predefined text via a keyboard shortcut

The aim of this tip is to have a keyboard shortcut to quickly configure my favorite kubectl aliases for the CKA exam :-) Install xdotool and xsel sudo apt install xdotool xsel Add this keyboard shortcut (In Gnome: Settings > Keyboard > Customize Shortcuts > Custom Shortcut) /bin/bash -c 'echo -n "source <(kubectl completion bash) && alias k=kubectl && complete -F __start_kubectl k && alias kgp=\"kubectl get pods\"" | xsel && xdotool click 2' Source: https://askubuntu....

<span title='2021-03-25 21:24:02 +0000 UTC'>March 25, 2021</span>&nbsp;·&nbsp;1 min&nbsp;·&nbsp;JC

Update author and email in git history

Imagine you have already made some commits in a git repo and you want to update your mail address and/or your name ? In short, you want to re-write git history with good informations. Here is a script who can do that. Put here in parent folder of git repo you want to edit: #!/bin/sh git filter-branch --env-filter ' OLD_EMAIL="[email protected]" CORRECT_NAME="Your Name" CORRECT_EMAIL="[email protected]" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] then export GIT_COMMITTER_NAME="$CORRECT_NAME" export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] then export GIT_AUTHOR_NAME="$CORRECT_NAME" export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" fi ' --tag-name-filter cat -- --branches --tags This script will search for all commits done by incorrect-email@domain....

<span title='2021-02-24 14:41:02 +0000 UTC'>February 24, 2021</span>&nbsp;·&nbsp;1 min&nbsp;·&nbsp;JC

Multiple ansible versions with python virtualenv

TL;DR export ANSIBLE_VERSION=x.x.x mkdir -p ~/ansible_venv cd ~/ansible_venv python3 -m venv ansible${ANSIBLE_VERSION} source ansible${ANSIBLE_VERSION}/bin/activate pip install --upgrade pip setuptools pip install ansible==${ANSIBLE_VERSION} ansible-lint netaddr pbr hvac jmespath passlib bcrypt . ~/ansible_venv/ansible${ANSIBLE_VERSION}/bin/activate Long story Install python3-venv package: sudo apt install python3-venv Create an ~/ansible_venv directory: mkdir ~/ansible_venv From ~/ansible_venv directory, create your virtual ansible environment: e.g for ansible 2.9.16: python3 -m venv ansible2.9.16 Once this environment created, activate it: source ansible2.9.16/bin/activate You will see your shell has changed, with name of virtualenv you are currently using....

<span title='2021-02-24 14:24:02 +0000 UTC'>February 24, 2021</span>&nbsp;·&nbsp;1 min&nbsp;·&nbsp;JC