-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·55 lines (42 loc) · 1.09 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
#!/bin/sh
set -e
_install_clt() {
echo 'Install CLT'
xcode-select --install
}
_install_pipx() {
if ! [ -x "$(command -v pipx)" ]; then
mkdir -p "$HOME"/.local/opt
echo 'Create user venv'
/usr/bin/python3 -m venv "$HOME"/.local/opt/venv
echo 'Install pipx into user venv'
"$HOME"/.local/opt/venv/bin/pip install pipx
echo 'Manually ensurepath for pipx'
# this will be replaced later with ansible configs
export PIPX_HOME="$HOME/.local/share/pipx"
export PATH="$HOME/.local/opt/venv/bin:$PATH:$HOME/.local/bin"
pipx ensurepath
else
echo 'pipx already installed'
fi
}
_install_ansible() {
if ! [ -x "$(command -v ansible)" ]; then
echo 'Install ansible with pipx'
pipx install --install-deps ansible
else
echo 'ansible already installed'
fi
}
_run_ansible() {
echo 'using implicit localhost'
ansible-playbook -v --ask-become-pass site.yaml
}
run_setup() {
_install_clt
_install_pipx
_install_ansible
_run_ansible
}
run_setup
unset run_setup