Until fat booting is fixed in RancherOS, this is my semi-persistent setup:
/openstack/latest/user_data on rancheros.iso (labeled config-2):
#!/bin/sh
mkdir -p /home/rancher/conf
mount -t ext4 /dev/disk/by-label/conf /home/rancher/conf
chmod 7700 /home/rancher/conf
touch /home/rancher/conf/cloud-config.yml
chmod 7600 /home/rancher/conf/cloud-config.yml
touch /home/rancher/conf/rc.local
chmod 7700 /home/rancher/conf/rc.local
touch /etc/rc.local
mount -o bind /home/rancher/conf/rc.local /etc/rc.local
mkdir -p /var/lib/rancher/state
mount -o bind /home/rancher/conf/state /var/lib/rancher/state
ros config merge < /home/rancher/conf/cloud-config.yml
ros service restart network-pre
/bin/sh -c "ros service create && ros service start" &
/home/rancher/conf/cloud-config.yml on conf disk:
#cloud-config
hostname: rancherhost1
rancher:
network:
dns:
nameservers:
- <Add nameserver ip!>
search:
- <Add search address!>
interfaces:
eth0:
address: <Add host ip or remove!>
gateway: <Add gateway or remove!>
dhcp: <Set false or true!>
mtu: <Set mtu or remove!>
services:
rancher-agent1:
command: http://<rancher-server:port>/v1/scripts<Add keys!>
image: rancher/agent:latest
environment:
- CATTLE_HOST_LABELS=<Add label key!>=<Add label value!>&<Add label key!>=<Add label value!>&...
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ssh:
keys:
<Add keys here!>
/home/rancher/conf/rc.local on conf disk:
#!/bin/sh
echo 'rancher:<Add password!>' | chpasswd
wait-for-docker
Observe that /home/rancher/conf/state must contain .docker_uuid, .physical_host_uuid and .registration_token. Copy those three files from a temporary, running rancher agent. Comments and improvements are welcome.