在Amazon OpsWorks中使用ssh_authorized_keys外部食谱

时间:2016-07-01 10:06:52

标签: chef aws-opsworks

作为厨师新手,我很难将ssh_authorized_keys与Amazon OpsWorks一起使用。启动新实例时,我收到以下错误:

[2016-07-01T10:02:37+00:00] INFO: HTTP Request Returned 412 Precondition Failed: 
No such cookbook: ssh_authorized_keys

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: ssh_authorized_keys

Expanded Run List:
------------------
* chef-provisioning::default

我需要做些什么才能让它发挥作用?

我使用以下配置:

Berksfile

source 'https://supermarket.chef.io'
cookbook 'ssh_authorized_keys', '~> 0.3.0'

metadata.rb

name 'chef-provisioning'
maintainer 'abc'
maintainer_email 'alice@example.com'
license 'all_rights'
description 'Installs/Configures chef-provisioning'
long_description 'Installs/Configures chef-provisioning'
version '0.1.0'
depends 'ssh_authorized_keys'

1 个答案:

答案 0 :(得分:2)

关键是目录结构。 ssh_authorized_keys食谱必须与我们自己的食谱ops-works(包含普通收件人)在同一目录中。

$ tree -d
.
├── ops-works
│   ├── recipes
│   ├── spec
│   │   └── unit
│   │       └── recipes
│   └── test
│       └── integration
│           ├── default
│           │   └── serverspec
│           └── helpers
│               └── serverspec
└── ssh_authorized_keys
    ├── attributes
    ├── definitions
    ├── libraries
    └── templates
        └── default

<强> Berksfile

source 'https://supermarket.chef.io'
cookbook 'ssh_authorized_keys'

我建议使用berks vendor并查看 Failing To Find Chef Community Cookbooks Using Chef 12 On AWS Opsworks