このタスクを使用して、Packer を使用してマシン イメージを構築します。これは、Azure 仮想マシン スケール セットのデプロイに使用できます。
このバージョンのタスクは非推奨です。PackerBuild@1 を使用して、ワークロード ID フェデレーションなどの最新の機能を利用します。
注
このタスクでは、ワークフロー ID フェデレーション を使用した Azure Resource Manager 認証はサポートされていません。
このタスクを使用して、Packer を使用してマシン イメージを構築します。これは、Azure 仮想マシン スケール セットのデプロイに使用できます。
注
このタスクでは、ワークフロー ID フェデレーション を使用した Azure Resource Manager 認証はサポートされていません。
構文
# Build machine image v0
# Build a machine image using Packer, which may be used for Azure Virtual machine scale set deployment.
- task: PackerBuild@0
inputs:
templateType: 'builtin' # 'builtin' | 'custom'. Required. Packer template. Default: builtin.
#customTemplateLocation: # string. Required when templateType = custom. Packer template ___location.
#customTemplateParameters: '{}' # string. Optional. Use when templateType = custom. Template parameters. Default: {}.
# Azure Details
ConnectedServiceName: # string. Required when templateType = builtin. Azure subscription.
___location: # string. Required when templateType = builtin. Storage ___location.
storageAccountName: # string. Required when templateType = builtin. Storage account.
azureResourceGroup: # string. Required when templateType = builtin. Resource group.
# Deployment Inputs
baseImageSource: 'default' # 'default' | 'customVhd'. Required when templateType = builtin. Base image source. Default: default.
#baseImage: 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows' # 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2016-Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2012-Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2008-R2-SP1:windows' | 'Canonical:UbuntuServer:14.04.4-LTS:linux' | 'Canonical:UbuntuServer:16.04-LTS:linux' | 'RedHat:RHEL:7.2:linux' | 'RedHat:RHEL:6.8:linux' | 'OpenLogic:CentOS:7.2:linux' | 'OpenLogic:CentOS:6.8:linux' | 'credativ:Debian:8:linux' | 'credativ:Debian:7:linux' | 'SUSE:openSUSE-Leap:42.2:linux' | 'SUSE:SLES:12-SP2:linux' | 'SUSE:SLES:11-SP4:linux'. Required when baseImageSource = default && templateType = builtin. Base image. Default: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows.
#customImageUrl: # string. Required when baseImageSource = customVhd && templateType = builtin. Base image URL.
#customImageOSType: 'windows' # 'windows' | 'linux'. Required when baseImageSource = customVhd && templateType = builtin. Base image OS. Default: windows.
packagePath: # string. Required when templateType = builtin. Deployment Package.
deployScriptPath: # string. Required when templateType = builtin. Deployment script.
#deployScriptArguments: # string. Optional. Use when templateType = builtin. Deployment script arguments.
# Advanced
#additionalBuilderParameters: '{}' # string. Optional. Use when templateType = builtin. Additional Builder parameters. Default: {}.
#skipTempFileCleanupDuringVMDeprovision: true # boolean. Optional. Use when templateType = builtin. Skip temporary file cleanup during deprovision. Default: true.
# Output
#imageUri: # string. Image URL.
入力
templateType
-
Packer テンプレートの
string
。 必須。 使用できる値: builtin
(自動生成)、custom
(ユーザー指定)。 既定値: builtin
.
タスクで Packer テンプレートを自動生成するか、提供されたカスタム テンプレートを使用するかを指定します。
customTemplateLocation
-
Packer テンプレートの場所の
string
。
templateType = custom
する場合に必要です。
ユーザー指定のカスタム テンプレートへのパスを指定します。
customTemplateParameters
-
テンプレート パラメーターの
string
。 任意
templateType = custom
するときに使用します。 既定値: {}
.
カスタム テンプレートを構築するために Packer に渡されるパラメーターを指定します。 これは、カスタム テンプレートの variables
セクションにマップされます。 たとえば、テンプレートに drop-___location
という名前の変数がある場合は、drop-___location
名と使用する値を含むパラメーターをここに追加します。 値をリリース変数にリンクすることもできます。 グリッド内の追加のパラメーターを表示/編集するには、テキスト ボックスの横にある …
をクリックします。
Azure サブスクリプション を
string
。
templateType = builtin
する場合に必要です。
マシン イメージをベイクして格納するための Azure Resource Manager サブスクリプションを指定します。
___location
-
ストレージの場所の
string
。
templateType = builtin
する場合に必要です。
ビルドされたマシン イメージを格納する場所を指定します。 この場所は、イメージを構築するために一時的な VM を作成するためにも使用されます。
ストレージ アカウントの storageAccountName
-
string
。
templateType = builtin
する場合に必要です。
ビルドされたマシン イメージを格納するためのストレージ アカウントを指定します。 このストレージ アカウントは、選択した場所に事前に存在している必要があります。
azureResourceGroup
-
リソース グループの
string
。
templateType = builtin
する場合に必要です。
選択したストレージ アカウントを含む Azure リソース グループを指定します。
基本イメージ ソースの baseImageSource
-
string
。
templateType = builtin
する場合に必要です。 使用できる値: default
(ギャラリー)、customVhd
(カスタム)。 既定値: default
.
基本イメージのソースを指定します。 OS イメージのキュレーションされたギャラリーから選択するか、カスタム イメージの URL を指定できます。
基本イメージの baseImage
-
string
。
baseImageSource = default && templateType = builtin
する場合に必要です。 使用できる値: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows
(Windows 2012-R2-Datacenter)、MicrosoftWindowsServer:WindowsServer:2016-Datacenter:windows
(Windows 2016-Datacenter)、MicrosoftWindowsServer:WindowsServer:2012-Datacenter:windows
(Windows 2012-Datacenter)、MicrosoftWindowsServer:WindowsServer:2008-R2-SP1:windows
(Windows 2)R2-SP1)、Canonical:UbuntuServer:14.04.4-LTS:linux
(Ubuntu 14.04.4-LTS)、Canonical:UbuntuServer:16.04-LTS:linux
(Ubuntu 16.04-LTS)、RedHat:RHEL:7.2:linux
(RHEL) 7.2)、RedHat:RHEL:6.8:linux
(RHEL 6.8)、OpenLogic:CentOS:7.2:linux
(CentOS 7.2)、OpenLogic:CentOS:6.8:linux
(CentOS 6.8)、credativ:Debian:8:linux
(Debian 8)、credativ:Debian:7:linux
(Debian 7)、SUSE:openSUSE-Leap:42.2:linux
(openSUSE-Leap 42.2)、SUSE:SLES:12-SP2:linux
(SLES 12-SP2)、SUSE:SLES:11-SP4:linux
(SLES 11-SP4)。 既定値: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows
.
OS イメージのキュレーションされた一覧から選択します。 これは、マシン イメージをキャプチャする前に前提条件とアプリケーションをインストールするために使用されます。
customImageUrl
-
基本イメージの URL
string
。
baseImageSource = customVhd && templateType = builtin
する場合に必要です。
基本イメージの URL を指定します。 これは、マシン イメージをキャプチャする前に前提条件とアプリケーションをインストールするために使用されます。
基本イメージ OSの customImageOSType
-
string
。
baseImageSource = customVhd && templateType = builtin
する場合に必要です。 使用できる値: windows
、linux
。 既定値: windows
.
packagePath
-
展開パッケージの
string
。
templateType = builtin
する場合に必要です。
$(System.DefaultWorkingDirectory)
を基準とした配置パッケージ ディレクトリのパスを指定します。 ミニマッチ パターンをサポートします。 パスの例: FrontendWebApp/**/GalleryApp
.
deployScriptPath
-
デプロイ スクリプトの
string
。
templateType = builtin
する場合に必要です。
パッケージをデプロイする PowerShell スクリプト (Windows の場合) またはシェル スクリプト (Linux の場合) への相対パスを指定します。 このスクリプトは、上記で選択したパッケージ パスに含まれている必要があります。 ミニマッチ パターンをサポートします。 パスの例: deploy/**/scripts/windows/deploy.ps1
.
deployScriptArguments
-
Deployment スクリプトの引数
string
。 任意
templateType = builtin
するときに使用します。
デプロイ スクリプトに渡す引数を指定します。
追加のビルダー パラメーターを additionalBuilderParameters
- する
string
。 任意
templateType = builtin
するときに使用します。 既定値: {}
.
自動生成された Packer テンプレート モードでは、タスクは Azure ビルダーを使用して Packer テンプレートを作成します。 このビルダーは、マシン イメージを生成するために使用されます。 Azure ビルダーにキーを追加して、生成された Packer テンプレートをカスタマイズできます。 たとえば、CentOS 基本イメージを使用していて、sudo を実行するには tty が必要な場合に、ssh_tty=true
設定します。
グリッド内の追加のパラメーターを表示または編集するには、テキスト ボックスの横にある …
をクリックします。
skipTempFileCleanupDuringVMDeprovision
-
プロビジョニング解除中の一時ファイルのクリーンアップをスキップ
boolean
。 任意
templateType = builtin
するときに使用します。 既定値: true
.
VM のプロビジョニング解除中に、VM にアップロードされた一時ファイルのクリーンアップをスキップします。 詳細については、「Azure Virtual Machine Image Builders」を参照してください。
imageUri
-
イメージ URL
string
。
生成されたマシン イメージ URL を格納する出力変数の名前を指定します。
タスク コントロールのオプション
すべてのタスクには、タスク入力に加えて制御オプションがあります。 詳細については、「コントロール オプションと一般的なタスク プロパティを参照してください。
出力変数
なし。
注釈
このタスクを使用して、Packer を使用してマシン イメージをビルドします。 このイメージは、Azure 仮想マシン スケール セットのデプロイに使用できます。
注
詳細なログを有効にする場合は、Pipelines>>変数の編集に移動し、新しい変数 PACKER_LOG 追加し、その値を 1 に設定します。