Report this

What is the reason for this report?

How to update CoreOS cloud-config?

Posted on February 9, 2015

Once you’ve booted a new CoreOS host on Digital Ocean, how can you update the cloud-config?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@bgrayburn you can update ssh keys without doing anything crazy: https://github.com/coreos/init/blob/master/bin/update-ssh-keys

I have a script that I use to push them out across my fleet:

$ cat fleetctl-inject-ssh.sh
#!/bin/bash -x

# Usage:
#   cat public.key | fleetctl-inject-ssh.sh keyname

name=$1
if [ -z $name ]; then
  echo "Provide a name for the injected SSH key"
  exit 1
fi

shift 1

pubkey=$(cat)

for machine in $(fleetctl -strict-host-key-checking=false $@ list-machines --no-legend --full | awk '{ print $1;}'); do
  fleetctl  -strict-host-key-checking=false $@ ssh $machine "echo '${pubkey}' | update-ssh-keys -a $name -n"
done

so to run you could do something like:

echo 'THE_CONTENTS_OF_PUBKEY' |  ./fleetctl-inject-ssh.sh <SOME_INTELLIGENT_NAME_FOR_KEY>

or

cat <PUBKEY> | ./fleetctl-inject-ssh.sh <SOME_INTELLIGENT_NAME_FOR_KEY>

You can find the cloud-config in :

  • /var/lib/coreos-install/user_data for baremetal
  • /var/lib/coreos-vagrant/vagrant-user-data for vagrant

update it, reboot, if no error, the new configuration should be done. I don’t know if it’s the good way but it seems to work.

Has anyone able to update the user-data without using @Wallner solution?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.