added scripts to discover sailing-analytics-server instances and add secrets to them

This commit is contained in:
Axel Uhl committed 2023-12-29 18:20:24 +01:00
1 parent b4ae9d98ff
commit 12ce27f47c
2 files changed
+22

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
#echo "'${SECRETS_TO_ADD}'" >>'${SECRETS_PATH}'
# Copy stdin to SECRETS_TO_ADD
SECRETS_TO_ADD=$( cat )
SERVERS_PATH=/home/sailing/servers
SECRETS_PATH=/root/secrets
SECRETS_IN_APP_PATH=configuration/secrets
FIND_ANALYTICS_SERVERS_SCRIPT="$( dirname ${0} )/findSailingAnalyticsServers"
for IP in $( ${FIND_ANALYTICS_SERVERS_SCRIPT} ); do
echo "Handling server with IP ${IP} ..."
ssh root@$IP 'echo "Appending '${SECRETS_TO_ADD}' to '${SECRETS_PATH}'"
echo "'${SECRETS_TO_ADD}'" >>'${SECRETS_PATH}'
echo "Server directories:"
for i in $( ls '${SERVERS_PATH}' ); do
echo "Appending to '${SERVERS_PATH}'/${i}/'${SECRETS_IN_APP_PATH}'"
echo "'${SECRETS_TO_ADD}'" >>'${SERVERS_PATH}'/${i}/'${SECRETS_IN_APP_PATH}'
done'
done
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
aws ec2 describe-instances --filters Name=tag-key,Values=sailing-analytics-server | jq -r '.Reservations[].Instances[].NetworkInterfaces[].PrivateIpAddresses[].Association.PublicIp'