This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for name in $(gcloud compute instances list --format="value(name)") | |
do | |
temp_variable=$(gcloud compute instances list --format="value(name,zone)" | grep ${name}) | |
zone=$(echo $temp_variable | awk '{print $2}') | |
gcloud compute ssh ${name} --zone=${zone} --command="curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh" | |
gcloud compute ssh ${name} --zone=${zone} --command="sudo bash add-logging-agent-repo.sh --also-install --version=1.*.*" | |
gcloud compute ssh ${name} --zone=${zone} --command="sudo service google-fluentd restart" | |
echo "logging agent installed for ${name}" | |
done | |
echo "logging agent activated successfully" |