Skip to content

Commit

Permalink
Change the install script for Icinga for Windows
Browse files Browse the repository at this point in the history
Remove the powershell module in Agents tab and change the install script for Icinga for windows.
  • Loading branch information
raviks789 authored and Thomas-Gelf committed Jul 20, 2023
1 parent 6b7bff8 commit fb39b25
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
37 changes: 29 additions & 8 deletions library/Director/IcingaConfig/AgentWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,34 @@ public function renderWindowsInstaller()

public function renderIcinga4WindowsWizardCommand($token)
{
$script = "Use-Icinga;\n"
. 'Start-IcingaAgentInstallWizard `' . "\n "
$ifwParams = [
"IfW-DirectorSelfServiceKey" => [
"Values" => [$token],
],
"IfW-DirectorUrl" => [
"Values" => [$this->getDirectorUrl()],
],
"IfW-StableRepository" => [
"Values" => ["https://packages.icinga.com/IcingaForWindows/stable"],
]
];

$script = "[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls11';\n"
. "\$ProgressPreference = 'SilentlyContinue';" . "\n"
. "[string]\$ScriptFile = 'C:\Users\Public\IcingaForWindows.ps1';\n"
. "\n"
. "Invoke-WebRequest `\n "
. $this->renderPowershellParameters([
'DirectorUrl' => $this->getDirectorUrl(),
'SelfServiceAPIKey' => $token,
'UseDirectorSelfService' => 1,
'OverrideDirectorVars' => 0,
'Reconfigure',
'RunInstaller'
'UseBasicParsing',
'Uri' => "https://packages.icinga.com/IcingaForWindows/IcingaForWindows.ps1",
'OutFile' => '$ScriptFile;',
]) . "\n"
. "\n"
. "& \$ScriptFile `\n "
. $this->renderPowershellParameters([
'ModuleDirectory' => "C:\Program Files\WindowsPowerShell\Modules\\",
'InstallCommand' => json_encode($ifwParams, JSON_UNESCAPED_SLASHES),
'IcingaRepository' => "https://packages.icinga.com/IcingaForWindows/stable/ifw.repo.json"
]);

return $script;
Expand Down Expand Up @@ -235,6 +254,8 @@ protected function renderPowershellParameter($key, $value, $maxKeyLength = null)
$ret .= implode(', ', $vals);
} elseif (is_int($value)) {
$ret .= $value;
} elseif (is_string($value) && $value[0] === '$') {
$ret .= $value;
} else {
$ret .= $this->renderPowershellString($value);
}
Expand Down
14 changes: 1 addition & 13 deletions library/Director/Web/SelfService.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,6 @@ protected function getWindowsInstructions($host, $key)
['class' => 'logfile'],
$wizard->renderIcinga4WindowsWizardCommand($key)
),
Html::tag('h3', $this->translate('Icinga 2 Powershell Module')),
Html::tag('p', Html::sprintf(
$this->translate('In case you\'re using the legacy %s, please run:'),
Html::tag('a', [
'href' => 'https://github.com/Icinga/icinga2-powershell-module',
'target' => '_blank',
], $this->translate('Icinga 2 Powershell Module'))
)),
Html::tag(
'pre',
['class' => 'logfile'],
$wizard->renderPowershellModuleInstaller($key)
),
];
}

Expand Down Expand Up @@ -264,6 +251,7 @@ protected function showLegacyAgentInstructions(ControlsAndContent $cc)
null,
['class' => 'icon-download', 'target' => '_blank']
),

Html::tag('p', null, $this->translate('Just download and run this script on your Linux Client Machine:')),
Html::tag('pre', $class, $wizard->renderLinuxInstaller())
]);
Expand Down

0 comments on commit fb39b25

Please sign in to comment.