1{ lib } :
2
3with lib;
4{
5 options = {
6
7 interface = mkOption {
8 type = types.str;
9 description = ''
10 Interface for inside_network, bound by vrrp.
11 '';
12 };
13
14 state = mkOption {
15 type = types.enum [ "MASTER" "BACKUP" ];
16 default = "BACKUP";
17 description = ''
18 Initial state. As soon as the other machine(s) come up, an election will
19 be held and the machine with the highest "priority" will become MASTER.
20 So the entry here doesn't matter a whole lot.
21 '';
22 };
23
24 virtualRouterId = mkOption {
25 type = types.int;
26 description = ''
27 Arbitrary unique number 0..255. Used to differentiate multiple instances
28 of vrrpd running on the same NIC (and hence same socket).
29 '';
30 };
31
32 priority = mkOption {
33 type = types.int;
34 default = 100;
35 description = ''
36 For electing MASTER, highest priority wins. To be MASTER, make 50 more
37 than other machines.
38 '';
39 };
40
41 noPreempt = mkOption {
42 type = types.bool;
43 default = false;
44 description = ''
45 VRRP will normally preempt a lower priority machine when a higher
46 priority machine comes online. "nopreempt" allows the lower priority
47 machine to maintain the master role, even when a higher priority machine
48 comes back online. NOTE: For this to work, the initial state of this
49 entry must be BACKUP.
50 '';
51 };
52
53 useVmac = mkOption {
54 type = types.bool;
55 default = false;
56 description = ''
57 Use VRRP Virtual MAC.
58 '';
59 };
60
61 vmacInterface = mkOption {
62 type = types.nullOr types.str;
63 default = null;
64 description = ''
65 Name of the vmac interface to use. keepalived will come up with a name
66 if you don't specify one.
67 '';
68 };
69
70 vmacXmitBase = mkOption {
71 type = types.bool;
72 default = false;
73 description = ''
74 Send/Recv VRRP messages from base interface instead of VMAC interface.
75 '';
76 };
77
78 unicastSrcIp = mkOption {
79 type = types.nullOr types.str;
80 default = null;
81 description = ''
82 Default IP for binding vrrpd is the primary IP on interface. If you
83 want to hide location of vrrpd, use this IP as src_addr for unicast
84 vrrp packets.
85 '';
86 };
87
88 unicastPeers = mkOption {
89 type = types.listOf types.str;
90 default = [];
91 description = ''
92 Do not send VRRP adverts over VRRP multicast group. Instead it sends
93 adverts to the following list of ip addresses using unicast design
94 fashion. It can be cool to use VRRP FSM and features in a networking
95 environment where multicast is not supported! IP Addresses specified can
96 IPv4 as well as IPv6.
97 '';
98 };
99
100 virtualIps = mkOption {
101 type = types.listOf (types.submodule (import ./virtual-ip-options.nix {
102 inherit lib;
103 }));
104 default = [];
105 example = literalExample ''
106 TODO: Example
107 '';
108 description = "Declarative vhost config";
109 };
110
111 extraConfig = mkOption {
112 type = types.lines;
113 default = "";
114 description = ''
115 Extra lines to be added verbatim to the vrrp_instance section.
116 '';
117 };
118
119 };
120
121}