mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Fixes Icinga Agent broken state before IMC install
This commit is contained in:
parent
d5b116240a
commit
251ff8d4e3
3 changed files with 12 additions and 11 deletions
|
|
@ -39,6 +39,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
||||||
* [#456](https://github.com/Icinga/icinga-powershell-framework/pull/456) Fixes JEA service error count not resetting itself after a certain amount of time without errors
|
* [#456](https://github.com/Icinga/icinga-powershell-framework/pull/456) Fixes JEA service error count not resetting itself after a certain amount of time without errors
|
||||||
* [#458](https://github.com/Icinga/icinga-powershell-framework/pull/458) Fixes `Install-IcingaSecurity` which should only run in an administrative shell
|
* [#458](https://github.com/Icinga/icinga-powershell-framework/pull/458) Fixes `Install-IcingaSecurity` which should only run in an administrative shell
|
||||||
* [#459](https://github.com/Icinga/icinga-powershell-framework/pull/459) Fixes `Update-Icinga` which was not working to downgrade snapshot packages pack to release (**NOTE:** It can still happen that migrations of the `Framework` might break your environment. Not recommended in production environments for the `Framework` component)
|
* [#459](https://github.com/Icinga/icinga-powershell-framework/pull/459) Fixes `Update-Icinga` which was not working to downgrade snapshot packages pack to release (**NOTE:** It can still happen that migrations of the `Framework` might break your environment. Not recommended in production environments for the `Framework` component)
|
||||||
|
* [#460](https://github.com/Icinga/icinga-powershell-framework/issues/460) Fixes Icinga Agent installation over IMC and Director Self-Service, in case the Self-Service is configured to not install the Icinga Agent or the user manually set `Do not install Icinga Agent` inside the IMC, which results in most configurations not being applied to the Agent, in case it is already installed
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -180,20 +180,15 @@ function Start-IcingaForWindowsInstallation()
|
||||||
if ($InstallAgent) {
|
if ($InstallAgent) {
|
||||||
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.AgentLocation' -Value $AgentInstallDir;
|
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.AgentLocation' -Value $AgentInstallDir;
|
||||||
Install-IcingaComponent -Name 'agent' -Version $AgentVersion -Confirm -Release;
|
Install-IcingaComponent -Name 'agent' -Version $AgentVersion -Confirm -Release;
|
||||||
|
|
||||||
# Only continue this, if our installation was successful
|
|
||||||
if ((Get-IcingaAgentInstallation).Installed) {
|
|
||||||
Reset-IcingaAgentConfigFile;
|
|
||||||
Move-IcingaAgentDefaultConfig;
|
|
||||||
Set-IcingaAgentNodeName -Hostname $Hostname;
|
|
||||||
Set-IcingaServiceUser -User $ServiceUser -Password (ConvertTo-IcingaSecureString $ServicePassword) -SetPermission | Out-Null;
|
|
||||||
Install-IcingaAgentBaseFeatures;
|
|
||||||
Write-IcingaAgentApiConfig -Port $IcingaPort;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Only continue this, if our installation was successful
|
# Only continue this, if our installation was successful
|
||||||
if ((Get-IcingaAgentInstallation).Installed) {
|
if ((Get-IcingaAgentInstallation).Installed) {
|
||||||
|
Set-IcingaAgentNodeName -Hostname $Hostname;
|
||||||
|
Set-IcingaServiceUser -User $ServiceUser -Password (ConvertTo-IcingaSecureString $ServicePassword) -SetPermission | Out-Null;
|
||||||
|
Install-IcingaAgentBaseFeatures;
|
||||||
|
Write-IcingaAgentApiConfig -Port $IcingaPort;
|
||||||
|
|
||||||
if ((Install-IcingaAgentCertificates -Hostname $Hostname -Endpoint $IcingaCAServer -Port $IcingaPort -CACert $CertificateCAFile -Ticket $CertificateTicket -Force:$ForceCertificateGen) -eq $FALSE) {
|
if ((Install-IcingaAgentCertificates -Hostname $Hostname -Endpoint $IcingaCAServer -Port $IcingaPort -CACert $CertificateCAFile -Ticket $CertificateTicket -Force:$ForceCertificateGen) -eq $FALSE) {
|
||||||
Disable-IcingaAgentFeature 'api';
|
Disable-IcingaAgentFeature 'api';
|
||||||
Write-IcingaConsoleWarning `
|
Write-IcingaConsoleWarning `
|
||||||
|
|
@ -239,7 +234,7 @@ function Start-IcingaForWindowsInstallation()
|
||||||
Write-IcingaFrameworkCodeCache;
|
Write-IcingaFrameworkCodeCache;
|
||||||
Test-IcingaAgent;
|
Test-IcingaAgent;
|
||||||
|
|
||||||
if ($InstallAgent) {
|
if ((Get-IcingaAgentInstallation).Installed) {
|
||||||
Restart-IcingaService 'icinga2';
|
Restart-IcingaService 'icinga2';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,8 @@ function Install-IcingaComponent()
|
||||||
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.ServiceUser' -Value $ServiceUser;
|
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.ServiceUser' -Value $ServiceUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set-IcingaPowerShellConfig -Path 'Framework.Icinga.AgentLocation' -Value $InstallTarget;
|
||||||
|
|
||||||
[string]$InstallFolderMsg = $InstallTarget;
|
[string]$InstallFolderMsg = $InstallTarget;
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($InstallTarget) -eq $FALSE) {
|
if ([string]::IsNullOrEmpty($InstallTarget) -eq $FALSE) {
|
||||||
|
|
@ -373,6 +375,9 @@ function Install-IcingaComponent()
|
||||||
return $FALSE;
|
return $FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reset-IcingaAgentConfigFile;
|
||||||
|
Move-IcingaAgentDefaultConfig;
|
||||||
|
|
||||||
Set-IcingaServiceUser -User $ServiceUser -SetPermission | Out-Null;
|
Set-IcingaServiceUser -User $ServiceUser -SetPermission | Out-Null;
|
||||||
Update-IcingaServiceUser;
|
Update-IcingaServiceUser;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue