init.sls 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. # Conveniance bat-hosts file for informative batctl output
  20. /etc/bat-hosts:
  21. file.managed:
  22. - source: salt://batman/bat-hosts.tmpl
  23. - template: jinja
  24. # The ff_fix_batman script ensures that the preferred (currently older) version
  25. # of the batman_adv kernel module is compiled via DKMS and installed into the
  26. # system.
  27. /usr/local/sbin/ff_fix_batman:
  28. file.managed:
  29. - source: salt://batman/ff_fix_batman
  30. - user: root
  31. - group: root
  32. - mode: 744
  33. - require:
  34. - pkg: batctl
  35. ff_fix_batman:
  36. cmd.wait:
  37. - name: /usr/local/sbin/ff_fix_batman
  38. - require:
  39. - file: /usr/local/sbin/ff_fix_batman
  40. - watch:
  41. - pkg: batman-adv-dkms
  42. # Install and enable a ff-fix-batman service which runs at boot time
  43. # to fix the kernel module after a kernel upgrade + reboot if neccessary.
  44. /lib/systemd/system/ff-fix-batman.service:
  45. file.managed:
  46. - source: salt://batman/ff_fix_batman.service
  47. - user: root
  48. - group: root
  49. - mode: 644
  50. - require:
  51. - file: /usr/local/sbin/ff_fix_batman
  52. enable-ff-fix-batman-service:
  53. service.enabled:
  54. - name: ff-fix-batman
  55. - require:
  56. - file: /lib/systemd/system/ff-fix-batman.service
  57. # Make sure the batman_adv module is loaded at boot time
  58. /etc/modules-load.d/batman-adv.conf:
  59. file.managed:
  60. - source: salt://batman/batman-adv.module.conf
  61. #
  62. # If the role »batman» is NOT configured for this node, make sure to purge any
  63. # traces of a previous installation, if present.
  64. #
  65. {% else %}
  66. batctl:
  67. pkg.purged
  68. batman-adv-dkms:
  69. pkg.purged
  70. /usr/local/sbin/ff_fix_batman:
  71. file.absent
  72. disable-ff-fix-batman-service:
  73. service.disabled:
  74. - name: ff-fix-batman
  75. /lib/systemd/system/ff-fix-batman.service:
  76. file.absent
  77. /etc/modules-load.d/batman-adv.conf:
  78. file.absent
  79. /etc/bat-hosts:
  80. file.absent
  81. {% endif %}