-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathprepare_ansible.sh
executable file
·122 lines (105 loc) · 2.36 KB
/
prepare_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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash -uxe
#
# Prepare system for nextcloud devel
#
install_pip () {
curl https://bootstrap.pypa.io/get-pip.py | $SUDO $PYTHON_BIN
$SUDO pip install setuptools -U
$SUDO pip install ansible -U
$SUDO pip install netaddr -U
$SUDO pip install dnspython -U
$SUDO pip install passlib -U
$SUDO pip install bcrypt -U
$SUDO pip install Jinja2 -U
}
prepare_ubuntu() {
$SUDO apt update -y
$SUDO apt dist-upgrade -y
$SUDO apt install software-properties-common curl git mc vim facter python-minimal python-apt aptitude -y
$SUDO [ $(uname -m) == "aarch64" ] && $SUDO apt install gcc python-dev libffi-dev libssl-dev make -y
PYTHON_BIN=/usr/bin/python
install_pip
echo
echo "Ubuntu Sytem ready for nextcloud."
echo
}
prepare_debian() {
$SUDO apt update -y
$SUDO apt dist-upgrade -y
$SUDO apt install dirmngr curl git mc vim facter python python-apt -y
$SUDO [ $(uname -m) == "aarch64" ] && $SUDO apt install gcc python-dev libffi-dev libssl-dev make -y
PYTHON_BIN=/usr/bin/python
install_pip
echo
echo "Debian Sytem ready for nextcloud."
echo
}
prepare_raspbian() {
$SUDO apt update -y
$SUDO apt dist-upgrade -y
$SUDO apt install dirmngr mc vim git libffi-dev curl facter gcc python-dev python-apt libffi-dev libssl-dev make -y
PYTHON_BIN=/usr/bin/python
install_pip
echo
echo "Rasbpian System ready for nextcloud."
echo
}
prepare_centos() {
$SUDO yum install epel-release -y
$SUDO yum install git vim mc curl facter libselinux-python -y
$SUDO yum update -y
PYTHON_BIN=/usr/bin/python
install_pip
echo
echo "CentOS Sytem ready for nextcloud."
echo
}
prepare_amzn() {
$SUDO amazon-linux-extras install epel
$SUDO yum install git vim mc curl facter libselinux-python -y
$SUDO yum update -y
PYTHON_BIN=/usr/bin/python
install_pip
set +x
echo
echo " Amazon Linux 2 ready for nextcloud."
echo
}
usage() {
echo
echo "Linux distribution not detected."
echo "Use: ID=[Ubuntu|Debian|CentOS|raspbian] setup_ec2.sh"
echo "Other distributions not yet supported."
echo
}
if [ -f /etc/os-release ]; then
. /etc/os-release
elif [ -f /etc/debian_version ]; then
$ID=debian
fi
# root or not
if [[ $EUID -ne 0 ]]; then
SUDO='sudo -H'
else
SUDO=''
fi
case $ID in
'ubuntu')
prepare_ubuntu
;;
'debian')
prepare_debian
;;
'raspbian')
prepare_raspbian
;;
'centos')
prepare_centos
;;
'amzn')
prepare_amzn
;;
*)
usage
;;
esac