Manage multiple ssh-keys for one user with Chef

chefprovisioningssh-keys

I started to use Chef in my infrastructure, but cannot make recipe like this:

-each developer has own public ssh-key.

-in remote server there is an unique user, named ubuntu

I want to use data bags with users, like data_bags/users/jeff.json, data_bags/users/aaron.json, etc.

Create user ubuntu and keys from these users need to upload to ubuntu(authorized_keys) in the remote system, and delete from there if I deleted it from data_bags/users.

Are the standard cookbook users permit this? I'll be grateful if you provide an example or as any help.

Best Answer

The standard users cookbook manages keys of each user, with no option to look-up keys from other users in the data bag. You can use the "search" API in chef to gather all keys from data bag users and append these to your user of choice. See example in the standard users cookbook.

Related Topic