-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moving away from cloud-init for the moment because it seems slow and …
…isn't doing what I want...
- Loading branch information
Showing
2 changed files
with
36 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
FROM phusion/baseimage:latest | ||
MAINTAINER Mark Stillwell <[email protected]> | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
RUN apt-get update && \ | ||
apt-get -y install cloud-init && \ | ||
rm -rf /var/lib/apt/lists/* /var/cache/apt/* | ||
#ENV DEBIAN_FRONTEND noninteractive | ||
#RUN apt-get update && \ | ||
# apt-get -y install cloud-init && \ | ||
# rm -rf /var/lib/apt/lists/* /var/cache/apt/* | ||
|
||
RUN mkdir -p /etc/my_init.d && \ | ||
touch /etc/growroot-disabled && \ | ||
echo '#!/bin/sh\n/usr/bin/cloud-init init' > \ | ||
/etc/my_init.d/10-cloud-init && \ | ||
chmod 755 /etc/my_init.d/10-cloud-init | ||
#RUN mkdir -p /etc/my_init.d && \ | ||
# touch /etc/growroot-disabled && \ | ||
# echo '#!/bin/sh\n/usr/bin/cloud-init init' > \ | ||
# /etc/my_init.d/10-cloud-init && \ | ||
# chmod 755 /etc/my_init.d/10-cloud-init | ||
|
||
RUN mkdir -p /etc/my_init.d | ||
COPY setkey.sh /etc/my_init.d/10-setkey | ||
RUN chmod 755 /etc/my_init.d/10-setkey |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
ATTEMPTS=30 | ||
|
||
mkdir -p /root/.ssh | ||
chmod 700 /root/.ssh | ||
|
||
TMPFILE=$(mktemp) | ||
while [ ! -f /root/.ssh/authorized_keys ] && [ ${ATTEMPTS} -gt 0 ]; do | ||
ATTEMPTS=$((${ATTEMPTS}-1)) | ||
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key \ | ||
> ${TMPFILE} 2>/dev/null | ||
if [ \$? -eq 1 ]; then | ||
cat ${TMPFILE} >> /root/.ssh/authorized_keys | ||
chmod 0600 /root/.ssh/authorized_keys | ||
rm -f ${TMPFILE} | ||
echo "Successfully retrieved public key from instance metadata" | ||
echo "********************************************************" | ||
echo "AUTHORIZED KEYS" | ||
echo "********************************************************" | ||
cat /root/.ssh/authorized_keys | ||
echo "********************************************************" | ||
fi | ||
done |