Skip to content

Commit

Permalink
refactoring and ignoring ssh key
Browse files Browse the repository at this point in the history
  • Loading branch information
george georgovassilis committed Nov 1, 2022
1 parent b6a35be commit 85d11a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sshkey.private
13 changes: 11 additions & 2 deletions setup-elastic-cluster.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/bash
base="/home/george/Desktop/elastic"

PATH_TO_SSH_KEY="sshkey.private"
SSH_USER="root"

# Absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=$(readlink -f "$0")
# Absolute path this script is in, thus /home/user/bin
BASE=$(dirname "$SCRIPT")

cd "$BASE"

function ans() {
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook --inventory-file "$base/hosts" --private-key "$base/sshkey.private" -u root "$@"
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook --inventory-file "hosts" --private-key "$PATH_TO_SSH_KEY" -u SSH_USER "$@"
}

ans setup-k3s-ansible/common.playbook
Expand Down

0 comments on commit 85d11a3

Please sign in to comment.