Browse Source

Generate /etc/bat-hosts files with all BATMAN MACs we know of.

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
Maximilian Wilhelm 7 years ago
parent
commit
22b6dc395b
2 changed files with 20 additions and 0 deletions
  1. 10 0
      batman/bat-hosts.tmpl
  2. 10 0
      batman/init.sls

+ 10 - 0
batman/bat-hosts.tmpl

@@ -0,0 +1,10 @@
+#
+# /etc/bat-hosts (Salt generated)
+#
+{%- set sites     = salt['pillar.get']('sites', {}) %}
+{%- set nodes     = salt['pillar.get']('nodes', {}) %}
+{%- set bat_hosts = salt['ffho_net.gen_bat_hosts'](nodes, sites) %}
+{%- for mac in bat_hosts|sort %}
+  {%- set entry_name = bat_hosts.get (mac) %}
+{{ mac }}	{{ entry_name }}
+{%- endfor %}

+ 10 - 0
batman/init.sls

@@ -21,6 +21,13 @@ batctl:
       - pkgrepo: apt-neoraider
 
 
+# Conveniance bat-hosts file for informative batctl output
+/etc/bat-hosts:
+  file.managed:
+    - source: salt://batman/bat-hosts.tmpl
+    - template: jinja
+
+
 # The ff_fix_batman script ensures that the preferred (currently older) version
 # of the batman_adv kernel module is compiled via DKMS and installed into the
 # system.
@@ -90,4 +97,7 @@ disable-ff-fix-batman-service:
 
 /etc/modules-load.d/batman-adv.conf:
   file.absent
+
+/etc/bat-hosts:
+  file.absent
 {% endif %}