DevOps Automated Software Installations for Remote/Vendor Delivery Teams

Deeptesh Bhattacharya
3 min readAug 16, 2021

In today’s DevOps automation has become not only important but necessary to quickly enable your teams to be ready on a project. At times you need to setup multiple software's on the Developer machine to enable and setup the development environments. And the user will have to install a pre-defined set of installers to install everything one by one.

While this pandemic situation, you must be working with remote teams and work from home. So how do we quickly speed them up for installing all the required software. Some programming is required for sure.

While majority of the systems are Windows based systems and hence run on msi installers. That means all installers are required to be downloaded and then manually installed. And most of the times the installation of the software will be governed by the IT Team, means an IT guy has to be involved in order to install these with the admin rights.

Poof!! that’s too much time to enable a developer to be ready.

And what if some of these installers have different versions, then probably the teams will install different software's and install different versions and fail when releasing or building the final product.

Is there a way all of this can be automated while your inventory is not managed.

Definitely there is a way out. Using chocolatey we can install these software on demand. You can read my other article on How to enable On Demand Installations on Windows using MS PowerShell, Chocolatey, Git and Nexus. | by Deeptesh Bhattacharya | Jul, 2021 | Medium — here.

But how can we install chocolatey to manage everything, that has to be installed first.

Note: This is extensible to onPrem, VmWare, AWS and Azure.

Get-ExecutionPolicy

$chocoversion = ‘choco.exe — version’

if ($chocoversion -gt 0) {

Write-Host “Choco is already installed on the system.” -ForegroundColor Red

}

else {

Write-Host “choco is not installed” -ForegroundColor Blue

Write-Host “Installing Chocolatey”

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(‘https://community.chocolatey.org/install.ps1'))

Write-Host “Chocolatey is installed successfully.”

}

Write-Host “Setting up Chocolatey Repos” -ForegroundColor Green

#configure the list of sources which needs to be added.

function Get-Site {

$site = Read-Host “Choose a site code.

1. A for BGLR

2. B for Chennai

3. C for USA

4. D for All

Enter your choice ->”

Switch ($site) {

A { $Chosensite = “Bangalore” }

B { $Chosensite = “Noida” }

C { $Chosensite = “Indore” }

D { $Chosensite = “ALL” }

}

Write-host “Site chosen is $Chosensite”

#configure the sources which needs to be added for different repos.

if ($ChosenSite -eq “Bangalore”) {

Write-Host “Adding Repos for Bangalore”

choco source add — confirm — verbose -n=Bangalore -s=”http://localhost:8081/repository/nuget-bangalore/"

}

elseif ($ChosenSite -eq “Noida”) {

Write-Host “Adding Repos for Noida”

choco source add — confirm — verbose -n=Noida-s=”http://localhost:8081/repository/nuget-noida/"

}

elseif ($ChosenSite -eq “Indore”) {

Write-Host “Adding Repos for Indore”

choco source add — confirm — verbose -n=Indore-s=”http://localhost:8081/repository/nuget-indore/"

}

elseif ($ChosenSite -eq “ALL”) {

Write-Host “Adding Repos for ALL”

Write-host “Reverifying chosen is $Chosensite”

choco source add — confirm — verbose -n=Bangalore -s=”http://localhost:8081/repository/nuget-bangalore/"

choco source add — confirm — verbose -n=Chennai -s=”http://localhost:8081/repository/nuget-chennai/"

choco source add — confirm — verbose -n=indore-s=”http://localhost:8081/repository/nuget-indore/"

}

Write-Host “Following Source Repos are now configured on your system.”

choco sources

Write-Host “To View the List of available Packages run

choco list -s Bangalore — all

To Install a package from the list run

choco install <name of the package> -s <sourcerepo>

eg.

choco install myapp -s=Bangalore

}

Get-Site

When you execute this PowerShell script this will install chocolatey and configure the private repos for use from where the dev, qa and other required members can download and install the required software's.

If you like the overall use case do not forget to like and share. Your feedback and comments are equally important to keep me motivated for finding out different business problems and their solutions.

--

--

Deeptesh Bhattacharya

A DevOps practitioner looking for Sponsored Visa Opportunities in Europe.