From a8e218a9ff33237afa055f27ecc6f5974f30f740 Mon Sep 17 00:00:00 2001 From: reyesj2 <94730068+reyesj2@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:37:06 -0600 Subject: [PATCH] reinstall agent on grid nodes when service wasn't cleanly removed. eg. manually deleting /opt/Elastic/Agent/ --- salt/elasticfleet/install_agent_grid.sls | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/salt/elasticfleet/install_agent_grid.sls b/salt/elasticfleet/install_agent_grid.sls index 4a185e0bb..f891c8b86 100644 --- a/salt/elasticfleet/install_agent_grid.sls +++ b/salt/elasticfleet/install_agent_grid.sls @@ -8,7 +8,9 @@ {% endif %} {% set AGENT_STATUS = salt['service.available']('elastic-agent') %} -{% if not AGENT_STATUS %} +{% set AGENT_RC = salt['cmd.retcode']('elastic-agent status', ignore_retcode=True) %} + +{% if not AGENT_STATUS or AGENT_RC == 127 %} pull_agent_installer: file.managed: @@ -19,7 +21,7 @@ pull_agent_installer: run_installer: cmd.run: - - name: ./so-elastic-agent_linux_amd64 -token={{ GRIDNODETOKEN }} + - name: ./so-elastic-agent_linux_amd64 -token={{ GRIDNODETOKEN }} -force - cwd: /opt/so - retry: attempts: 3