Enabling/Disabling Elastic agents remotely after they have been added to a fleet

We want to install the Elastic Agent on our OS image so all servers have the agent by default. We want to have these agents not report metrics by default but have the ability to turn them on remotely and report to the fleet once they are turned on. Is this possible with Fleet? It seems like variables and conditions might be a way to accomplish this. if I could have the input depend on an environment variable called ELASTIC_ENABLED, and then change the environment variable via ansible or some other automation tool.
Variables and conditions in input configurations | Fleet and Elastic Agent Guide [8.13] | Elastic

Would that work? Is there a better way to do this?

It looks like we can just install the agent with a policy that doesn't collect metrics and then we can either manually or via api move agents to a policy that does collect metrics. This looks like it will work well for our use case

1 Like