This commit is contained in:
parent
21c8019313
commit
4e2da675fb
|
@ -32,7 +32,7 @@ setup_ssh() {
|
||||||
# TODO: Make sure to replace the following address with http://metadata
|
# TODO: Make sure to replace the following address with http://metadata
|
||||||
# whenever we got http://metadata resolving to url work successfully.
|
# whenever we got http://metadata resolving to url work successfully.
|
||||||
|
|
||||||
metadata=$(curl -s http://metadata:5000)
|
metadata=$(curl -s http://metadata:9000)
|
||||||
|
|
||||||
echo "$metadata" | jq -r '.["ssh-key-list"] | .[]' > ssh-key-list.txt
|
echo "$metadata" | jq -r '.["ssh-key-list"] | .[]' > ssh-key-list.txt
|
||||||
while read ssh_key; do
|
while read ssh_key; do
|
||||||
|
@ -82,23 +82,30 @@ setup_dns() {
|
||||||
setup_etc_host() {
|
setup_etc_host() {
|
||||||
tput setaf 2; tput bold; echo "Setting up /etc/hosts"; tput sgr0;
|
tput setaf 2; tput bold; echo "Setting up /etc/hosts"; tput sgr0;
|
||||||
|
|
||||||
metadata=$(curl -s http://[2a0a:e5c1:144::]:5000)
|
|
||||||
host_list=$(echo "$metadata" | jq -r '.["host-list"]')
|
|
||||||
host_list_len=$(echo "$host_list" | jq -r '. | length')
|
|
||||||
|
|
||||||
cat > /etc/hosts << EOF
|
cat > /etc/hosts << EOF
|
||||||
127.0.0.1 localhost.my.domain localhost localhost.localdomain localhost
|
127.0.0.1 localhost.my.domain localhost localhost.localdomain localhost
|
||||||
::1 localhost localhost.localdomain
|
::1 localhost localhost.localdomain
|
||||||
|
|
||||||
$(
|
2a0a:e5c1:144:: metadata
|
||||||
for i in $(seq 0 $((host_list_len - 1)));
|
|
||||||
do
|
|
||||||
ip=$(echo $host_list | jq -r ".[$i][0]")
|
|
||||||
hostname=$(echo $host_list | jq -r ".[$i][1]")
|
|
||||||
printf "%-25s %s\n" $ip $hostname
|
|
||||||
done
|
|
||||||
)
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# metadata=$(curl -s http://[2a0a:e5c1:144::]:9000)
|
||||||
|
# host_list=$(echo "$metadata" | jq -r '.["host-list"]')
|
||||||
|
# host_list_len=$(echo "$host_list" | jq -r '. | length')
|
||||||
|
|
||||||
|
# cat > /etc/hosts <<EOF
|
||||||
|
# 127.0.0.1 localhost.my.domain localhost localhost.localdomain localhost
|
||||||
|
# ::1 localhost localhost.localdomain
|
||||||
|
|
||||||
|
# $(
|
||||||
|
# for i in $(seq 0 $((host_list_len - 1)));
|
||||||
|
# do
|
||||||
|
# ip=$(echo $host_list | jq -r ".[$i][0]")
|
||||||
|
# hostname=$(echo $host_list | jq -r ".[$i][1]")
|
||||||
|
# printf "%-25s %s\n" $ip $hostname
|
||||||
|
# done
|
||||||
|
# )
|
||||||
|
# EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,8 +120,8 @@ setup_dns
|
||||||
# Initial Package Installation
|
# Initial Package Installation
|
||||||
if [[ $(get_distro) = "alpine" ]]; then
|
if [[ $(get_distro) = "alpine" ]]; then
|
||||||
edge_package_flags='--update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted'
|
edge_package_flags='--update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted'
|
||||||
|
|
||||||
apk update -q
|
apk update -q
|
||||||
|
apk upgrade
|
||||||
apk add -q ndisc6 $edge_package_flags
|
apk add -q ndisc6 $edge_package_flags
|
||||||
apk add -q openssh-server sfdisk util-linux jq curl ncurses
|
apk add -q openssh-server sfdisk util-linux jq curl ncurses
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue