Created
January 14, 2015 16:28
-
-
Save safanaj/2fd3be4db9914c37dbd1 to your computer and use it in GitHub Desktop.
a coreos weave network on libvirt-based VMs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
### splitting in files: | |
# user_data_0.yml | |
# user_data_1.yml | |
# user_data_2.yml | |
# user_data_common.yml | |
# # cat user_data_N.yml user_data_common.yml > ...../openstack/latest/user_data | |
# to build a configdrive | |
#################### host-specific section | |
### user_data_0.yml | |
# hostname: coreos0 | |
# coreos: | |
# etcd: | |
# name: coreos00 | |
# discovery: https://discovery.etcd.io/73ae7d6dd60679f819185b8a6efc390f | |
# addr: 192.168.122.135:4001 | |
# peer-addr: 192.168.122.135:7001 | |
### user_data_1.yml | |
# hostname: coreos1 | |
# coreos: | |
# etcd: | |
# name: coreos01 | |
# discovery: https://discovery.etcd.io/73ae7d6dd60679f819185b8a6efc390f | |
# addr: 192.168.122.30:4001 | |
# peer-addr: 192.168.122.30:7001 | |
# ### user_data_2.yml | |
# hostname: coreos2 | |
# coreos: | |
# etcd: | |
# name: coreos02 | |
# discovery: https://discovery.etcd.io/73ae7d6dd60679f819185b8a6efc390f | |
# addr: 192.168.122.40:4001 | |
# peer-addr: 192.168.122.40:7001 | |
######################## common section | |
### the ips still hard-coded, fix it and uncomment | |
#################### with hardcoded IP to test it on libvirt | |
# write_files: | |
# - path: /etc/weave.coreos0.env | |
# permissions: 0644 | |
# owner: root | |
# content: | | |
# ## /etc/weave.coreos0.env | |
# WEAVE_LAUNCH_ARGS="192.168.122.30 192.168.122.40" | |
# WEAVE_CONNECT_ARGS="\ | |
# 192.168.122.30 | |
# 192.168.122.40 | |
# " | |
# - path: /etc/weave.coreos1.env | |
# permissions: 0644 | |
# owner: root | |
# content: | | |
# ## /etc/weave.coreos1.env | |
# WEAVE_LAUNCH_ARGS="192.168.122.135 192.168.122.40" | |
# WEAVE_CONNECT_ARGS="\ | |
# 192.168.122.135 | |
# 192.168.122.40 | |
# " | |
# - path: /etc/weave.coreos2.env | |
# permissions: 0644 | |
# owner: root | |
# content: | | |
# ## /etc/weave.coreos2.env | |
# WEAVE_LAUNCH_ARGS="192.168.122.135 192.168.122.30" | |
# WEAVE_CONNECT_ARGS="\ | |
# 192.168.122.135 | |
# 192.168.122.30 | |
# " | |
#### fixit and uncoment | |
# ssh_authorized_keys: | |
# - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCdx4ejhTXTkTbD6cR4/iEH/b117IHrskFEpgsLTE6WDUuQ4FolvU9ve02jhm02K9ApxpWfaFX4nOSGyJspOyyvFfoBx2caISf1uRzim8ZbNTRb/QsziaNQ1Dbk9/krA1kLvA9nu7zzAz8ROIaEQ1g1X++sUE6aCzz3IXlDBf/sE7q/Ci9QTynkM3B+GmNKRreXU45kMykEzhbKrZzcxJQOouYLty95ZhnBEXCZNDNNT5XunuDcuTqjRy2ppcA6r2NAjALS3SSEmfU9WIu9UB1W65dLSJC6fYBwQvTA5OhmzmyPywiCBUUGu2FixB0FHPxzm6dnapTvA+GZkawQBK5l mbj@jbook | |
# - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDd+wup7IBzaKDX6ZtI2nXupxQjc0X17a6Ng0pGVEvOdO9qVZcTZFMiMLMFK1atnKotS/hqaEWTtBMqJlSctCDQuqdCApvayYDqpd5kQ261BZdtv6I74fZLbUAni5EQbD5ElcC1J6fZSYeoMCa+R91HaErPBIKboYjWTehG4q20TfFL18IaXVXHqNJ18s1QySoCWPGMahmrZDTOLo5H5l1SCAPp0K/MqfwH0YZ10thyxURRzVcMEDS152aGlKS58/OLiSPaJkylgtw9n5jKPBk+hVtQ9wXE30FRBzVq/AjL8bOYKgihzWTECx2iz44mqvdSPDrxgDKKClEoIgMO+gDr core@localhost | |
# - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDm2W/mRuNKKflrKbbp9wNuRzmAGntyDV4UrYhr9B5OkwTz+MiJgJmQqEQ2QfHLVvw2LbiOZke0X4vWhNMybXn0a/sgNuzufKTv6MaTVV49rkyhQ0y37GwzbNFDkq9XTUGfLvMLf+hMV3NnCYDlAGRdlHFVARC0VtyTtEVOGA0TsAr5iLwDZ5iPN+7xkUMRX+yaEREkfahVUmZP7223YBIZK+L8/MkfLtJ5434amFVBuoXsnKTZPWUCbzDlHL1af84RFerQVDCOq2uEHxnAfqGgO9bZ1p49Y3ey4VQ1xzqEmy8p4tg5PKmMTCy14+OMjkz/B8Ik9XVAKmLZbuSRFl9V core@localhost | |
# - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDm2W/mRuNKKflrKbbp9wNuRzmAGntyDV4UrYhr9B5OkwTz+MiJgJmQqEQ2QfHLVvw2LbiOZke0X4vWhNMybXn0a/sgNuzufKTv6MaTVV49rkyhQ0y37GwzbNFDkq9XTUGfLvMLf+hMV3NnCYDlAGRdlHFVARC0VtyTtEVOGA0TsAr5iLwDZ5iPN+7xkUMRX+yaEREkfahVUmZP7223YBIZK+L8/MkfLtJ5434amFVBuoXsnKTZPWUCbzDlHL1af84RFerQVDCOq2uEHxnAfqGgO9bZ1p49Y3ey4VQ1xzqEmy8p4tg5PKmMTCy14+OMjkz/B8Ik9XVAKmLZbuSRFl9V core@localhost | |
write_files: | |
# - path: /etc/pre-fetch-container-images.env | |
# permissions: 0644 | |
# owner: root | |
# content: | | |
# PRE_FETCH_CONTAINER_IMAGES="\ | |
# zettio/weave:latest \ | |
# zettio/weavedns:latest \ | |
# zettio/weavetools:latest \ | |
# " | |
- path: /etc/test.coreos0.env | |
permissions: 0644 | |
owner: root | |
content: | | |
## /etc/test.coreos0.env | |
PINGER_LOCAL="10.0.0.1/16" | |
PINGER_REMOTE="10.0.1.1" | |
GREATER_ADDRESS="10.0.10.1/16" | |
GREATER_MESSAGE="Hello from #0" | |
TEST_GREATER="\ | |
10.0.12.1 | |
10.0.11.1 | |
" | |
- path: /etc/test.coreos1.env | |
permissions: 0644 | |
owner: root | |
content: | | |
## /etc/test.coreos1.env | |
PINGER_LOCAL="10.0.1.1/16" | |
PINGER_REMOTE="10.0.2.1" | |
GREATER_ADDRESS="10.0.11.1/16" | |
GREATER_MESSAGE="Hello from #1" | |
TEST_GREATER="\ | |
10.0.10.1 | |
10.0.12.1 | |
" | |
- path: /etc/test.coreos2.env | |
permissions: 0644 | |
owner: root | |
content: | | |
## /etc/test.coreos2.env | |
PINGER_LOCAL="10.0.2.1/16" | |
PINGER_REMOTE="10.0.0.1" | |
GREATER_ADDRESS="10.0.12.1/16" | |
GREATER_MESSAGE="Hello from #2" | |
TEST_GREATER="\ | |
10.0.10.1 | |
10.0.11.1 | |
" | |
coreos: | |
units: | |
- name: etcd.service | |
command: start | |
- name: fleet.service | |
command: start | |
# - name: pre-fetch-container-images.service | |
# #command: start | |
# enable: true | |
# content: | | |
# [Unit] | |
# After=docker.service | |
# Requires=docker.service | |
# [Service] | |
# EnvironmentFile=/etc/pre-fetch-container-images.env | |
# Type=oneshot | |
# RemainAfterExit=yes | |
# ExecStart=/bin/sh -c 'for i in $PRE_FETCH_CONTAINER_IMAGES; do /usr/bin/docker pull $i; done' | |
- name: install-weave.service | |
command: start | |
enable: true | |
content: | | |
## /etc/systemd/system/install-weave.service | |
[Unit] | |
After=network-online.target | |
After=docker.service | |
#After=pre-fetch-container-images.service | |
Description=Install Weave | |
Documentation=http://zettio.github.io/weave/ | |
Requires=network-online.target | |
Requires=docker.service | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStartPre=/usr/bin/wget -N -P /opt/bin \ | |
https://raw.github.com/zettio/weave/master/weave | |
ExecStartPre=/usr/bin/chmod +x /opt/bin/weave | |
ExecStartPre=/usr/bin/docker pull zettio/weave:latest | |
ExecStart=/bin/echo Wave Installed | |
- name: install-busybox.service | |
command: start | |
enable: true | |
content: | | |
## /etc/systemd/system/install-busybox.service | |
[Unit] | |
After=network-online.target | |
After=docker.service | |
Description=Install BusyBox | |
Documentation=http://zettio.github.io/weave/ | |
Requires=network-online.target | |
Requires=docker.service | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStart=/usr/bin/docker pull busybox:latest | |
- name: 10-weave.network | |
runtime: false | |
content: | | |
[Match] | |
Type=bridge | |
Name=weave* | |
[Network] | |
- name: setup-weave.service | |
content: | | |
## /etc/systemd/system/setup-weave.service | |
[Unit] | |
After=install-weave.service | |
Description=Setup Weave Network | |
Documentation=http://zettio.github.io/weave/ | |
Requires=install-weave.service | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStart=/opt/bin/weave setup | |
- name: connect-weave.service | |
content: | | |
## /etc/systemd/system/setup-weave.service | |
[Unit] | |
After=weave.service | |
Description=Setup Weave Network | |
Documentation=http://zettio.github.io/weave/ | |
Requires=weave.service | |
[Service] | |
EnvironmentFile=/etc/weave.%H.env | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStart=/bin/sh -c 'for i in $WEAVE_CONNECT_ARGS; do /opt/bin/weave connect $i; done' | |
- name: weave.service | |
content: | | |
## /etc/systemd/system/weave.service | |
[Unit] | |
#After=setup-weave.service | |
Description=Weave Network | |
Documentation=http://zettio.github.io/weave/ | |
Requires=install-weave.service | |
[Service] | |
EnvironmentFile=/etc/weave.%H.env | |
ExecStartPre=/opt/bin/weave launch $WEAVE_LAUNCH_ARGS | |
ExecStart=/usr/bin/docker logs -f weave | |
SuccessExitStatus=2 | |
ExecStop=/opt/bin/weave stop | |
- name: pinger.service | |
command: start | |
enable: true | |
content: | | |
[Unit] | |
After=weave.service | |
After=connect-weave.service | |
After=install-busybox.service | |
Description=Weave Network Test Monitor | |
Documentation=http://zettio.github.io/weave/ | |
Requires=weave.service | |
Requires=connect-weave.service | |
Requires=install-busybox.service | |
[Service] | |
EnvironmentFile=/etc/test.%H.env | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStartPre=-/usr/bin/docker \ | |
create --name=pinger busybox:latest \ | |
ping $PINGER_REMOTE | |
ExecStart=/opt/bin/weave \ | |
start $PINGER_LOCAL pinger | |
- name: greater.service | |
command: start | |
enable: true | |
content: | | |
[Unit] | |
After=weave.service | |
After=connect-weave.service | |
After=install-busybox.service | |
Description=Weave Network Test Service | |
Documentation=http://zettio.github.io/weave/ | |
Requires=weave.service | |
Requires=connect-weave.service | |
Requires=install-busybox.service | |
[Service] | |
EnvironmentFile=/etc/test.%H.env | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStartPre=-/usr/bin/docker \ | |
create --name=greater busybox:latest \ | |
nc -ll -p 2000 0.0.0.0 -e /bin/echo $GREATER_MESSAGE | |
ExecStart=/opt/bin/weave \ | |
start $GREATER_ADDRESS greater | |
# - name: hello.service | |
# enable: true | |
# content: | | |
# [Unit] | |
# After=weave.service | |
# After=connect-weave.service | |
# After=install-busybox.service | |
# Description=My tester Service | |
# Requires=weave.service | |
# Requires=connect-weave.service | |
# Requires=install-busybox.service | |
# [Service] | |
# EnvironmentFile=/etc/test.%H.env | |
# TimeoutStartSec=0 | |
# ExecStartPre=-/usr/bin/docker kill hello | |
# ExecStartPre=-/usr/bin/docker rm hello | |
# ExecStartPre=-/usr/bin/docker create \ | |
# --name=hello busybox:latest \ | |
# /bin/sh -c "\ | |
# source /etc/test.`hostname`.env; \ | |
# while true; do echo $TEST_GREATER ; done | |
# " | |
# ExecStart=/opt/bin/weave start 10.0.111.111/16 hello | |
# ExecStop=/usr/bin/docker stop hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment