-
Notifications
You must be signed in to change notification settings - Fork 24
/
install_devops_tools.ps1
132 lines (123 loc) · 4.91 KB
/
install_devops_tools.ps1
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
123
124
125
126
127
128
129
130
131
132
# Welcome Message
Clear-Host
Write-Host "############################################################################" -ForegroundColor Green
Write-Host "# #" -ForegroundColor Green
Write-Host "# DevOps Tool Installer/Uninstaller by ProDevOpsGuy Tech #" -ForegroundColor Green
Write-Host "# #" -ForegroundColor Green
Write-Host "############################################################################" -ForegroundColor Green
Write-Host ""
Write-Host "Automate the installation and uninstallation of essential DevOps tools on your Windows machine."
Write-Host "Choose from a wide range of tools and get started quickly and easily."
Write-Host ""
Write-Host "Tools available for installation/uninstallation:"
Write-Host " - Docker 🐳"
Write-Host " - Kubernetes (kubectl) ☸️"
Write-Host " - Ansible 📜"
Write-Host " - Terraform 🌍"
Write-Host " - Jenkins 🏗️"
Write-Host " - AWS CLI ☁️"
Write-Host " - Azure CLI ☁️"
Write-Host " - Google Cloud SDK ☁️"
Write-Host " - Helm ⛵"
Write-Host " - Prometheus 📈"
Write-Host " - Grafana 📊"
Write-Host " - GitLab Runner 🏃♂️"
Write-Host " - HashiCorp Vault 🔐"
Write-Host " - HashiCorp Consul 🌐"
Write-Host " - Minikube ☸️"
Write-Host " - Istio 📦"
Write-Host " - OpenShift CLI ☸️"
Write-Host " - Packer 📦"
Write-Host " - Vagrant 📦"
Write-Host ""
# Generic function to install tools using Chocolatey
function Install-Tool {
param (
[string]$tool
)
try {
choco install $tool -y
Write-Host "$tool installed successfully." -ForegroundColor Green
} catch {
$errorMessage = $_.Exception.Message
Write-Host "Failed to install ${tool}: ${errorMessage}" -ForegroundColor Red
}
}
# Generic function to uninstall tools using Chocolatey
function Uninstall-Tool {
param (
[string]$tool
)
try {
choco uninstall $tool -y
Write-Host "$tool uninstalled successfully." -ForegroundColor Green
} catch {
$errorMessage = $_.Exception.Message
Write-Host "Failed to uninstall ${tool}: ${errorMessage}" -ForegroundColor Red
}
}
# Function to display the main menu and handle user input
function Main-Menu {
Write-Host "Choose an action:"
Write-Host "1. Install a tool"
Write-Host "2. Uninstall a tool"
Write-Host "3. Exit"
$action_choice = Read-Host "Enter your choice"
if ($action_choice -eq 1 -or $action_choice -eq 2) {
Write-Host "Select a tool:"
$tools = @(
"Docker", "Kubernetes (kubectl)", "Ansible", "Terraform", "Jenkins",
"AWS CLI", "Azure CLI", "Google Cloud SDK", "Helm", "Prometheus",
"Grafana", "GitLab Runner", "HashiCorp Vault", "HashiCorp Consul",
"Minikube", "Istio", "OpenShift CLI", "Packer", "Vagrant"
)
for ($i = 0; $i -lt $tools.Count; $i++) {
Write-Host "$($i + 1). $($tools[$i])"
}
$tool_choice = [int](Read-Host "Enter the number corresponding to the tool")
if ($tool_choice -ge 1 -and $tool_choice -le $tools.Count) {
$selected_tool = $tools[$tool_choice - 1]
# Map tool names to Chocolatey package names
$toolMap = @{
"Docker" = "docker-desktop"
"Kubernetes (kubectl)" = "kubernetes-cli"
"Ansible" = "ansible"
"Terraform" = "terraform"
"Jenkins" = "jenkins"
"AWS CLI" = "awscli"
"Azure CLI" = "azure-cli"
"Google Cloud SDK" = "google-cloud-sdk"
"Helm" = "kubernetes-helm"
"Prometheus" = "prometheus"
"Grafana" = "grafana"
"GitLab Runner" = "gitlab-runner"
"HashiCorp Vault" = "vault"
"HashiCorp Consul" = "consul"
"Minikube" = "minikube"
"Istio" = "istio"
"OpenShift CLI" = "openshift-cli"
"Packer" = "packer"
"Vagrant" = "vagrant"
}
if ($toolMap.ContainsKey($selected_tool)) {
$packageName = $toolMap[$selected_tool]
if ($action_choice -eq 1) {
Install-Tool -tool $packageName
} else {
Uninstall-Tool -tool $packageName
}
} else {
Write-Host "Invalid tool selection. Exiting." -ForegroundColor Red
}
} else {
Write-Host "Invalid input. Please enter a valid number." -ForegroundColor Red
}
} elseif ($action_choice -eq 3) {
Write-Host "Exiting. Goodbye!" -ForegroundColor Yellow
exit
} else {
Write-Host "Invalid action choice. Exiting." -ForegroundColor Red
}
}
# Run the main menu
Main-Menu