From the course: Learning Chef

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Templates and embedded Ruby

Templates and embedded Ruby

From the course: Learning Chef

Start my 1-month free trial

Templates and embedded Ruby

- [Instructor] In the last section we updated the Apache Cookbook's server recipe with information about the IP address and host name of this node. We added that information to the server recipe in the file resource. So remember what we did here. We used string interpolation to insert the node attributes for IP address and host name. Now if you're thinking ahead at all this might bother you. For example, I'm pasting all of the content for an HTML page inside of that string, what happens whenever I have a real web application that's very large? Am I going to paste the entire HTML code into that content string? That would be very impractical in the long-run. However, I can't just go through and use a static HTML file here. Do you see why I couldn't just copy an HTML file into that directory? I'm inserting those node attributes for IP address and host name into the index.html page. If I have a static HTML page, how am I going to insert those node attributes into it? What we actually need…

Contents