Note that there are some explanatory texts on larger screens.

plurals
  1. POSalt-stack: replace/add minion name to file in managed file formula
    primarykey
    data
    text
    <p>I am using <a href="http://newrelic.com/" rel="nofollow">New Relic</a> to monitor my Salt managed EC2 servers, and I am trying to insert a "hostname=minion-name" in the newrelic-sysmond confic file, so they show up in New Relic's dashboard with a reconizable name, instead of the EC2 default "ip-123-133...".</p> <p>I spin my instances with salt-cloud and then apply the following state (trough the top file) to get New Relic sysmond running:</p> <pre><code>newrelic-repo: pkg: - installed - require: - pkgrepo: &lt;my private repo defined elsewhere, just convenient rpm storage&gt; newrelic-sysmond: pkg: - installed - require: - pkg: newrelic-repo service: - running - watch: - file: /etc/newrelic/nrsysmond.cfg /etc/newrelic/nrsysmond.cfg: file.managed: - source: salt://newrelic/nrsysmond.cfg - user: newrelic - mode: 744 - require: - pkg: newrelic-sysmond </code></pre> <p>The crux is: <code>/etc/newrelic/nrsysmond.cfg</code> managed file is a version with my personal account key, required by New Relic setup, so it is the same for all my machines.</p> <p>Is there a way for me have something like <code>hostname=my_placeholder</code> in that file and then in my sls config have it so that when the state is applied that <code>my_placeholder</code> becomes the minion name? </p> <p>Digging trough the states.file doc (<a href="http://docs.saltstack.com/ref/states/all/salt.states.file.html" rel="nofollow">http://docs.saltstack.com/ref/states/all/salt.states.file.html</a>) I get the feeling it is possible, but I am missing some foundational knowledge to figure it out, as I am just getting started with salt. Mainly I think I just need a nudge in a way as to how to reference the variable/grain holding the minion name, and an example of defaults/contexts in use.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload