From 37b4e558b2aeae6be54d61d5a7284625d0172a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Mon, 25 Jan 2021 21:45:35 +0100 Subject: [PATCH] fix the Makefile and a shell script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- Makefile | 15 ++++++++------- scripts/create-ssh-config.sh | 9 ++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index dace9aa..34e81e1 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ OS = $(strip $(shell uname -s)) ARCH = linux_amd64 PLATFORM = linux ifeq ($(OS),Darwin) - ARCH = darwin_amd64 - PLATFORM = darwin + ARCH = darwin_amd64 + PLATFORM = darwin endif PLUGIN_DIR = ~/.terraform.d/plugins @@ -31,11 +31,6 @@ install-provisioner: init-terraform: terraform init -upgrade=true -ssh-config: export SSH_CONFIG_DIR := ~/.ssh/config.d -ssh-config: export SSH_CONFIG_FILE := infra-nimbus -ssh-config: export SSH_USERNAME := $$(whoami) - scripts/create-ssh-config.sh - secrets: @echo "Saving Consul certificates: ansible/files/consul*" pass services/consul/ca-crt > ansible/files/consul-ca.crt @@ -45,3 +40,9 @@ secrets: cleanup: rm -r $(PLUGIN_DIR)/$(ARCHIVE) + +ssh-config: export SSH_CONFIG_DIR ?= $(HOME)/.ssh/config.d +ssh-config: export SSH_CONFIG_FILE ?= infra-nimbus +ssh-config: export SSH_USERNAME ?= $(USER) +ssh-config: + scripts/create-ssh-config.sh diff --git a/scripts/create-ssh-config.sh b/scripts/create-ssh-config.sh index 403809f..8bab7fa 100755 --- a/scripts/create-ssh-config.sh +++ b/scripts/create-ssh-config.sh @@ -1,7 +1,7 @@ -#!/bin/usr/env bash +#!/usr/bin/env bash set -e -cd $(dirname "$0") +cd $(dirname "$0")/.. if [[ "${SSH_CONFIG_DIR}" == "" ]]; then echo Please specify the SSH_CONFIG_DIR environment variable @@ -19,9 +19,8 @@ INFRA_NIMBUS_SSH_CONFIG="${SSH_CONFIG_DIR}/${SSH_CONFIG_FILE}" mkdir -p "${SSH_CONFIG_DIR}" && chmod 700 "${SSH_CONFIG_DIR}" rm -f "${INFRA_NIMBUS_SSH_CONFIG}" -for host in $(ansible all -i ../ansible/inventory/test --list-hosts | grep -v 'hosts') -do - cat << EOF >> "${INFRA_NIMBUS_SSH_CONFIG}" +for host in $(ansible all -i ansible/inventory/test --list-hosts | grep -v 'hosts'); do + cat << EOF >> "${INFRA_NIMBUS_SSH_CONFIG}" Host nimbus-$host Hostname $host.statusim.net User ${SSH_USERNAME}