make ssh config file name variable

This commit is contained in:
2026-02-03 19:04:49 -06:00
parent 332f7bf983
commit ca9953bac1
2 changed files with 10 additions and 3 deletions

View File

@@ -3,9 +3,16 @@
# Author: Landon Dyck # Author: Landon Dyck
# This will use an ansible host file to create an ssh config file and ensure it # This will use an ansible host file to create an ssh config file and ensure it
# is included in your ssh config # is included in your ssh config
# Usage: $ ./create_ssh_config.sh [HOST_FILE=ansible/hosts] # Usage: $ ./create_ssh_config.sh SOMETHING_UNIQUE
PATH=${PWD}/env/bin:${PATH} PATH=${PWD}/env/bin:${PATH}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
HOST_FILE="${HOST_FILE:-ansible/hosts}" 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
ansible-playbook $SCRIPT_DIR/create_ssh_config.yml -i $HOST_FILE CONFIG_NAME=$1
ansible-playbook $SCRIPT_DIR/create_ssh_config.yml -i $HOST_FILE -e config_name=$CONFIG_NAME

View File

@@ -2,7 +2,7 @@
connection: local connection: local
gather_facts: false gather_facts: false
vars: vars:
include_path: ~/.ssh/config.d/codemonkey.config include_path: ~/.ssh/config.d/{{config_name}}.config
tasks: tasks:
- name: Include ssh config dir - name: Include ssh config dir