打包程序脚本错误 必须指定脚本文件或内联脚本



我的打包程序脚本给出错误

  {
"variables":
{
"aws_access_key": "",
"aws_secret_key": "",
"revision": "0",
"ansible_host":""
},
"builders":[{
    "type": "amazon-ebs",
    "access_key": "{{user `aws_access_key`}}",
    "secret_key": "{{user `aws_secret_key`}}",
    "region": "us-east-2",
    "instance_type": "t2.micro",
    "source_ami": "ami-09e1c6dd3bd60cf2e",
    "source_ami_filter": {
        "filters": {
          "virtualization-type": "hvm",
          "name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*",
          "root-device-type": "ebs"
  }},
    "ssh_username": "ubuntu",
    "ami_name":"honebackend {{ isotime | clean_ami_name }}"
}],
"provisioners":[
    {
    "type":"shell",
    "script":"scripts/ssh_agent.sh"
    },
    {
    "type": "shell",
    "execute_command": "mkdir /var/apps"
    },
    {
    "type":"ansible",
    "extra_arguments": [ "-vvv --extra-vars 'ansible_host={{user `host`}} ../ansible/hosts.ini ansible_python_interpreter=/usr/bin/python3"],
    "inventory_file": "../ansible/hosts.ini",
    "playbook_file":"../ansible/nodejs.yml"
    }
]

}

运行以下命令后:

  packer build -debug -var 'aws_access_key=XXXXXXXXXXXXXXXXXXXXXXX' -var
    'aws_secret_key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'      packer.json

实际结果为: 调试模式已启用。生成不会并行化。 亚马逊EBS输出将采用此颜色。

1 error(s) occurred:
* Either a script file or inline script must be specified.

我在这里做错了什么?

正如错误所说:

{
  "type": "shell",
  "execute_command": "mkdir /var/apps"
 },

真的应该是:

{
  "type": "shell",
  "inline": "mkdir /var/apps"
 },

相关内容

  • 没有找到相关文章

最新更新