Template source from databag

Hello,

Is there any way to get template source not only from file in
cookbook, but from variable or databag item?


WBR realloc()

On Fri, Sep 2, 2011 at 7:01 AM, Stanislav Bogatyrev
realloc@realloc.spb.ruwrote:

Is there any way to get template source not only from file in
cookbook, but from variable or databag item?

You mean the actual template or the location of the template?

The actual template to be processed. I want to store pacamker policy
templates in databags.

2011/9/2 Brian Akins brian@akins.org:

On Fri, Sep 2, 2011 at 7:01 AM, Stanislav Bogatyrev realloc@realloc.spb.ru
wrote:

Is there any way to get template source not only from file in
cookbook, but from variable or databag item?

You mean the actual template or the location of the template?

--
WBR realloc()

On Sep 4, 2011, at 7:09 AM, Stanislav Bogatyrev wrote:

The actual template to be processed. I want to store pacamker policy
templates in databags.

You could write the template out from the data in the data bags and the use template with the local option to render it.

I generally just keep metadata in data bags and use recipe logic to figure out what to do. Using data bags in the way you said is doable, however.

Is this because you're going to be generating the templates
themselves? Why not store the templates in the cookbook?

Adam

On Sun, Sep 4, 2011 at 4:09 AM, Stanislav Bogatyrev
realloc@realloc.spb.ru wrote:

The actual template to be processed. I want to store pacamker policy
templates in databags.

2011/9/2 Brian Akins brian@akins.org:

On Fri, Sep 2, 2011 at 7:01 AM, Stanislav Bogatyrev realloc@realloc.spb.ru
wrote:

Is there any way to get template source not only from file in
cookbook, but from variable or databag item?

You mean the actual template or the location of the template?

--
WBR realloc()

--
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: adam@opscode.com

In case of storing each policy template for each cluster in cookbook
we get bloated recipe with lot of duplicated information in it. And
also we need to update the recipe each time the new cluster is added.
I want to have something reusable.
So I figured out how to get policy template on local disk. How to
point template resource to use it?
Thank You!

2011/9/5 Adam Jacob adam@opscode.com:

Is this because you're going to be generating the templates
themselves? Why not store the templates in the cookbook?

Adam

On Sun, Sep 4, 2011 at 4:09 AM, Stanislav Bogatyrev
realloc@realloc.spb.ru wrote:

The actual template to be processed. I want to store pacamker policy
templates in databags.

2011/9/2 Brian Akins brian@akins.org:

On Fri, Sep 2, 2011 at 7:01 AM, Stanislav Bogatyrev realloc@realloc.spb.ru
wrote:

Is there any way to get template source not only from file in
cookbook, but from variable or databag item?

You mean the actual template or the location of the template?

--
WBR realloc()

--
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: adam@opscode.com

--
WBR realloc()

Just point the "source" parameter to the local template.

template "/tmp/config.conf" do
local true
source "/tmp/config.conf.erb"
end

That's taken from the second example for the template resource on the wiki: http://wiki.opscode.com/display/chef/Resources#Resources-Template

Best,
Adam

--
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: adam@opscode.com

On Monday, September 5, 2011 at 10:49 PM, Stanislav Bogatyrev wrote:

In case of storing each policy template for each cluster in cookbook
we get bloated recipe with lot of duplicated information in it. And
also we need to update the recipe each time the new cluster is added.
I want to have something reusable.
So I figured out how to get policy template on local disk. How to
point template resource to use it?
Thank You!

2011/9/5 Adam Jacob <adam@opscode.com (mailto:adam@opscode.com)>:

Is this because you're going to be generating the templates
themselves? Why not store the templates in the cookbook?

Adam

On Sun, Sep 4, 2011 at 4:09 AM, Stanislav Bogatyrev
<realloc@realloc.spb.ru (mailto:realloc@realloc.spb.ru)> wrote:

The actual template to be processed. I want to store pacamker policy
templates in databags.

2011/9/2 Brian Akins <brian@akins.org (mailto:brian@akins.org)>:

On Fri, Sep 2, 2011 at 7:01 AM, Stanislav Bogatyrev <realloc@realloc.spb.ru (mailto:realloc@realloc.spb.ru)>
wrote:

Is there any way to get template source not only from file in
cookbook, but from variable or databag item?

You mean the actual template or the location of the template?

--
WBR realloc()

--
Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: adam@opscode.com (mailto:adam@opscode.com)

--
WBR realloc()