-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_env.sh
More file actions
executable file
·82 lines (68 loc) · 2.85 KB
/
setup_env.sh
File metadata and controls
executable file
·82 lines (68 loc) · 2.85 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
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
#!/bin/bash
repo_path="$HOME/setup_automation"
vscode_settings="$repo_path/.vscode/settings.json"
# ubuntu22.04
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install sshpass -y
sudo apt-get install jq -y
sudo apt-get install python3-pip libssl-dev -y
sudo apt-get install python3.10-venv -y
# now reload the ~/.bashrc file
source ~/.bashrc
# vagrant
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update && sudo apt-get install vagrant -y
python3 -m venv ~/.venv/ansible_env/
source ~/.venv/ansible_env/bin/activate
# add to requirements.txt for pip
# required tools
pip install -r requirements.txt
# python3 -m pip install docker
# python3 -m pip install molecule ansible-core
# python3 -m pip install molecule ansible-lint
# python3 -m pip install "molecule-plugins[vagrant]"
# python3 -m pip install jmespath
# WSL2
# pre-rquirements ubuntu
# append those two lines into ~/.bashrc
echo 'export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"' >> ~/.bashrc
echo 'export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"' >> ~/.bashrc
wsl_config_file="/etc/wsl.conf"
config_content="[boot]
systemd=true
[automount]
options = \"metadata\""
printf "%s\n" "$config_content" > "$wsl_config_file"
vagrant plugin install virtualbox_WSL2
# vagrant plugin install vagrant-vbguest # disabled for now since it caused rhel VMs to crach on create
# vscode workspace settings:
mkdir -p "$repo_path/.vscode"
jq -n \
--arg interpreterPath "~/.venv/ansible_env/bin/python" \
--arg ansibleLintPath "~/.venv/ansible_env/bin/ansible-lint" \
--arg ansibleConfigPath "~/.venv/ansible_env/bin/ansible-config" \
'{
"ansible.python.interpreterPath": $interpreterPath,
"python.defaultInterpreterPath": $interpreterPath,
"ansible.validation.lint.path": $ansibleLintPath,
"ansible.ansible.path": $ansibleConfigPath,
"ansible.lightspeed.suggestions.enabled": true,
"ansible.lightspeed.enabled": true
}' > "$vscode_settings"
# vault pass word file
mkdir ~/Documents
cp /mnt/c/Users/helios/Pictures/molecule/vagrant ~/Documents/vagrant
code --version
code --install-extension redhat.ansible
code --install-extension ms-python.python
code --install-extension njpwerner.autodocstring
code --install-extension github.vscode-github-actions
code --install-extension github.vscode-pull-request-github
code --install-extension gruntfuggly.todo-tree
code --install-extension shinotatwu-ds.file-tree-generator
code --install-extension mhutchie.git-graph
code --install-extension eamodio.gitlens
code --install-extension ms-python.autopep8
code --install-extension ms-python.black-formatter
code