From 40de01e8c422468f510e856296ba4c2a7568305f Mon Sep 17 00:00:00 2001 From: Josh Brower Date: Mon, 15 May 2023 15:56:21 -0400 Subject: [PATCH 1/3] Temp fix --- .../tools/sbin_jinja/so-elastic-agent-gen-installers | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers b/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers index 297f35a38..d8d4bad2c 100755 --- a/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers +++ b/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers @@ -10,10 +10,12 @@ . /usr/sbin/so-common +FLEETHOST="https://:{{ GLOBALS.manager_ip }}:8220" + for i in {1..30} do ENROLLMENTOKEN=$(curl -K /opt/so/conf/elasticsearch/curl.config -L "localhost:5601/api/fleet/enrollment_api_keys" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' | jq .list | jq -r -c '.[] | select(.policy_id | contains("endpoints")) | .api_key') - FLEETHOST=$(curl -K /opt/so/conf/elasticsearch/curl.config 'http://localhost:5601/api/fleet/fleet_server_hosts' | jq -r '.items[].host_urls[]' | paste -sd ',') + #FLEETHOST=$(curl -K /opt/so/conf/elasticsearch/curl.config 'http://localhost:5601/api/fleet/fleet_server_hosts' | jq -r '.items[].host_urls[]' | paste -sd ',') if [[ $FLEETHOST ]] && [[ $ENROLLMENTOKEN ]]; then break; else sleep 10; fi done if [[ -z $FLEETHOST ]] || [[ -z $ENROLLMENTOKEN ]]; then printf "\nFleet Host URL or Enrollment Token empty - exiting..." && exit; fi From 9f879164ecbe53b6367ca8691f6a1f35df0fa50c Mon Sep 17 00:00:00 2001 From: Josh Brower Date: Tue, 16 May 2023 06:45:17 -0400 Subject: [PATCH 2/3] Fix broken loop --- .../tools/sbin_jinja/so-elastic-agent-gen-installers | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers b/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers index d8d4bad2c..d4a7d3b21 100755 --- a/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers +++ b/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers @@ -49,7 +49,8 @@ done GOTARGETOS=( "linux" "windows" "darwin" "darwin/arm64" ) GOARCH="amd64" -printf "\n### Generating OS packages using the cleaned up tarballs"for GOOS in "${GOTARGETOS[@]}" +printf "\n### Generating OS packages using the cleaned up tarballs" +for GOOS in "${GOTARGETOS[@]}" do if [[ $GOOS == 'darwin/arm64' ]]; then GOOS="darwin" && GOARCH="arm64"; fi printf "\n\n### Generating $GOOS/$GOARCH Installer...\n" From 923de356e11e7b8ba3196cf7e31c10d6a37bb4a1 Mon Sep 17 00:00:00 2001 From: Josh Brower Date: Tue, 16 May 2023 08:06:31 -0400 Subject: [PATCH 3/3] Fix typos --- salt/elasticfleet/install_agent_grid.sls | 2 +- .../tools/sbin_jinja/so-elastic-agent-gen-installers | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/elasticfleet/install_agent_grid.sls b/salt/elasticfleet/install_agent_grid.sls index bacede812..00a74437e 100644 --- a/salt/elasticfleet/install_agent_grid.sls +++ b/salt/elasticfleet/install_agent_grid.sls @@ -9,7 +9,7 @@ run_installer: cmd.script: - - name: salt://elasticfleet/files/so_agent-installers/so-elastic-agent_linux + - name: salt://elasticfleet/files/so_agent-installers/so-elastic-agent_linux_amd64 - cwd: /opt/so - args: -token={{ GRIDNODETOKEN }} diff --git a/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers b/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers index d4a7d3b21..2dd92d21b 100755 --- a/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers +++ b/salt/elasticfleet/tools/sbin_jinja/so-elastic-agent-gen-installers @@ -10,7 +10,7 @@ . /usr/sbin/so-common -FLEETHOST="https://:{{ GLOBALS.manager_ip }}:8220" +FLEETHOST="https://{{ GLOBALS.manager_ip }}:8220" for i in {1..30} do