forked from racoon63/setup-workstation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·67 lines (50 loc) · 1.41 KB
/
install.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
#!/usr/bin/env bash
# Usage:
# wget -q -O - https://raw.githubusercontent.com/patricklubach/setup-workstation/main/install.sh | bash
set -ex
prepare_ubuntu_based() {
# Update and upgrade workstation
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
# Install python3 to install ansible in the next step
sudo apt install -y python3 \
python3-pip \
git
}
prepare_fedora_based() {
# Update and upgrade workstation
sudo dnf update -y
# Install python3 to install ansible in the next step
sudo dnf install -y python3 \
python3-pip \
git
}
source <(grep ID /etc/os-release)
if [[ $ID == "fedora" ]]; then
prepare_fedora_based
fi
if [[ $ID == "ubuntu" ]]; then
prepare_ubuntu_based
fi
pip3 install --user ansible
# Add ansible bin to PATH
export "PATH=$PATH:$HOME/.local/bin"
declare -r SETUP_DIR=$HOME/.setup-workstation
# Clone respository
if [[ ! -d $SETUP_DIR ]]
then
git clone --progress https://github.com/patricklubach/setup-workstation.git ${SETUP_DIR}
fi
# Pull changes if there
if [[ -d $SETUP_DIR ]]
then
cd ${SETUP_DIR}
git pull origin main
fi
# Switch to workdir
cd ${SETUP_DIR}
# Install Ansible roles
ansible-galaxy install geerlingguy.docker,7.1.0
# Provision workstation
ansible-playbook playbook.yml --ask-become-pass 2>&1 | tee -a provision.log