Page 1 of 1

External variables to a package

Published: November 29, 2018 - 09:57
by Dani
Hello everyone :-)

I'm currently evaluating WAPT to replace a custom-built solution (based on WPKG). First off, kudos to the developers, WAPT is incredibly well-designed!

I do have a small challenge, on which I am still thinking about the best solution (so I am including everyone in this discussion because I think it is a problem that can impact other people).

The challenge is: how to use variables within a package without hardcoding their values ​​into the package itself. Let me explain with an example:

I have several sites to manage, each with its own network range. Each site has a Zabbix proxy for monitoring site elements. Now, I want to create a package to deploy the Zabbix agent. Except that
  • For each site, I need to specify the IP address of the proxy that will be able to query the agent (and open the port in the firewall for that IP address)
  • I would prefer not to have to maintain a separate package for each site
Therefore, I would need to be able to create a generic "zabbixagent" package that uses a variable from elsewhere in the setup.

Ideally (meaning: a small NFR) ;-) It would be necessary to be able to define key=value pairs in group or host type packages that could override variables of the same name in a package; this would allow for a very simple approach :-)

But from what I've read, that's not possible yet. So I'm looking for another way.

I thought about creating a variables-site1 package that would drop a JSON file onto the machines containing site-specific values, and other packages could then read this JSON file to populate their variables. However, I have a timing issue: this variables-siteXXX package absolutely must be deployed first. And I can't make it a dependency of my zabbixagent package because the name will be different for each site.

Therefore, my only remaining option is to manually install the variables-siteXXX package on each machine, at the same time as installing the agent

Does anyone have a better idea? What solution do you use for this problem, which must be quite common?

Note: I'm currently evaluating WAPT, so I'm using the community version. It's possible the enterprise version adds features for this, but I haven't seen anything in the documentation that comes close...

Note 2: I hesitated between the Packages section and the Usage section; you can move this message if you deem it necessary :-)