Skip to content

Instantly share code, notes, and snippets.

@Meroje
Last active January 20, 2016 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Meroje/ff4fb867e52abfe54055 to your computer and use it in GitHub Desktop.
Save Meroje/ff4fb867e52abfe54055 to your computer and use it in GitHub Desktop.
Coreos ipxe provision
#!/bin/bash
wget -O cloud-config.yaml http://10.10.20.1/cloud-config.php
coreos-install -d /dev/vda -c cloud-config.yaml
reboot
<?php $private_ipv4 = $_SERVER['REMOTE_ADDR'] ?>
#cloud-config
hostname: "<?= md5(microtime(true)) ?>"
coreos:
update:
reboot-strategy: best-effort
units:
- name: etcd2.service
command: start
- name: fleet.service
command: start
- name: flanneld.service
drop-ins:
- name: 50-network-config.conf
content: |
[Service]
ExecStartPre=/usr/bin/etcdctl set /coreos.com/network/config '{ "Network": "10.1.0.0/16" }'
command: start
etcd2:
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
# specify the initial size of your cluster with ?size=X
discovery: https://discovery.etcd.io/...
advertise-client-urls: http://<?= $private_ipv4 ?>:2379,http://<?= $private_ipv4 ?>:4001
initial-advertise-peer-urls: http://<?= $private_ipv4 ?>:2380
listen-client-urls: http://<?= $private_ipv4 ?>:2379,http://<?= $private_ipv4 ?>:4001,http://127.0.0.1:2379,http://127.0.0.1:4001
listen-peer-urls: http://<?= $private_ipv4 ?>:2380,http://127.0.0.1:2380
flannel:
interface: "<?= $private_ipv4 ?>"
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1...
#!ipxe
set base-url http://stable.release.core-os.net/amd64-usr/current
kernel ${base-url}/coreos_production_pxe.vmlinuz rootfstype=btrfs coreos.autologin cloud-config-url=http://10.10.20.1/cloud-config-bootstrap.sh
initrd ${base-url}/coreos_production_pxe_image.cpio.gz
boot
# Only relevant parts shown
dhcp-range=set:vlan20,10.10.20.10,10.10.20.200,255.255.255.0,30m
enable-tftp
tftp-root=/var/ftpd
tftp-secure
dhcp-boot=net:vlan20,coreos.ipxe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment