ifstated: Use templating for ifstated configurations
This commit is contained in:
parent
baa768fe53
commit
e31769a606
4 changed files with 1 additions and 1 deletions
33
roles/ifstated/templates/ifstated-fsol.conf
Normal file
33
roles/ifstated/templates/ifstated-fsol.conf
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
init-state auto
|
||||
|
||||
carp_up = "carp145.link.up"
|
||||
|
||||
state auto {
|
||||
run "pfctl -f /etc/pf.conf"
|
||||
if $carp_up {
|
||||
set-state master
|
||||
}
|
||||
if ! $carp_up {
|
||||
set-state backup
|
||||
}
|
||||
}
|
||||
|
||||
state backup {
|
||||
init {
|
||||
run "/usr/local/sbin/birdc disable ospf1"
|
||||
}
|
||||
if $carp_up {
|
||||
set-state master
|
||||
}
|
||||
}
|
||||
|
||||
state master {
|
||||
init {
|
||||
run "/usr/local/sbin/birdc enable ospf1"
|
||||
}
|
||||
if !$carp_up {
|
||||
set-state backup
|
||||
}
|
||||
}
|
||||
|
32
roles/ifstated/templates/ifstated-ns.conf
Normal file
32
roles/ifstated/templates/ifstated-ns.conf
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
init-state auto
|
||||
|
||||
if_carp_up="carp157.link.up"
|
||||
if_carp_down="carp157.link.down"
|
||||
|
||||
state auto {
|
||||
if $if_carp_up {
|
||||
set-state master
|
||||
}
|
||||
if $if_carp_down {
|
||||
set-state backup
|
||||
}
|
||||
}
|
||||
|
||||
state master {
|
||||
init {
|
||||
run "route delete default && route add default 37.16.96.145"
|
||||
}
|
||||
if $if_carp_down {
|
||||
set-state backup
|
||||
}
|
||||
}
|
||||
|
||||
state backup {
|
||||
init {
|
||||
run "route delete default && route add default 172.20.20.1"
|
||||
}
|
||||
if $if_carp_up {
|
||||
set-state master
|
||||
}
|
||||
}
|
6
roles/ifstated/templates/ifstated-proxy.conf
Normal file
6
roles/ifstated/templates/ifstated-proxy.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
# flush routes when external carp goes up
|
||||
if carp153.link.up
|
||||
run 'route -q flush ; route add default $(cat /etc/mygate)'
|
||||
if carp154.link.up
|
||||
run 'route -q flush ; route add default $(cat /etc/mygate)'
|
Loading…
Add table
Add a link
Reference in a new issue