2017-05-08 1 views
1

my-packer.jsonテンプレートで定義された変数をuser_data_fileのファイルに使用できますか?パッカーテンプレートの変数を使用できますか?user_data_file

私はuser_data_fileを使用してwimrmをセットアップし、管理者グループにユーザーを追加しています。 Webサーバーをインストールする前に。

ウェブpacker.jsonテンプレート

"builders": [ 
    { 
     "type": "amazon-ebs", 
     "vpc_id": "{{user `vpc_id`}}", 
     "subnet_id": "{{user `subnet_id`}}", 
     "associate_public_ip_address": true, 
     "access_key": "{{user `aws_access_key`}}", 
     "secret_key": "{{user `aws_secret_key`}}", 
     "region": "eu-west-1", 
     "source_ami": "ami-40003a26", 
     "instance_type": "c4.xlarge", 
     "ami_name": "cms-sitecore", 
     "communicator": "winrm", 
     "winrm_username": "{{user `winrm_username`}}", 
     "winrm_timeout": "30m", 
     "user_data_file": "./bootstrap-aws.ps1" 
    } 
    ], 
    "provisioners": [ 
    { 
     "type": "file", 
     "source": "./install/", 
     "destination": "C:/install" 
    }, 
    { 
     "type": "powershell", 
     "inline": [ 
     "Install-WindowsFeature -Name Web-Asp-Net45,Web-Static-Content,Web-Mgmt-Console,Web-Http-Errors,Web-Http-Logging,Web-Stat-Compression" 
     ] 
    } 
    ] 

答えて

1

の一部はありませんあなたがすることはできません。 user_data_fileはテンプレートではないため、補間されません。それにはuser_dataを使用するか、Packer外でuser_data_fileを前処理しなければなりません。

関連する問題