Skip to content

Instantly share code, notes, and snippets.

@groob
Last active January 20, 2016 17:26
Show Gist options
  • Save groob/bdd88ed21714b2b33910 to your computer and use it in GitHub Desktop.
Save groob/bdd88ed21714b2b33910 to your computer and use it in GitHub Desktop.
netboot on linux
#cloud-config
---
ssh_authorized_keys:
- ssh-rsa mysecretkey
hostname: coreos01
coreos:
etcd:
name: coreos01
#discovery: https://discovery.etcd.io/b37f862b7eb38b8703effc034b814019
addr: 192.168.1.72:4001
peer-addr: 192.168.1.72:7001
fleet:
public-ip: 192.168.1.72
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: docker-tcp.socket
command: start
enable: true
content: |
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
Service=docker.service
BindIPv6Only=both
[Install]
WantedBy=sockets.target
- name: static.network
command: start
enable: true
content: |
[Match]
Name=en*
[Network]
Address=192.168.1.72/24
Gateway=192.168.1.254
DNS=192.168.1.8
DNS=192.168.1.6
DNS=4.2.2.2
write_files:
- path: /etc/environment
content: |
COREOS_PUBLIC_IPV4=192.168.1.72
COREOS_PRIVATE_IPV4=192.168.1.72
[Unit]
Before=docker.service
Description = Mounts NAS share for Netboot Images
[Mount]
Restart=always
RestartSec=10
TimeoutStartSec=10m
What = nas.example.org:/nbi
Where = /mnt/nbi
Type = nfs
Options=nolock,proto=tcp,port=2049
[Install]
WantedBy = multi-user.target
[Unit]
Description=tftpd for bspdy
After=netboot-data.service
Requires=docker.service
[Service]
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill netboot-bsdp
ExecStartPre=-/usr/bin/docker rm -f netboot-bsdp
ExecStartPre=/usr/bin/docker pull macadmins/tftpd
ExecStart=/usr/bin/docker run --rm --name netboot-bsdp \
--volumes-from netboot-data -p 0.0.0.0:67:67/udp \
--entrypoint /usr/bin/env -e BSDPY_IP=${COREOS_PUBLIC_IPV4} \
bruienne/bsdpy:1.0 /usr/bin/env python /bsdpy/bsdpserver.py
ExecStop=-/usr/bin/docker stop netboot-bsdp
[Install]
WantedBy=multi-user.target
[Unit]
Description=Data Container Netboot Service
After=mnt-nbi.mount
Requires=mnt-nbi.mount
Requires=docker.service
[Service]
ConditionDirectoryNotEmpty=/mnt/nbi
RemainAfterExit=yes
ExecStartPre=/usr/bin/docker pull busybox
ExecStart=/bin/bash -c '/usr/bin/docker start -a netboot-data || /usr/bin/docker run \
--name netboot-data -v /mnt/nbi:/nbi \
busybox'
[Install]
WantedBy=multi-user.target
[Unit]
Description=Serve NBI image over HTTP
After=netboot-data.service
Requires=docker.service
[Service]
ExecStartPre=-/usr/bin/docker kill netboot-httpd
ExecStartPre=-/usr/bin/docker rm -f netboot-httpd
ExecStartPre=/usr/bin/docker pull macadmins/netboot-httpd
ExecStart=/usr/bin/docker run --rm --name netboot-httpd \
--volumes-from netboot-data -p 80:80 \
macadmins/netboot-httpd
ExecStop=-/usr/bin/docker stop netboot-httpd
[Install]
WantedBy=multi-user.target
[Unit]
Description=tftpd for bspdy
After=netboot-data.service
Requires=docker.service
[Service]
ExecStartPre=-/usr/bin/docker kill netboot-tftpd
ExecStartPre=-/usr/bin/docker rm -f netboot-tftpd
ExecStartPre=/usr/bin/docker pull macadmins/tftpd
ExecStart=/usr/bin/docker run --rm --name netboot-tftpd \
--volumes-from netboot-data -p 0.0.0.0:69:69/udp \
macadmins/tftpd /usr/sbin/in.tftpd --listen --foreground -vvvv \
--verbosity 10 --user user -r blksize /nbi
ExecStop=-/usr/bin/docker stop netboot-tftpd
[Install]
WantedBy=multi-user.target
#unit files
.
├── mnt-nbi.mount
├── netboot-bsdp.service
├── netboot-data.service
├── netboot-httpd.service
└── netboot-tftpd.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment