Page MenuHomeDevCentral

D2303.diff
No OneTemporary

D2303.diff

diff --git a/pillar/core/network.sls b/pillar/core/network.sls
new file mode 100644
--- /dev/null
+++ b/pillar/core/network.sls
@@ -0,0 +1,19 @@
+networks:
+ drake:
+ netmask: 255.255.255.0
+ addr:
+ windriver: 172.27.27.27
+ ysul: 172.27.27.33
+
+gre_tunnels:
+ windriver:
+ wind-ysul:
+ interface: gre0
+ network: drake
+ to: ysul
+
+ ysul:
+ wind-ysul:
+ interface: gre0
+ network: drake
+ to: windriver
diff --git a/pillar/top.sls b/pillar/top.sls
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -10,6 +10,7 @@
'*':
- core.users
- core.groups
+ - core.network
- certificates.certificates
- nodes.nodes
- nodes.forests
diff --git a/roles/core/network/files/netif_gre.rc b/roles/core/network/files/netif_gre.rc
new file mode 100644
--- /dev/null
+++ b/roles/core/network/files/netif_gre.rc
@@ -0,0 +1,17 @@
+# -------------------------------------------------------------
+# Network — rc configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/core/network/files/netif_gre.rc
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+cloned_interfaces="$cloned_interfaces {{ interface }}"
+ifconfig_{{ interface }}="{{ src }} {{ dst }} netmask 0xffffffff tunnel {{ icann_src }} {{ icann_dst }} descr {{ description }}"
diff --git a/roles/core/network/init.sls b/roles/core/network/init.sls
--- a/roles/core/network/init.sls
+++ b/roles/core/network/init.sls
@@ -65,3 +65,45 @@
- template: jinja
- mode: 755
{% endif %}
+
+# -------------------------------------------------------------
+# GRE tunnels
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% set gre_tunnels = salt['pillar.get']("gre_tunnels:" + grains['id'], {}) %}
+
+{% if grains['os'] == 'FreeBSD' %}
+
+{% set boot_loader = namespace(gre=false) %}
+
+{% for description, tunnel in gre_tunnels.items() %}
+
+{% set boot_loader.gre = True %}
+{% set tunnel_network = pillar['networks'][tunnel['network']] %}
+
+/etc/rc.conf.d/netif/gre_{{ description }}:
+ file.managed:
+ - source: salt://roles/core/network/files/netif_gre.rc
+ - makedirs: True
+ - template: jinja
+ - context:
+ description: {{ description }}
+ interface: {{ tunnel['interface'] }}
+
+ src: {{ tunnel_network['addr'][grains['id']] }}
+ dst: {{ tunnel_network['addr'][tunnel['to']] }}
+
+ icann_src: {{ network['ipv4_address'] }}
+ icann_dst: {{ salt['node.get']('network', tunnel['to'])['ipv4_address'] }}
+{% endfor %}
+
+{% if boot_loader.gre %}
+load_gre_kernel_module:
+ file.append:
+ - name: /boot/loader.conf
+ - text: |
+
+ if_gre_load="YES"
+{% endif %}
+
+{% endif %}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 10:41 (21 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2272874
Default Alt Text
D2303.diff (3 KB)

Event Timeline