annotate master/bin/makeWorker.sh @ 3:be5de30147ab

just barely
author Henry S. Thompson <ht@markup.co.uk>
date Fri, 28 Sep 2018 12:29:29 +0000
parents
children 56d8823c68e0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
1 #!/usr/bin/bash
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
2 # Usage . makeWorker.sh name
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
3 # Source this to get the worker name set to its IP address
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
4 name=$1
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
5 ip=$(az vm list-ip-addresses -g cc -n $name|egrep -o '"ipAddress": ".*"' | cut -f 2 -d ' ' | tr -d \")
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
6 export $name=$ip
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
7 echo $name=$ip
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
8 ssh -o StrictHostKeyChecking=no $ip <cat /var/cc/workers/bin/setupTemplate.sh
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
9 sudo bash -c "cd ~cc/.ssh && tar -czf - authorized_keys id_rsa id_rsa.pub" | \
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
10 ssh $ip "sudo su -c 'cd ~/.ssh && tar -xzf -' cd"
be5de30147ab just barely
Henry S. Thompson <ht@markup.co.uk>
parents:
diff changeset
11