Change the install script for Icinga for Windows

Remove the powershell module in Agents tab and change the install script for Icinga for windows.
This commit is contained in:
raviks789 2022-12-08 13:30:28 +01:00 committed by Thomas Gelf
parent 6b7bff80de
commit fb39b25602
2 changed files with 30 additions and 21 deletions

View File

@ -148,15 +148,34 @@ class AgentWizard
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;
@ -235,6 +254,8 @@ class AgentWizard
$ret .= implode(', ', $vals);
} elseif (is_int($value)) {
$ret .= $value;
} elseif (is_string($value) && $value[0] === '$') {
$ret .= $value;
} else {
$ret .= $this->renderPowershellString($value);
}

View File

@ -155,19 +155,6 @@ class SelfService
['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)
),
];
}
@ -264,6 +251,7 @@ class SelfService
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())
]);