Search code examples
chef-infrachef-solo

Add authorize keys for users via chef


I'm trying to add authorized keys for my deploy using chef but I'm getting a no method error.

error

[2016-01-25T21:24:01+00:00] ERROR: No resource or method named `user_ssh_keys_key' for `Chef::Recipe "user"'

user.rb

user_ssh_keys_key 'deploy' do
  authorized_keys node['ssh_public_keys']
  authorized_users %w(deploy)
end

berksfile

cookbook 'user-ssh-keys', '~> 1.0.2'

attributes/default.rb

default['ssh_public_keys'] = ['...','...']

Solution

  • Can you please check you've added the dependency to the user-ssh-keys cookbook in your metadata.rb ?

    It should look like this:

    depends 'user-ssh-keys', '~> 1.0.2'