init.sls 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #
  2. # gogs
  3. #
  4. {% set config = salt['pillar.get']('nodes:' ~ grains.id ~ ':gogs', {}) %}
  5. gogs-repo:
  6. pkgrepo.managed:
  7. - comments: "# gogs repo"
  8. - human_name: gogs repository
  9. - name: "deb https://deb.packager.io/gh/pkgr/gogs {{ grains.oscodename }} pkgr"
  10. - dist: {{grains.oscodename}}
  11. - file: /etc/apt/sources.list.d/gogs.list
  12. - key_url: salt://gogs/gogs-repo.apt.key
  13. postgresql:
  14. pkg.installed:
  15. - name: postgresql
  16. service.running:
  17. - name: postgresql
  18. - enable: true
  19. - require:
  20. - pkg: postgresql
  21. gogs:
  22. pkg.installed:
  23. - pkgs:
  24. - gogs
  25. - require:
  26. - pkgrepo: gogs-repo
  27. postgres_database.present:
  28. - require:
  29. - service: postgresql
  30. postgres_user.present:
  31. - password: {{config.password}}
  32. - require:
  33. - service: postgresql
  34. postgres_privileges.present:
  35. - object_name: gogs
  36. - object_type: database
  37. - user: postgres
  38. - privileges:
  39. - all
  40. - require:
  41. - postgres_database: gogs
  42. - postgres_user: gogs
  43. /srv/gogs:
  44. file.directory:
  45. - user: gogs
  46. - group: gogs
  47. - require:
  48. - pkg: gogs