123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- #
- # Set up B.A.T.M.A.N. module 'n stuff
- #
- #
- # Only set up batman and load batman_adv kernel module if the role »batman«
- # has been configured for this node.
- #
- {%- set roles = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
- {%- if 'batman' in roles %}
- include:
- - apt
- batman-adv-dkms:
- pkg.installed:
- - require:
- - pkgrepo: apt-neoraider
- batctl:
- pkg.installed:
- - require:
- - 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.
- /usr/local/sbin/ff_fix_batman:
- file.managed:
- - source: salt://batman/ff_fix_batman
- - user: root
- - group: root
- - mode: 744
- - require:
- - pkg: batctl
- ff_fix_batman:
- cmd.wait:
- - name: /usr/local/sbin/ff_fix_batman
- - require:
- - file: /usr/local/sbin/ff_fix_batman
- - watch:
- - pkg: batman-adv-dkms
- # Install and enable a ff-fix-batman service which runs at boot time
- # to fix the kernel module after a kernel upgrade + reboot if neccessary.
- /lib/systemd/system/ff-fix-batman.service:
- file.managed:
- - source: salt://batman/ff_fix_batman.service
- - user: root
- - group: root
- - mode: 644
- - require:
- - file: /usr/local/sbin/ff_fix_batman
- enable-ff-fix-batman-service:
- service.enabled:
- - name: ff-fix-batman
- - require:
- - file: /lib/systemd/system/ff-fix-batman.service
- # Make sure the batman_adv module is loaded at boot time
- /etc/modules-load.d/batman-adv.conf:
- file.managed:
- - source: salt://batman/batman-adv.module.conf
- #
- # Is this node a B.A.T.M.A.N. gateway?
- {%- if 'batman_gw' in roles %}
- /etc/cron.d/ff_check_gateway:
- file.managed:
- - source: salt://batman/ff_check_gateway.cron
- - template: jinja
- /usr/local/sbin/ff_check_gateway:
- file.managed:
- - source: salt://batman/ff_check_gateway
- - mode: 755
- - user: root
- - group: root
- {% endif %}
- #
- # If the role »batman» is NOT configured for this node, make sure to purge any
- # traces of a previous installation, if present.
- #
- {% else %}
- batctl:
- pkg.purged
- batman-adv-dkms:
- pkg.purged
- /usr/local/sbin/ff_fix_batman:
- file.absent
- disable-ff-fix-batman-service:
- service.disabled:
- - name: ff-fix-batman
- /lib/systemd/system/ff-fix-batman.service:
- file.absent
- /etc/modules-load.d/batman-adv.conf:
- file.absent
- /etc/bat-hosts:
- file.absent
- /etc/cron.d/ff_check_gateway:
- file.absent
- /usr/local/sbin/ff_check_gateway:
- file.absent
- {% endif %}
|