Dies ist eine alte Version des Dokuments!


Puppet Check

Puppet Installation und Settings ueberpruefen. Als Administrator ausfuehren.

puppet-check.bat
@echo off
REM Puppet install und Fehlerkorrektur (Migration)
REM 20230826 https://wiki.kmu360.ch/ict/systeme/puppet/puppet-korrekt
 
SETLOCAL

REM check install
if exist "C:\Program Files\Puppet Labs\Puppet\VERSION" goto noinstall
 
echo install Puppet
echo.
 
echo Download...
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest http://downloads.puppetlabs.com/windows/puppet8/puppet-agent-x64-latest.msi -OutFile c:\windows\temp\puppet-agent-x64-latest.msi;}"
 
echo install...
msiexec /qn /norestart /i c:\windows\temp\puppet-agent-x64-latest.msi PUPPET_MASTER_SERVER=coma2.kmu360.ch

REM geh zum Ende
goto end
 
 
:noinstall

REM Ruby Umgebung einlesen
call "C:\Program Files\Puppet Labs\Puppet\bin\environment.bat" %0 %*

REM cmd fuer puppet
REM ruby -S -- puppet config print server
 
 
echo Test1: Frage nach Serveradresse
for /f %%i in ('ruby -S -- puppet config print server') do set PUPPETSRV=%%i
echo Serveradresse %PUPPETSRV%
if not %PUPPETSRV%==coma2.kmu360.ch goto run
 
 
echo.
echo Test2: Fehlermeldung CRL
ruby -S -- puppet ssl verify
if not %ERRORLEVEL%==0 goto run
 
 
echo.
echo Test3: Fehlermeldung Cert
ruby -S -- puppet ssl show > nul
if not %ERRORLEVEL%==0 goto run
 
 
echo.
echo Test4: Fehlermeldung Agent
ruby -S -- puppet agent -t > nul
if not %ERRORLEVEL%==0 goto run

 
 
REM abschliessend falls nichts erfuellt, Lauf ueberspringen
goto end
 
 
 
:run000
REM Dummy
echo.
echo starte Korrektur
ping -n 20 127.0.0.1 > nul
goto end
 
 
:run
REM Korrektur/Migration
echo.
echo starte Korrektur
ruby -S -- puppet config set runinterval 3600 --section main
 
echo.
echo warte 20sek, ev. ist andere Instanz aktiv...
echo.
ping -n 20 127.0.0.1 > nul
echo .
 
ruby -S -- puppet config set server coma2.kmu360.ch --section main
ruby -S -- puppet ssl clean --localca
ruby -S -- puppet ssl bootstrap --waitforcert=15
 
echo.
echo Testlauf...
echo.
ruby -S -- puppet agent -t
echo.
ping -n 5 127.0.0.1 > nul
 
echo Testlauf 2...
echo .
ruby -S -- puppet agent -t
 
 
goto end
 
 
:end
REM Ende warte ein paar sek
ping -n 5 127.0.0.1 > nul

howto/allgemein/23486fjrz55kli13456f/puppet-check.1693137510.txt.gz · Zuletzt geändert: 27.08.2023 13:58 von zingg