18 lines
583 B
Bash
Executable File
18 lines
583 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Author: Landon Dyck
|
|
# This will use an ansible host file to create an ssh config file and ensure it
|
|
# is included in your ssh config
|
|
# Usage: $ ./create_ssh_config.sh SOMETHING_UNIQUE
|
|
PATH=${PWD}/env/bin:${PATH}
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
HOST_FILE="${HOST_FILE:-ansible/hosts}"
|
|
if [ $# -eq 0 ]
|
|
then
|
|
echo "Please specify config file name: create_ssh_config.sh SOMETHING_UNIQUE"
|
|
exit 1
|
|
fi
|
|
|
|
CONFIG_NAME=$1
|
|
|
|
ansible-playbook $SCRIPT_DIR/create_ssh_config.yml -i $HOST_FILE -e config_name=$CONFIG_NAME |