-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·44 lines (35 loc) · 1.02 KB
/
install
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
38
39
40
41
42
43
44
#!/usr/bin/env bash
set -euo pipefail
log() {
echo
echo "----------------------------------------------------------------------"
echo "$1"
echo "----------------------------------------------------------------------"
echo
}
install_ansible() {
log "Installing/upgrading Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ansible
}
linux_install_ansible() {
log "Installing/upgrading Ansible"
sudo apt update
sudo apt install software-properties-common --yes
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible --yes
}
log "Installing/Updating home..."
if ! which ansible-playbook > /dev/null 2>&1 ; then
echo "ansible-playbook not found on \$PATH, installing"
if [ "$(uname -s)" == "Darwin" ]; then
install_ansible
elif [ "$(uname -s)" == "Linux" ]; then
linux_install_ansible
fi
fi
(
cd "$(dirname "$0")"
cmd="ansible-playbook --inventory localhost, --connection local playbook.yml"
$cmd
)