<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Pretty much all of the CM tools can handle connecting to a
database and using it as a backend for variable expansion. Puppet
can use <a moz-do-not-send="true"
href="https://forge.puppet.com/crayfishx/hiera_mysql">hiera-mysql</a>
or <a moz-do-not-send="true"
href="https://github.com/Telmo/hiera-mysql-backend">hiera-mysql-backend</a>
or <a moz-do-not-send="true"
href="https://forge.puppet.com/nvitaterna/hiera_mysql2">hiera-mysql2</a>
for examples.</p>
<p>-spp<br>
</p>
<div class="moz-cite-prefix">On 9/23/2019 1:08 PM, Jeff Frontz
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAGvwsD=_siDdkoLBqVZRLVAOjJ2=TxFbPg=StKbHeHXkqDL+Rg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">Oooh, salt can query sqlite3 (and mysql)
natively: <a
href="https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.sqlite3.html"
moz-do-not-send="true">https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.sqlite3.html</a></div>
<div>Does that do what I think it does (namely, return info in a
tuple and allow iteration internally)?</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Sep 23, 2019 at 12:55
PM Jeff Frontz <<a href="mailto:jeff.frontz@gmail.com"
moz-do-not-send="true">jeff.frontz@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>[I'm skipping the delivery/enforcement stuff since
that's being solved in Other Ways; I'm focused on the
data population problem.]</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Sep 23, 2019
at 12:12 PM Rick Hornsby <<a
href="mailto:richardjhornsby@gmail.com"
target="_blank" moz-do-not-send="true">richardjhornsby@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div
style="font-family:Helvetica,Arial;font-size:13px"><br>
</div>
<p>On September 23, 2019 at 9:20:16 AM, Jeff Frontz
(<a href="mailto:jeff.frontz@gmail.com"
target="_blank" moz-do-not-send="true">jeff.frontz@gmail.com</a>)
wrote:</p>
<div>
<blockquote type="cite"
style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span>
<div>
<div dir="ltr">I have a need to generate
configuration files for a bunch of
different (some open-source, some
semi-proprietary) applications that run on
a bunch of different systems. </div>
</div>
</span></blockquote>
</div>
<p>For configuration files, (this is just one way to
do it) I can create a template file that looks
like the final config format - be that JSON, TOML,
yaml, whatever. I put placeholders (variable)
where I want to dynamically set a value. Then in
the Chef/Puppet code, I say something like</p>
<p><span style="white-space:pre-wrap">        </span>template
‘/opt/someapp/config/urmom.json’<br>
<span style="white-space:pre-wrap">                </span>source
‘template_source.json.erb'<br>
<span style="white-space:pre-wrap">                </span>variables(
pancakes: ‘yes’ )</p>
<p><br>
</p>
</blockquote>
<div><br>
</div>
OK, so the problem space is more like<br>
<br>
template
'/CI/src/***SPECIFIC-NODE-NAME***/BFT.json'<br>
source `BFT-template.json`<br>
variables(iterator:serviceTuple:
'select peerID, service-identifier-node, service
identifier-port from mondo-table where node !=
***SPECIFIC-NODE-NAME***')<br>
<br>
where BFT-template.json might be something like
(please pardon my JSON ignorance):<br>
<br>
...yada yada yada...</div>
<div class="gmail_quote"> CommonItems {</div>
<div class="gmail_quote">
"lotsa":"stuff",</div>
<div class="gmail_quote"> },</div>
<div class="gmail_quote"> PeerItems {<br>
[foreach:serviceTuple]</div>
<div class="gmail_quote"> {</div>
<div class="gmail_quote">
"peerName":"**peerID**",</div>
<div class="gmail_quote">
"peerNode":"**service-identifier-node**",<br>
"peerPort":"**peer-service-1-field**",</div>
<div class="gmail_quote"> },</div>
<div class="gmail_quote"> [endfor]</div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote"> ... yada yada
yada...</div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote">Do any of these tools/solutions
support complex operations like "run a select from a
table and iterate over the results to add/populate
fields to the template"?</div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote"><br>
<div> <br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div>
<blockquote type="cite">
<div dir="ltr">I need to configure the
applications on the other hosts to use the
each of the destination hosts' services.</div>
</blockquote>
<p>One thing you may be looking for is service
discovery.</p>
</div>
</blockquote>
<div> For more Reasons, it needs to be
deterministic/stable at config distribution time
(and beyond) so having peers advertise (and be
dynamically discovered) isn't in the cards.</div>
<br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</body>
</html>