如何在Test Kitchen中使用我的自定义AMI和ec2驱动程序?

时间:2017-02-26 20:03:39

标签: chef test-kitchen

我不确定我缺少什么,但我的自定义CentOS AMI被测试ktichen忽略了。它不是旋转正确的AMI而是旋转Ubuntu AMI。这是我的kitchen.yml:

---
driver:
  name: ec2
  aws_ssh_key_id: chef
  security_group_ids: ["sg-b57021c0", "sg-fga04293"]
  subnet_id: subnet-58721c1d
  region: us-east-2
  require_chef_omnibus: true
  instance_type: t2.micro
  associate_public_ip: true


provisioner:
  name: chef_zero
  policyfile: Policyfile.rb

platforms:
  - name: import-ami-ffpxv46d
    image_id: ami-ffpxv46d
    transport:
      ssh_key: /user/ami.pem
      username: root

suites:
  - name: default
    provisioner:
      policyfile: Policyfile.rb

1 个答案:

答案 0 :(得分:2)

您必须将image_id置于驱动程序配置下,如下所示:

platforms:
  - name: import-ami-ffpxv46d
    driver:
      image_id: ami-ffpxv46d
    transport:
      ssh_key: /user/ami.pem
      username: root

否则TK将其视为实例配置的一部分。