将 ssh_authorized_keys 外部说明书与 Amazon OpsWorks 结合使用

Use ssh_authorized_keys external cookbook with Amazon OpsWorks

作为一名 Chef 新手,我很难将 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'

关键是目录结构。 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 并查看