init.sls 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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: git@git.c3pb.de:freifunk-pb/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. - file: /home/firmware/.ssh/id_rsa
  33. - ssh_known_hosts: git.c3pb.de
  34. firmware-changelog:
  35. cmd.run:
  36. - name: FORCE=1 /usr/local/sbin/update-firmware
  37. - creates: {{salt['pillar.get']('nodes:' ~ grains['id'] ~ ':path:firmware', [])}}/stable/Changelog.html
  38. - user: firmware
  39. - group: firmware
  40. - watch:
  41. - git: firmware-git
  42. - require:
  43. - user: firmware
  44. - file: /usr/local/sbin/update-firmware
  45. # SSH fingerprint of gitlab
  46. git.c3pb.de:
  47. ssh_known_hosts.present:
  48. - user: firmware
  49. - enc: ecdsa
  50. - fingerprint: 60:97:30:24:0b:85:21:e4:c3:49:c2:f5:12:de:1c:da
  51. /home/firmware/.ssh:
  52. file.directory:
  53. - user: firmware
  54. - group: firmware
  55. - mode: 700
  56. - require:
  57. - user: firmware
  58. /home/firmware/.ssh/authorized_keys:
  59. file.managed:
  60. - contents_pillar: nodes:masterbuilder.in.ffho.net:ssh:build:pubkey
  61. - user: firmware
  62. - group: firmware
  63. - mode: 644
  64. - require:
  65. - file: /home/firmware/.ssh
  66. /home/firmware/.ssh/id_rsa:
  67. file.managed:
  68. - contents_pillar: nodes:{{ grains['id'] }}:ssh:firmware:privkey
  69. - user: firmware
  70. - group: firmware
  71. - mode: 400
  72. - require:
  73. - file: /home/firmware/.ssh
  74. firmware-cron:
  75. cron.present:
  76. - name: /usr/local/sbin/update-firmware
  77. - identifier: firmware-cron
  78. - user: firmware
  79. - minute: 42
  80. - require:
  81. - user: firmware
  82. - file: /usr/local/sbin/update-firmware
  83. /usr/local/sbin/update-firmware:
  84. file.managed:
  85. - source: salt://firmware/update-firmware
  86. - template: jinja
  87. - mode: 755