#!/bin/sh # This script will do an offline install of ansible. # It requires that the variable ANSIBLE_RPMS_TAR_GZ be set to the path of a # tar.gz file containing RPMs for Ansible and it's dependencies. # TODO Combine this and other rpm tar.gz archives. set -u # Make sure our environment variable is set before using it and creating a # temporary directory. stat "$ANSIBLE_RPMS_TAR_GZ" # Create a temporary location to extract the RPMs to. mkdir tmp # Extract the RPM tar.gz file to a temporary directory. tar xvzf "$ANSIBLE_RPMS_TAR_GZ" -C ./tmp # Perform a localinstall of all the RPMs extracted from ANSIBLE_RPMS_TAR_GZ. # # Ignore the shellshock error about quoting the find, because in this case we # don't the string to split. # shellcheck disable=SC2046 yum localinstall --disablerepo=* --nogpgcheck -y $(find ./tmp -name "*.rpm") # Delete the temporary RPM package. rm -rf tmp