-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvm-setup.sh
More file actions
executable file
·47 lines (36 loc) · 1.15 KB
/
vm-setup.sh
File metadata and controls
executable file
·47 lines (36 loc) · 1.15 KB
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
#!/bin/bash
set -xe
ROOT_REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function git_pull {
cd $ROOT_REPO_DIR
git fetch
# Check if the local branch is behind the remote branch
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
if [ $LOCAL = $REMOTE ]; then
echo "Your branch is up to date with the remote."
else
git pull
echo "There is change in remote, please re-run this script"
exit 1
fi
}
function vm_setup {
# Update tc-local-vm repo
cd $ROOT_REPO_DIR
git pull
# Setup ansible
# -- Install ansible
$ROOT_REPO_DIR/system/ansible-setup.sh
# -- Run vm_setup playbook
ANSIBLE_PLAYBOOKS_DIR="$ROOT_REPO_DIR/system/playbooks"
ansible-playbook --diff $ANSIBLE_PLAYBOOKS_DIR/sync.yml
ansible-playbook --diff $ANSIBLE_PLAYBOOKS_DIR/docker-setup.yml
ansible-playbook --diff $ANSIBLE_PLAYBOOKS_DIR/atuin-install.yml
cd $ROOT_REPO_DIR
./install
echo "If not enabled and you want to do passwordless sudo run this"
echo "ansible-playbook --ask-become-pass --diff ~/dotfiles/system/playbooks/passwordless-sudo.yml"
}
git_pull
vm_setup