ericsysmin's DevOps Blog

Installing ZSH on WSL: Ubuntu

Installing ZSH on WSL: Ubuntu

Having moved away from development of Ansible/Python/Terraform, and others on Windows a few years ago. I’ve heard that WSL has become much better, especially with its support of VS Code now that they have a WSL connector. So, I decided to give it a try.

However, I did run into one surprising inconvenience, BASH! I have become so accustomed to ZSH over the years on Apple and using oh-my-zsh that all my shortcuts and quick ways to doing things just weren’t there.

I did attempt to use oh-my-bash but there just aren’t the number of plugins already to support the plethora of plugins I need and use on a regular basis. So, next logical step is to install ZSH on my WSL: Ubuntu system.

Requirements

WSL with Ubuntu installed

Steps to install ZSH

  1. Install ZSH.
  2. Verify that ZSH has been installed on the system.
  3. Set ZSH as your default shell.
    NOTE: This used to require modifications to the shortcut to access WSL but in newer versions of WSL you can use the following.

    For older versions you will need to modify the shortcut to WSL and use the command:

  4. Once you close and reopen your WSL Ubuntu shell you should now be in ZSH shell.
    zsh-shell-screenshot

Install of Oh-my-zsh

  1. Ensure that your terminal session is open and use the following command as per https://ohmyz.sh/#install
  2. You should now be able to configure your oh-my-zsh installation by modifying your .zshrc file and enable any plugins you need.
  3. The final result! 🙂 

    Screenshot of oh-my-zsh on WSL: Ubuntu

 

Hopefully that helps, I know it helped me as I venture back to Windows for development of my Ansible playbooks and other tools.

Continue reading...
Installing Wget via Xcode on Mac OSX

Installing Wget via Xcode on Mac OSX

Install Xcode

First, you will need to ensure that Xcode is installed, and you can install it via the App Store here https://apps.apple.com/au/app/xcode/id497799835?mt=12

Installing Wget

Next, we need to get the latest copy of Wget. We will use curl for this command.

We will extract the tar.gz

Change your directory to the wget folder that was extracted. Then configure it.

Now we need to make wget, and then install it.

Let’s test it to make sure it works

 

Continue reading...
How to loop blocks of code in Ansible

How to loop blocks of code in Ansible

In this blog post I will cover how we can loop groups/blocks of tasks within Ansible. Currently using - block: will not work. However you can use - include_tasks: my_grouped_tasks.yml to loop a group of tasks. Within that tasks file you can use {{ item }} on each of your tasks and It will copy from the item during the loop. At Avi Networks we’ve used this for much of our internal task groupings which have items that depend on creation of each other and cannot independently run loops without causing issues.

In the following I have some visual representations to show what the goal origianlly was, and how you can accomplish it.

PROBLEM:

SOLUTION:

This will effectively do a loop over your multiple tasks. I know it’s a bit annoying, but this is currently the only working solution to looping over blocks of tasks.

Continue reading...

Integrating Zabbix w/Slack for Channel Notifications

I’ve been using Slack and Zabbix now for a few years, and figured since there’s not too many guides out there on how to integrate the two easily. I know there are a few examples so far, but this is what’s worked best for me.

First I use this script, and put it in your alertscripts directory, ex.   /usr/lib/zabbix/alertscripts .

Notice there’s no field for credentials. That’s because over time I found it easier to deploy with a configuration file that was in yaml format.

Make sure you create an API token for slack by creating a Slack App, then using it’s Verification Token. Hopefully in the future I revisit this and make use of the Client ID, Client Secret, Signing Secret configuration.

So to provide that file we need to create the following in your zabbix configuration directory ex.  /ext/zabbix/slack.yml .

This makes it easier at least for me to deploy and separate configuration from the script itself.

Next steps include creating the Slack Media Type.

Navigate to Administration > Media types

Select “Create media type”, and fill out the following:

 

Don’t forget to save!

Your first value is going to be “Channel” the rest fill in the message details.

Continue reading...
Using Avi Ansible modules to Patch your Avi Controller

Using Avi Ansible modules to Patch your Avi Controller

So I’ve been working for a company called Avi Networks for a while now. Working on customer deployments, internal devops automation, customer migrations, and tons of other projects including getting Avi to have the largest module library available out of any load balancer on the market. Well, today were going to show how to use Avi’s Ansible modules to patch your Avi Controller. It’s easy, here’s how.

This will also wait for the controller to come back up 🙂

Continue reading...