1{ lib } :
2
3with lib;
4{
5 options = {
6
7 interface = mkOption {
8 type = types.str;
9 description = lib.mdDoc ''
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 = lib.mdDoc ''
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 = lib.mdDoc ''
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 = lib.mdDoc ''
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 = lib.mdDoc ''
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 = lib.mdDoc ''
57 Use VRRP Virtual MAC.
58 '';
59 };
60
61 vmacInterface = mkOption {
62 type = types.nullOr types.str;
63 default = null;
64 description = lib.mdDoc ''
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 = lib.mdDoc ''
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 = lib.mdDoc ''
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 = lib.mdDoc ''
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 # TODO: example
106 description = lib.mdDoc "Declarative vhost config";
107 };
108
109 trackScripts = mkOption {
110 type = types.listOf types.str;
111 default = [];
112 example = [ "chk_cmd1" "chk_cmd2" ];
113 description = lib.mdDoc "List of script names to invoke for health tracking.";
114 };
115
116 trackInterfaces = mkOption {
117 type = types.listOf types.str;
118 default = [];
119 example = [ "eth0" "eth1" ];
120 description = lib.mdDoc "List of network interfaces to monitor for health tracking.";
121 };
122
123 extraConfig = mkOption {
124 type = types.lines;
125 default = "";
126 description = lib.mdDoc ''
127 Extra lines to be added verbatim to the vrrp_instance section.
128 '';
129 };
130
131 };
132
133}