title: How to use variables in Chef/Ruby execute command?
body: <p>I'm creating a simple Chef cookbook that sets up vhosts on a VPS. I have this working in terms of creating the correct .conf files by passing the <code>domain</code> variable to a Chef/.erb template, but I'm also trying to do this too (simplified code example):</p>
  
  <pre><code>node[:domains].each do |domain|
      execute 'sudo mkdir -p /var/www/#{domain}/public_html'
  end
  </code></pre>
  
  <p>However, the variables aren't being output into the string, and the command is simply creating a folder called:</p>
  
  <pre><code>/var/www/#{domain}/public_html
  </code></pre>
  
  <p>So... is there an accepted way to use variables from a loop in a Chef execute command - or is it that my Ruby syntax is out of whack?</p>