-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.jsonnet
49 lines (45 loc) · 935 Bytes
/
config.jsonnet
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
local get_peer(servers) = [
{
address: server.address,
port: server.port,
name: server.name,
}
for server in servers
];
local get_config(servers, server) = {
device_name: 'ph0',
device_type: 'tun',
name: server.name,
subnet: server.subnet,
port: server.port,
servers: get_peer(servers),
ifup: |||
ip link set $INTERFACE up
ip address add %s dev $INTERFACE
ip link set dev $INTERFACE mtu 1400
||| % server.net,
ifdown: |||
ip address del $IP_ADDR_MASK dev $INTERFACE
ip link set $INTERFACE down
|||,
};
local servers = [
{
address: '192.168.56.3',
port: 5432,
name: 'node0',
net: '10.1.0.1/16',
subnet: '10.1.0.1/24',
},
{
address: '192.168.56.4',
port: 5432,
name: 'node1',
net: '10.1.1.1/16',
subnet: '10.1.1.1/24',
},
];
{
'node0.yaml': get_config(servers, servers[0]),
'node1.yaml': get_config(servers, servers[1]),
}