-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_once_install_ansible.sh
69 lines (58 loc) · 1.36 KB
/
run_once_install_ansible.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
if [ -x "$(command -v ansible)" ]; then
echo "\033[1;30mAnsible is already installed.\033[1;30m"
exit 0
fi
install_on_fedora() {
sudo dnf install -y ansible
}
install_on_ubuntu() {
sudo apt update
sudo apt install -y ansible
}
install_on_mac() {
brew install ansible
}
install_on_debian() {
sudo apt update
sudo apt install -y ansible
}
install_on_arch() {
sudo pacman -S ansible
}
install_on_alpine() {
sudo apk add ansible
}
install_on_amazon_linux() {
sudo yum install -y ansible
}
OS="$(uname -s)"
case "${OS}" in
Linux*)
if [ -f /etc/fedora-release ]; then
install_on_fedora
elif [ -f /etc/lsb-release ]; then
install_on_ubuntu
elif [ -f /etc/debian_version ]; then
install_on_debian
elif [ -f /etc/arch-release ]; then
install_on_arch
elif [ -f /etc/alpine-release ]; then
install_on_alpine
elif [ -f /etc/amazon-linux-release ]; then
install_on_amazon_linux
else
echo "Unsupported Linux distribution"
exit 1
fi
;;
Darwin*)
install_on_mac
;;
*)
echo "Unsupported operating system: ${OS}"
exit 1
;;
esac
ansible-playbook ~/.bootstrap/setup.yml --ask-become-pass
echo "Ansible installation complete."