Don't curl metadata server in userdata example

The metadata server is switched off in
I45ae6d0e3726cc71c7dc35a9a47da8b7a0bab9cb, so this example has been
updated to use os-apply-config to fetch the ssh key instead.

Change-Id: I82b05f9b35ffc6ea2cee9a64d5702c0404cd47de
This commit is contained in:
Steve Baker 2017-07-26 10:14:30 +12:00
parent 8071beda51
commit 05f773006a

View File

@ -42,10 +42,9 @@ resources:
str_replace:
template: |
#!/bin/bash
curl http://169.254.169.254/openstack/2012-08-10/meta_data.json -o /root/meta_data.json
mkdir -p /home/$user/.ssh
chmod 700 /home/$user/.ssh
cat /root/meta_data.json | jq -r ".keys[0].data" > /home/$user/.ssh/authorized_keys
os-apply-config --key public-keys.0.openssh-key --type raw > /home/$user/.ssh/authorized_keys
chmod 600 /home/$user/.ssh/authorized_keys
chown -R $user:$user /home/$user/.ssh
params: