Trying to leave some Ruby inside a finished installed Chef template


#1

Have a rails database.yml installed via chef:

production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: <%= ENV[‘PROD_DB_USER’] %>
password: <%= ENV[‘PROD_DB_PASSWORD’] %>

I want to to look like this when it’s installed - but Chef is
rendering the ENV vars during the install.

I’d rather not have that done - just like to use the ENV variables the
whole time.

I’d really like chef to just install this - treat is as a text file
and just install. Is that possible?

Any tips? I’ve looked through the Chef and Erubis docs as well as done
lots of Googling.

Also posted here: https://gist.github.com/4496942


#2

If the entire thing is plain text use cookbook_file instead of template.

On Wednesday, January 9, 2013 at 1:40 PM, Darron Froese wrote:

Have a rails database.yml installed via chef:

production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: <%= ENV[‘PROD_DB_USER’] %>
password: <%= ENV[‘PROD_DB_PASSWORD’] %>

I want to to look like this when it’s installed - but Chef is
rendering the ENV vars during the install.

I’d rather not have that done - just like to use the ENV variables the
whole time.

I’d really like chef to just install this - treat is as a text file
and just install. Is that possible?

Any tips? I’ve looked through the Chef and Erubis docs as well as done
lots of Googling.

Also posted here: https://gist.github.com/4496942


#3

Perfect - I knew I was missing something - just couldn’t figure out what.

Thanks.

On Wed, Jan 9, 2013 at 2:42 PM, Daniel Condomitti daniel@condomitti.com wrote:

If the entire thing is plain text use cookbook_file instead of template.

On Wednesday, January 9, 2013 at 1:40 PM, Darron Froese wrote:

Have a rails database.yml installed via chef:

production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: <%= ENV[‘PROD_DB_USER’] %>
password: <%= ENV[‘PROD_DB_PASSWORD’] %>

I want to to look like this when it’s installed - but Chef is
rendering the ENV vars during the install.

I’d rather not have that done - just like to use the ENV variables the
whole time.

I’d really like chef to just install this - treat is as a text file
and just install. Is that possible?

Any tips? I’ve looked through the Chef and Erubis docs as well as done
lots of Googling.

Also posted here: https://gist.github.com/4496942