cookbook 'ssh-keys', '= 1.2.6'
ssh-keys (9) Versions 1.2.6 Follow32
Creates "authorized_keys" in user "~/.ssh" directory from a data bag (encrypted data bag supported)
cookbook 'ssh-keys', '= 1.2.6', :supermarket
knife supermarket install ssh-keys
knife supermarket download ssh-keys
Description
Creates authorized_keys
in user ~/.ssh
directory from a data bag.
Attributes
Expects node[:ssh_keys]
to be an hash containing the user name as key and data bag user name as value.
Also, users can be defined by groups (see usage examples below).
See attributes/default.rb
for additional attributes default values.
Usage
Node configuration example to create authorized_keys
for user root
from data bag user user1
:
{
"ssh_keys": {
"root": "user1"
},
"run_list": [
"recipe[ssh-keys]"
]
}
Node configuration example to create authorized_keys
for user root
from data bag user user1
and user2
:
{
"ssh_keys": {
"root": ["user1", "user2"]
},
"run_list": [
"recipe[ssh-keys]"
]
}
Node configuration example to create authorized_keys
for user root
from users of group admin
:
{
"ssh_keys": {
"root": {"groups": "admin"}
},
"run_list": [
"recipe[ssh-keys]"
]
}
Node configuration example to create authorized_keys
for user root
from data bag user user1
and user2
, and from users of groups admin
and operator
:
{
"ssh_keys": {
"root": {"users": ["user1", "user2"], "groups": ["admin", "operator"]}
},
"run_list": [
"recipe[ssh-keys]"
]
}
Use knife to create a data bag for users:
knife data bag create users
User data bag example (compatible with Chef users cookbook):
knife data bag users user1
{
"id": "user1",
"ssh_keys": "ssh-rsa AAAAB3Nz...yhCw== user1"
}
knife data bag users user2
{
"id": "user2",
"ssh_keys": "ssh-rsa AAAAB3Nz...5D8F== user2"
}
Cookbook URLs
- Chef Supermarket: https://supermarket.chef.io/cookbooks/ssh-keys
- GitHub: https://github.com/nickola/chef-ssh-keys
- Author: http://www.nickola.ru
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
Foodcritic Metric
1.2.6 failed this metric
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/attributes/default.rb:1
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/attributes/default.rb:2
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/attributes/default.rb:3
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/attributes/default.rb:4
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:1
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:2
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:26
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:47
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:53
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:66
FC003: Check whether you are running with chef server before using server-specific features: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:37
FC019: Access node attributes in a consistent manner: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:7
FC031: Cookbook without metadata file: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/metadata.rb:1
1.2.6 failed this metric
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/attributes/default.rb:2
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/attributes/default.rb:3
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/attributes/default.rb:4
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:1
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:2
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:26
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:47
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:53
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:66
FC003: Check whether you are running with chef server before using server-specific features: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:37
FC019: Access node attributes in a consistent manner: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/recipes/default.rb:7
FC031: Cookbook without metadata file: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/56f0038f7e6442cca0a3891f/ssh-keys/metadata.rb:1