0

Cheers,

I have the situation that I want to apply a service to a host, but only for hosts that a certain service (with certain variables).

So essentially something like:

apply service "foo" {
  foreach service on host {
    assign where service.name = match(bar) and service.vars.baz = true
  }
}

So if I had services bar one with vars.baz=true, bar two with vars.baz=false and bar three with baz=true, I'd get two services, one each for bar one and bar three.

As I just noticed, I'd probably also need some way to get a unique service name derived from the conditional services.

Is it folly to go for it like this or should I just use variables for the host and derive all services from those?

towo
  • 1,887
  • 14
  • 12
  • You want to apply a service to a host that already has a certain service present? Your post is unfortunately fairly unclear in what you actually want achieved. – mzhaase Dec 01 '16 at 15:34
  • That's why I included the pseudocode, I thought that made it clear. Essentially: yes. One for each service matching some conditions. – towo Dec 01 '16 at 17:32
  • Is there a reason you are not just applying the service via the same template you are deploying the other server and variable with? – mzhaase Dec 02 '16 at 08:52

0 Answers0