init.sls 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. {%- if 'batman' in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', ()) %}
  9. include:
  10. - apt
  11. batman-adv-dkms:
  12. pkg.installed:
  13. - require:
  14. - pkgrepo: apt-neoraider
  15. batctl:
  16. pkg.installed:
  17. - require:
  18. - pkgrepo: apt-neoraider
  19. # The ff_fix_batman script ensures that the preferred (currently older) version
  20. # of the batman_adv kernel module is compiled via DKMS and installed into the
  21. # system.
  22. /usr/local/sbin/ff_fix_batman:
  23. file.managed:
  24. - source: salt://batman/ff_fix_batman
  25. - user: root
  26. - group: root
  27. - mode: 744
  28. - require:
  29. - pkg: batctl
  30. ff_fix_batman:
  31. cmd.wait:
  32. - name: /usr/local/sbin/ff_fix_batman
  33. - require:
  34. - file: /usr/local/sbin/ff_fix_batman
  35. - watch:
  36. - pkg: batman-adv-dkms
  37. # Install and enable a ff-fix-batman service which runs at boot time
  38. # to fix the kernel module after a kernel upgrade + reboot if neccessary.
  39. /lib/systemd/system/ff-fix-batman.service:
  40. file.managed:
  41. - source: salt://batman/ff_fix_batman.service
  42. - user: root
  43. - group: root
  44. - mode: 644
  45. - require:
  46. - file: /usr/local/sbin/ff_fix_batman
  47. enable-ff-fix-batman-service:
  48. service.enabled:
  49. - name: ff-fix-batman
  50. - require:
  51. - file: /lib/systemd/system/ff-fix-batman.service
  52. # Make sure the batman_adv module is loaded at boot time
  53. /etc/modules-load.d/batman-adv.conf:
  54. file.managed:
  55. - source: salt://batman/batman-adv.module.conf
  56. #
  57. # If the role »batman» is NOT configured for this node, make sure to purge any
  58. # traces of a previous installation, if present.
  59. #
  60. {% else %}
  61. batctl:
  62. pkg.purged
  63. batman-adv-dkms:
  64. pkg.purged
  65. /usr/local/sbin/ff_fix_batman:
  66. file.absent
  67. disable-ff-fix-batman-service:
  68. service.disabled:
  69. - name: ff-fix-batman
  70. /lib/systemd/system/ff-fix-batman.service:
  71. file.absent
  72. /etc/modules-load.d/batman-adv.conf:
  73. file.absent
  74. {% endif %}