Skip to content

Instantly share code, notes, and snippets.

@cheeseplus
Created March 19, 2015 03:44
Show Gist options
  • Save cheeseplus/75bda2428cc949cc5509 to your computer and use it in GitHub Desktop.
Save cheeseplus/75bda2428cc949cc5509 to your computer and use it in GitHub Desktop.
k,v template.erb
<% node['cookbook']['attribute'].each do |key, value| -%>
<% unless value.empty? -%>
<%= key %>=<%= value %>
<% end %>
<% end %>
@dairennlombard
Copy link

In template form:

<% @logins.each do |user, pass| -%>
<%= user %>:<%= pass %>
<% end -%>

@dairennlombard
Copy link

From a data_bag like this:

{
"id": "all_users",
"user_key1": {
"user": "person1",
"pass": "example1"
},
"user_key2": {
"user": "person2",
"pass": "example2"
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment