Stuff I'm Up To

Technical Ramblings

Installing Ansible Public Key Not Available — November 30, 2020

Installing Ansible Public Key Not Available

When trying to install Ansible on Debian following the install guide here:

https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-on-debian

We get an error:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
 Executing: /tmp/apt-key-gpghome.rg65w1DpOn/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
 gpg: connecting dirmngr at '/tmp/apt-key-gpghome.rg65w1DpOn/S.dirmngr' failed: IPC connect call failed
 gpg: keyserver receive failed: No dirmngr

Then the apt install fails with the expected NO_PUBKEY error.

Err:1 http://ppa.launchpad.net/ansible/ansible/ubuntu trusty InRelease
   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 93C4A3FD7BB9C367
Continue reading
Icinga2 Downtime Script — November 9, 2020

Icinga2 Downtime Script

I wanted to automatically trigger downtime when we ran maintenance tasks on our client systems. For this I wanted to add in a bash script to make the call to Icinga2 when we start and finish the process.

In order to do this I used a could of additional command line JSON utilities jo for creating JSON from parameters and jq for reading and processing JSON responses.

The script is flexible enough to accept parameters to control duration and either trigger a host or service downtime.

Continue reading
Bash Script Template —

Bash Script Template

As I find myself writing a few scripts these days I thought I’d sate the template I use to build with. It includes parameter collection.

#!/bin/bash
EXAMPLE="example default"
# Plugin variable description
PROGNAME=$(basename $0)
RELEASE="Revision 1.0.0"
AUTHOR="(c) 2020 Warlord0"
# Functions plugin usage
print_release() {
echo "$RELEASE $AUTHOR"
}
print_usage() {
echo ""
echo "$PROGNAME $RELEASE – Bash Script Template"
echo ""
echo "Usage: $PROGNAME"
echo ""
echo " -h Show this page"
echo ""
echo " -e | –example Example argument"
echo ""
echo "Usage: $PROGNAME –help"
echo ""
exit 0
}
print_help() {
print_usage
echo ""
echo "Bash script template"
echo ""
exit 0
}
# Parse parameters
while [ $# -gt 0 ]; do
case "$1" in
-h | –help)
print_help
exit 0
;;
-v | –version)
print_release
exit 0
;;
-e | –example)
shift
EXAMPLE=$1
;;
*)
echo "Unknown argument: $1"
print_usage
;;
esac
shift
done
if [[ -z "${EXAMPLE}" || -z "${EXAMPLE}" ]]; then
echo "Missing argument"
exit 1
fi
# Script body goes after here
view raw template.sh hosted with ❤ by GitHub