-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.ps1
38 lines (30 loc) · 978 Bytes
/
deploy.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
# Script for Windows to deploy wallEYE Pi side updates with absolutely minimal security
# Modify to match setup
$servers = @(
@{ Hostname = "10.27.67.11"; },
@{ Hostname = "10.27.67.12";},
@{ Hostname = "10.27.67.13"; },
)
foreach ($server in $servers) {
$hostname = $server.Hostname
$username = "strykeforce"
$directory = $server.Directory
$sshCommand = @"
cd $directory
git pull
echo StrykeForce | sudo -S systemctl restart walleye
"@
Write-Host "Updating $hostname..."
$sshSession = New-Object -TypeName System.Management.Automation.PSCustomObject -Property @{
Hostname = $hostname
Username = $username
Password = "StrykeForce"
}
$sshCommandLine = "ssh $username@$hostname '$sshCommand'"
cmd.exe /C "echo $passwordPlainText | ssh $username@$hostname $sshCommand"
if ($LASTEXITCODE -eq 0) {
Write-Host "Successful $hostname"
} else {
Write-Host "Failed $hostname"
}
}