Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run recipe twice #99

Closed
sdarwin opened this issue Oct 27, 2015 · 1 comment
Closed

run recipe twice #99

sdarwin opened this issue Oct 27, 2015 · 1 comment

Comments

@sdarwin
Copy link

sdarwin commented Oct 27, 2015

A pattern that might be followed in a cookbook is:

node.default['users'] << 'exampleuser'
include_recipe 'user::data_bag'

However if a run_list includes multiple cookbooks (and it usually does) and more than one cookbook tries that pattern, it will fail. Because you can not include_recipe twice.

So, node.default['users'] = ['exampleuser', 'exampleuser2'] has to be set somewhere else, outside the cookbook as an extra step, such as on a role or node.

Or, have user_account directly:

In your_cookbook/recipes/default.rb

user_account 'hsolo' do
ssh_keygen true
end

Then the data is not in a data_bag, it must be directly in the cookbook.

It would be nice if user_account could load data from a data_bag, or if a new lwrp loaded a user_account from a databag. or you could include_recipe twice.

what is the easiest way to handle this case?

@sdarwin
Copy link
Author

sdarwin commented Jun 22, 2016

a generic solution, although not exactly the same as mentioned in this ticket, can be the standard opscode users cookbook, users_manage resource.

@sdarwin sdarwin closed this as completed Jun 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant