network automation blog
-
Basic Vim movements
These are pretty much the keys I use to move around in Vim (or Neovim). Key Explanation h Move the cursor left. j Move the cursor down. k Move the cursor up. l Move the cursor right. gg Go to the first line of the document. G Go to the last line of the document…
-
Essential Tmux commands
Tmux is a terminal multiplexer and I can’t imagine working in a terminal without it. Here is a list of commands I most frequently use. Please note that the “prefix” will depend on your Tmux dotfiles (the default is ctrl+b). Command Explanation tmux ls List active sessions. tmux new -s example Create and connect to…
-
Ansible Navigator intro
Ansible Navigator is a text-based command-line version of AAP/AWX (with some limitations), and I use it to test and troubleshoot newly created execution environments. Ansible Navigator can be installed with pip. Once installed, create an ansible-navigator.yml configuration file, and point to the execution environment image, along with your inventory and ansible.cfg file. Then run a…
-
Useful Ansible commands
Table with Ansible commands I use often: Command Explanation $ ansible-playbook playbook.yml -i ~/inventory/production -e “target=host1” Run a playbook with some common options. $ ansible-vault encrypt_string ‘secret’ –name ‘foobar’ Encrypt a variable. $ ansible localhost -m debug -a var=’foobar’ -e ‘@inventory/group_vars/all/foobar.yml’ Decrypt a variable. $ ansible-inventory –list -i ./inventory/production Parse the inventory. $ ansible-galaxy collection…
-
Helpful Vim commands
Vim has a lot of built-in commands that are very helpful. The following table lists commands I tend to use often. However, this is not even the tip of the command iceberg Vim offers. Command Explanation :%s/foo/bar/g Replace all instances of “foo” with “bar”. :g/foobar/d Delete all lines containing “foobar”. d$ Delete the current line…
-
Legacy SSH key exchange workaround
Cisco switches sometimes last longer than their cryptographic algorithms. You can fix this by purchasing a new switch (dah) or by enabling the old, and most likely weak, key exchange algorithm for the affected hosts in ~/.ssh/config. If that didn’t help and you get something like this: Then, the simplest workaround is to globally enable…
-
Ansible Builder intro
Ansible Builder is a Python tool used to build execution environments for AAP/AWX. An execution environment is a container acting as the Ansible Controller Node and is a required component in AAP/AWX. To get started, install Ansible Builder with pip, and make sure you have Podman/Docker installed, as Ansible Builder depends on a containerization tool.…
-
Workflow thoughts
My workflow is centered around the terminal where my main drivers are bash, tmux, and neovim. A lot of time has been invested into this workflow by exploring, writing, and optimizing dotfiles and key bindings. The result of this investment is a keyboard-driven workflow that requires very little mental overhead while also providing familiar ground…
-
Installing Ansible correctly
The Ansible controller requires a UNIX-based OS and Python. Since Ansible runs in Python, it can (and should) be installed through pip – the package manager for Python. The optimal way to manage Python packages is by first creating and enabling a virtual environment; a disposable and OS-isolated environment locked to a specific Python interpreter.…
-
Ansible inventory structure
The inventory is Ansible’s source of truth. It is where all your hosts and groups, along with data like NTP and VLANs, are defined. Building and maintaining an inventory for Ansible can be difficult, but less so if you get the structure right. I define my groups and hosts in a (ini) file named groups_and_hosts.…