-
Notifications
You must be signed in to change notification settings - Fork 1
/
fabfile.py
80 lines (67 loc) · 2.47 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#from fabric.api import settings, run, env, hide, fastprint
from fabric.api import *
from fabric.contrib.files import exists
from nest import *
# There are two mane processes that we will need to perform.
#
# 1) create the cards for the SBC's with minimum pre-configuration
# 2) complete the insdtallation, swarm joining and etc of the final cluster
swarm_basename = 'nest'
swarm_masterhost = 'master'
swarm_workernode = 'worker'
swarm_storage = 'datastore'
swarm_net = '10.7.7.0'
swarm_address_start = 11
swarm_count = 5
image_src_url = 'https://oph.mdrjr.net/meveric/images/Jessie/Debian-Jessie-1.1.4-20171121-XU3+XU4.img.xz'
################################################
#### CARD CREATION FOR THE CLUSTER NODES
# Create a fresh OS image on an SD card for use as a generic node in a cluster
@task
def mksd():
get_image()
write_image()
return True
# Edit Network Interface files
@task
def edit_interfaces():
result = local(echo'''source-directory /etc/network/interfaces.d\nauto eth0\nallow-hotplug eth0\niface eth0 inet static\n\taddress %s.%s\n\tnetmask 255.255.255.0\n\tgateway %s.%s\n\tdns-nameservers 8.8.8.8''' > env.targetdevice/etc/network/interfaces)
return result
# /etc/network/interfaces
# --------
# #interfaces(5) file used by ifup(8) and ifdown(8)
# #Include files from /etc/network/interfaces.d:
#
# source-directory /etc/network/interfaces.d
#
# auto eth0
# allow-hotplug eth0
# iface eth0 inet static
# address %s.%s
# netmask 255.255.255.0
# gateway 172.16.28.1
# dns-nameservers 8.8.8.8
#
# /etc/resolv.conf
# --------
# domain lan
# search lan
# nameserver 8.8.8.8
################################################
#### CONFIGURE NODES
# ssh root@"xu4-ip-address"
# echo 'Acquire::http::Proxy "http://172.16.28.2:3142";' >> /etc/apt/apt.conf.d/00proxy
# apt update && apt-get upgrade && apt-get dist-upgrade
# dpkg-reconfigure tzdata
# curl -sSL https://get.docker.com | sh
# apt install axel build-essential git xz-utils whiptail unzip wget sudo ssh htop whowatch nano curl
# adduser odroid
# usermod -aG sudo odroid
# usermod -aG docker odroid
# reboot
#
# ssh odroid@"xu4-ip-address"
# sudo curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# sudo chmod +x /usr/local/bin/docker-compose
# sudo curl -L https://raw.githubusercontent.com/docker/compose/1.16.1/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
# sudo reboot