title: Salt: text file to variable and use the same variable in state file to find&replace
body: <p>I've run into an issue I havent been able to solve:
  I have a file(/etc/osci) that I use on all of my servers as an name for our monitoring(zabbix) 
  I've created a state file that pushes a template configuration file to the server and and reads the content of /etc/osci to a variable. The next step would be to use that same variable with 'file.replace' function to search for a string and replace it with the variable. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>uusnimi=$(cat /etc/osci):
   cmd.run
  
  /etc/zabbix_agentd.conf:
   file.managed:
    - source: salt://base/streamingconf/zabbix/zabbix_agentd.conf
    - mode: 644
  
  
  change_hostname_zabbix:
   file.replace:
    - name: /etc/zabbix_agentd.conf
    - pattern: 'Hostname='
    - repl: 'Hostname=$uusnimi'</code></pre>
  </div>
  </div>
  </p>
  
  <p>Now when executing the state file echoing the variable in the target server it provides me the right output:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>echo $uusnimi
  Server1</code></pre>
  </div>
  </div>
  </p>
  
  <p>but for the life of me I can't figure out how to escape the last line of the above code so it would insert the value not the '$uusnimi' string</p>