LoginSignup
0
0

More than 3 years have passed since last update.

VMware PowerCLI & GitHub を利用したLabスクリプトの保存について

Last updated at Posted at 2021-04-07

vSphereを使ったLab環境の構築について、VMware PowerCLIにてスクリプト化し、GitHubにあげる手順 を記載します。

VMware PowerCLIのインストール

前提)Windows PowerShell 5.1以降の環境でないと、VMware PowerCLIのオンラインインストールが失敗する為、必要に応じてPowerShellをUpgradeする ※参考手順

Install-Module -Name VMware.PowerCLI

※下記エラーが表示された場合は、こちらを実行 (インストールスクリプトのTLS1.2対応の必要性
image.png
image.png

PowerCLIの動作確認

  • セキュリティポリシーの確認&変更 (Unrestricted 又はRemoteSignedであることを確認 参照)
PS C:\Users\Administrator> Get-ExecutionPolicy
Unrestricted
PS C:\Users\Administrator> Get-PowerCLIVersion
PowerCLI Version
----------------
   VMware PowerCLI 12.2.0 build 17538434
---------------

PowerCLIスクリプトの作成&GitHubリポジトリに保存

  • 簡易なPowerCLIサンプルスクリプトを作成(Nest ESXi 6.7ホスト3台のデプロイ)
      ESXiのインストールは仮想アプライアンスを使用 ※参照
    image.png

  • こちらを参照して、GitHubにアカウントおよびリポジトリを作成

  • 作成したリポジトリに、PowerCLIスクリプトをアップロードする  
    ※参照:Git for Windowsの使用

$ git push origin master
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcmcore-tlsverify for more information.

  • スクリプトのUpload先のリポジトリはこちら:

参考リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0