To suggest a slight modification to what Kevin said, you could use a node attribute in a wrapper cookbook to set the variable being passed.
In cookbook1 attributes/default.rb set a default value:
default['cookbook1']['buffersize'] = 65536 # including the cookbook name helps isolate the namespace and avoid collisions.
In your cookbook1::has_a_template recipe:
template 'mytemplate' do
:buffersize => node['cookbook1']['buffersize']
Then, if you wish to set a different value for that template you can easily do so with the node attribute - in another cookbook, in a role, environment, on individual nodes. I personally suggest the wrapper cookbook method because it will be versioned and (hopefully) live in your version control. In larger environments I find that the other methods lead to “who set this node attribute”, “why did they set it” and “Why is there one value on the environment and another in this role, and a third on the server”?