init.sls 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #
  2. # firmware
  3. #
  4. firmware-pkgs:
  5. pkg.installed:
  6. - pkgs:
  7. - git
  8. - pandoc
  9. user.present:
  10. - name: firmware
  11. - shell: /bin/bash
  12. - home: /home/firmware
  13. - createhome: True
  14. - gid_from_name: True
  15. firmware-git:
  16. file.directory:
  17. - name: {{salt['pillar.get']('nodes:' ~ grains['id'] ~ ':path:firmware', [])}}
  18. - user: firmware
  19. - group: firmware
  20. - mode: 755
  21. - require:
  22. - user: firmware
  23. git.latest:
  24. - name: gogs@git.ffho.net:FreifunkHochstift/ffho-firmware-website.git
  25. - target: {{salt['pillar.get']('nodes:' ~ grains['id'] ~ ':path:firmware', [])}}
  26. - user: firmware
  27. - update_head: False
  28. - require:
  29. - pkg: firmware-pkgs
  30. - user: firmware
  31. - file: firmware-git
  32. firmware-changelog:
  33. cmd.run:
  34. - name: FORCE=1 /usr/local/sbin/update-firmware
  35. - creates: {{salt['pillar.get']('nodes:' ~ grains['id'] ~ ':path:firmware', [])}}/stable/Changelog.html
  36. - user: firmware
  37. - group: firmware
  38. - watch:
  39. - git: firmware-git
  40. - require:
  41. - user: firmware
  42. - file: /usr/local/sbin/update-firmware
  43. firmware-cron:
  44. cron.present:
  45. - name: /usr/local/sbin/update-firmware
  46. - identifier: firmware-cron
  47. - user: firmware
  48. - minute: 42
  49. - require:
  50. - user: firmware
  51. - file: /usr/local/sbin/update-firmware
  52. /usr/local/sbin/update-firmware:
  53. file.managed:
  54. - source: salt://firmware/update-firmware
  55. - template: jinja
  56. - mode: 755