-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
37 lines (31 loc) · 922 Bytes
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
cwd=$(dirname $0)
cd $cwd || exit 1
ansible=$(which ansible-playbook)
if [ "no$ansible" = "no" ]; then
#statements
echo "No ansible installed. Install ansible on local hosts..."
yum install epel-release ansible -y
fi
echo "add ssh config to ~/.ssh/config"
if [ ! -d ~/.ssh ]; then
mkdir ~/.ssh
fi
if [ ! -f ~/.ssh/config ]; then
#statements
touch ~/.ssh/config
fi
hosts=$(egrep "^Host[[:space:]]+\*" ~/.ssh/config)
forward=$(egrep "^[[:space:]]+ForwardAgent[[:space:]]+yes" ~/.ssh/config)
checking=$(egrep "^[[:space:]]+StrictHostKeyChecking[[:space:]]+no" ~/.ssh/config)
if [ "no$hosts" = "no" ] && [ "no$forward" = "no" ] && [ "no$checking" = "no" ]; then
cat << EOF >> ~/.ssh/config
Host *
ForwardAgent yes
ServerAliveInterval 120
ServerAliveCountMax 3
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOF
fi
ansible-playbook -i hosts site.yml