|
4 | 4 | {{- $vyos := index . "vyos" -}} |
5 | 5 | {{- $passwd := index . "passwd" -}} |
6 | 6 | {{- $ssh := index . "ssh" -}} |
| 7 | +{{- $snmp := index . "snmp" -}} |
7 | 8 | {{- $emulators := index . "emulators" -}} |
8 | 9 | {{- $snat := index . "snat" -}} |
9 | 10 | {{- $dnat := index . "dnat" -}} |
@@ -221,14 +222,47 @@ set vpn ipsec site-to-site peer {{ $site.Peer }} tunnel {{ $idx }} remote prefix |
221 | 222 | {{- end }} |
222 | 223 | {{- end }} |
223 | 224 | # -------------------------------- Services ------------------------------- |
| 225 | +# SSH |
224 | 226 | {{- if $ssh }} |
225 | 227 | set service ssh listen-address {{ $ssh }} |
226 | 228 | {{- end }} |
| 229 | +# NTP |
227 | 230 | {{- if $ntpAddr }} |
228 | 231 | set service ntp server {{ $ntpAddr }} prefer |
229 | 232 | {{- else }} |
230 | 233 | delete service ntp |
231 | 234 | {{- end }} |
| 235 | +# SNMP |
| 236 | + {{- if $snmp }} |
| 237 | + {{- if $snmp.ListenAddr }} |
| 238 | +set service snmp listen-address {{ $snmp.ListenAddr }} |
| 239 | + {{- end }} |
| 240 | + {{- if $snmp.Contact }} |
| 241 | +set service snmp contact '{{ $snmp.Contact }}' |
| 242 | + {{- end }} |
| 243 | + {{- if $snmp.Location }} |
| 244 | +set service snmp location '{{ $snmp.Location }}' |
| 245 | + {{- end }} |
| 246 | + {{- if $snmp.SystemName }} |
| 247 | +set service snmp description '{{ $snmp.SystemName }}' |
| 248 | + {{- end }} |
| 249 | + {{- range $community := $snmp.Communities }} |
| 250 | + {{- if $community.Name }} |
| 251 | +set service snmp community '{{ $community.Name }}' |
| 252 | + {{- if $community.Authorization }} |
| 253 | +set service snmp community '{{ $community.Name }}' authorization {{ $community.Authorization }} |
| 254 | + {{- else }} |
| 255 | +set service snmp community '{{ $community.Name }}' authorization ro |
| 256 | + {{- end }} |
| 257 | + {{- range $client := $community.Clients }} |
| 258 | +set service snmp community '{{ $community.Name }}' client {{ $client }} |
| 259 | + {{- end }} |
| 260 | + {{- range $target := $community.TrapTargets }} |
| 261 | +set service snmp trap-target {{ $target }} community '{{ $community.Name }}' |
| 262 | + {{- end }} |
| 263 | + {{- end }} |
| 264 | + {{- end }} |
| 265 | + {{- end }} |
232 | 266 | # --------------------------------- System -------------------------------- |
233 | 267 | set system host-name {{ $node.RouterName }} |
234 | 268 | commit |
@@ -552,11 +586,48 @@ vpn { |
552 | 586 | {{- end }} |
553 | 587 | } |
554 | 588 |
|
555 | | - {{- if $ssh }} |
| 589 | + {{- if or $ssh $snmp }} |
556 | 590 | service { |
| 591 | + {{- if $ssh }} |
557 | 592 | ssh { |
558 | 593 | listen-address {{ $ssh }} |
559 | 594 | } |
| 595 | + {{- end}} |
| 596 | + {{- if $snmp }} |
| 597 | + snmp { |
| 598 | + {{- if $snmp.ListenAddr }} |
| 599 | + listen-address {{ $snmp.ListenAddr }} |
| 600 | + {{- end }} |
| 601 | + {{- if $snmp.Contact }} |
| 602 | + contact "{{ $snmp.Contact }}" |
| 603 | + {{- end }} |
| 604 | + {{- if $snmp.Location }} |
| 605 | + location "{{ $snmp.Location }}" |
| 606 | + {{- end }} |
| 607 | + {{- if $snmp.SystemName }} |
| 608 | + description "{{ $snmp.SystemName }}" |
| 609 | + {{- end }} |
| 610 | + {{- range $community := $snmp.Communities }} |
| 611 | + {{- if $community.Name }} |
| 612 | + community {{ $community.Name }} { |
| 613 | + {{- if $community.Authorization }} |
| 614 | + authorization {{ $community.Authorization }} |
| 615 | + {{- else }} |
| 616 | + authorization ro |
| 617 | + {{- end }} |
| 618 | + {{- range $client := $community.Clients }} |
| 619 | + client {{ $client }} |
| 620 | + {{- end }} |
| 621 | + } |
| 622 | + {{- range $target := $community.TrapTargets }} |
| 623 | + trap-target {{ $target }} { |
| 624 | + community "{{ $community.Name }}" |
| 625 | + } |
| 626 | + {{- end }} |
| 627 | + {{- end }} |
| 628 | + {{- end }} |
| 629 | + } |
| 630 | + {{- end}} |
560 | 631 | } |
561 | 632 | {{- end }} |
562 | 633 |
|
|
0 commit comments