init.sls 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. include:
  10. - apt
  11. {%- if 'batman' in roles %}
  12. batctl:
  13. pkg.installed
  14. # Convenience bat-hosts file for informative batctl output
  15. /etc/bat-hosts:
  16. file.managed:
  17. - source: salt://batman/bat-hosts.tmpl
  18. - template: jinja
  19. # Make sure the batman_adv module is loaded at boot time
  20. /etc/modules-load.d/batman-adv.conf:
  21. file.managed:
  22. - source: salt://batman/batman-adv.module.conf
  23. #
  24. # Is this node a B.A.T.M.A.N. gateway?
  25. {%- if 'batman_gw' in roles %}
  26. /etc/cron.d/ff_check_gateway:
  27. file.managed:
  28. - source: salt://batman/ff_check_gateway.cron
  29. - template: jinja
  30. /usr/local/sbin/ff_check_gateway:
  31. file.managed:
  32. - source: salt://batman/ff_check_gateway
  33. - mode: 755
  34. - user: root
  35. - group: root
  36. {% endif %}
  37. #
  38. # If the role »batman» is NOT configured for this node, make sure to purge any
  39. # traces of a previous installation, if present.
  40. #
  41. {% else %}
  42. batctl:
  43. pkg.purged
  44. batman-adv-dkms:
  45. pkg.purged
  46. /etc/bat-hosts:
  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 %}