init.sls 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #
  2. # Set up B.A.T.M.A.N. module 'n stuff
  3. #
  4. #
  5. # Only set up batman and load batman_adv kernel module if the role »batman«
  6. # has been configured for this node.
  7. #
  8. {%- set roles = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
  9. {%- if 'batman' in roles %}
  10. batctl:
  11. pkg.installed
  12. # Convenience bat-hosts file for informative batctl output
  13. /etc/bat-hosts:
  14. file.managed:
  15. - source: salt://batman/bat-hosts.tmpl
  16. - template: jinja
  17. # Make sure the batman_adv module is loaded at boot time
  18. /etc/modules-load.d/batman-adv.conf:
  19. file.managed:
  20. - source: salt://batman/batman-adv.module.conf
  21. #
  22. # Is this node a B.A.T.M.A.N. gateway?
  23. {%- if 'batman_gw' in roles %}
  24. /etc/cron.d/ff_check_gateway:
  25. file.managed:
  26. - source: salt://batman/ff_check_gateway.cron
  27. - template: jinja
  28. /usr/local/sbin/ff_check_gateway:
  29. file.managed:
  30. - source: salt://batman/ff_check_gateway
  31. - mode: 755
  32. - user: root
  33. - group: root
  34. {% endif %}
  35. #
  36. # If the role »batman» is NOT configured for this node, make sure to purge any
  37. # traces of a previous installation, if present.
  38. #
  39. {% else %}
  40. batctl:
  41. pkg.purged
  42. batman-adv-dkms:
  43. pkg.purged
  44. /etc/bat-hosts:
  45. file.absent
  46. /etc/modules-load.d/batman-adv.conf:
  47. file.absent
  48. /etc/cron.d/ff_check_gateway:
  49. file.absent
  50. /usr/local/sbin/ff_check_gateway:
  51. file.absent
  52. {% endif %}