This is an authorized repost of http://blog.daniellobato.me/coreos-cluster-deployments-with-foreman
As Major Hayden mentioned more than a year ago, deploying CoreOS is a bit of a different beast than deploying other operating systems. In this case, we are going to do it by PXE booting the image, then applying a cloud-config script which will will set the SSH keys, core user password, CoreOS version, and register in etcd. We are going to pass parameters that will set these options. That way we can define a host group, with certain parameters, such as the authorized keys, etcd discovery url, and virtual disk. This will simplify booting hosts in our deployment so that creating a new CoreOS node in the cluster will be reduced to three clicks, New Host -> Hostgroup: CoreOS cluster > Submit. As in my previous tutorial for unattended Atomic deployments, I will assume you have Foreman installed, and a PXE Smart Proxy in the network (or networks) you want to launch your cluster. If not, please go to theforeman.org and get a default installation. In my opinion, Libvirt is the easiest way to get this PXE “enabled” network. The PXE templates are already in community-templates , make sure to add the snippet too. You can create them manually by going to Hosts > Provisioning Templates > New template. However, it is much easier to install the foreman_templates plugin, then run:
foreman-rake templates:sync
And you’ll get all of the templates in the community-templates repository. Create a new operating system with the following options, in this case it will use CoreOS 647.0.0 from the stable channel.
Time to create the host group. Go to Configure > Host groups > New
host group, and create a group with the following parameters. The
network must be the one you can PXE boot on, and you can add a parameter
ssh_authorized_keys, value should be your public ssh key, usually
located in .ssh/id_rsa.pub. I did not add it here as I have a global
parameter ssh_authorized_keys with that value. Get a discovery code
by going to discovery.etcd.io/new , and
put the value you got in etcd_discovery_url.
That should be enough for the group. Now create a new host in that
cluster, and as soon as it boots, it will connect to etcd. Remember the
URL we used for discovery? Go to that URL and you should see all hosts
that have registered in the cluster.
Enjoy it, and please point out any mistakes on the comments section, or
let me know on Twitter.