From 5a8ea57a1b663abd0bfdbc6e92ed6441e547e7c8 Mon Sep 17 00:00:00 2001 From: reyesj2 <94730068+reyesj2@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:31:14 -0600 Subject: [PATCH 1/2] move off of cmd.script with args \ https://github.com/saltstack/salt/issues/68298 --- salt/elasticfleet/install_agent_grid.sls | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/salt/elasticfleet/install_agent_grid.sls b/salt/elasticfleet/install_agent_grid.sls index 8b5bb4c3e..57164b74d 100644 --- a/salt/elasticfleet/install_agent_grid.sls +++ b/salt/elasticfleet/install_agent_grid.sls @@ -8,20 +8,28 @@ {% set AGENT_STATUS = salt['service.available']('elastic-agent') %} {% if not AGENT_STATUS %} +pull_agent_installer: + file.managed: + - name: /opt/so/so-elastic-agent_linux_amd64 + - source: salt://elasticfleet/files/so_agent-installers/so-elastic-agent_linux_amd64 + - mode: 755 + - makedirs: True + {% if grains.role not in ['so-heavynode'] %} run_installer: - cmd.script: - - name: salt://elasticfleet/files/so_agent-installers/so-elastic-agent_linux_amd64 + cmd.run: + - name: ./so-elastic-agent_linux_amd64 -token={{ GRIDNODETOKENGENERAL }} - cwd: /opt/so - - args: -token={{ GRIDNODETOKENGENERAL }} - retry: True {% else %} run_installer: - cmd.script: - - name: salt://elasticfleet/files/so_agent-installers/so-elastic-agent_linux_amd64 + cmd.run: + - name: ./so-elastic-agent_linux_amd64 -token={{ GRIDNODETOKENHEAVY }} - cwd: /opt/so - - args: -token={{ GRIDNODETOKENHEAVY }} - retry: True {% endif %} +cleanup_agent_installer: + file.absent: + - name: /opt/so/so-elastic-agent_linux_amd64 {% endif %} From ccb8ffd6eb2bba8926649460ad9fc0ed0dd473fa Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Mon, 3 Nov 2025 17:05:48 -0500 Subject: [PATCH 2/2] Update install_agent_grid.sls --- salt/elasticfleet/install_agent_grid.sls | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/salt/elasticfleet/install_agent_grid.sls b/salt/elasticfleet/install_agent_grid.sls index 57164b74d..4a185e0bb 100644 --- a/salt/elasticfleet/install_agent_grid.sls +++ b/salt/elasticfleet/install_agent_grid.sls @@ -2,8 +2,10 @@ # or more contributor license agreements. Licensed under the Elastic License 2.0; you may not use # this file except in compliance with the Elastic License 2.0. -{%- set GRIDNODETOKENGENERAL = salt['pillar.get']('global:fleet_grid_enrollment_token_general') -%} -{%- set GRIDNODETOKENHEAVY = salt['pillar.get']('global:fleet_grid_enrollment_token_heavy') -%} +{% set GRIDNODETOKEN = salt['pillar.get']('global:fleet_grid_enrollment_token_general') -%} +{% if grains.role == 'so-heavynode' %} +{% set GRIDNODETOKEN = salt['pillar.get']('global:fleet_grid_enrollment_token_heavy') -%} +{% endif %} {% set AGENT_STATUS = salt['service.available']('elastic-agent') %} {% if not AGENT_STATUS %} @@ -15,19 +17,13 @@ pull_agent_installer: - mode: 755 - makedirs: True -{% if grains.role not in ['so-heavynode'] %} run_installer: cmd.run: - - name: ./so-elastic-agent_linux_amd64 -token={{ GRIDNODETOKENGENERAL }} + - name: ./so-elastic-agent_linux_amd64 -token={{ GRIDNODETOKEN }} - cwd: /opt/so - - retry: True -{% else %} -run_installer: - cmd.run: - - name: ./so-elastic-agent_linux_amd64 -token={{ GRIDNODETOKENHEAVY }} - - cwd: /opt/so - - retry: True -{% endif %} + - retry: + attempts: 3 + interval: 20 cleanup_agent_installer: file.absent: