init.sls 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. {% if grains.oscodename == "jessie" %}
  17. - fromrepo: jessie-backports
  18. {% endif %}
  19. service.running:
  20. - name: postgresql
  21. - enable: true
  22. - require:
  23. - pkg: postgresql
  24. gogs:
  25. pkg.installed:
  26. - pkgs:
  27. - gogs
  28. - require:
  29. - pkgrepo: gogs-repo
  30. postgres_database.present:
  31. - require:
  32. - service: postgresql
  33. postgres_user.present:
  34. - password: {{config.password}}
  35. - require:
  36. - service: postgresql
  37. postgres_privileges.present:
  38. - object_name: gogs
  39. - object_type: database
  40. - user: postgres
  41. - privileges:
  42. - all
  43. - require:
  44. - postgres_database: gogs
  45. - postgres_user: gogs
  46. /srv/gogs:
  47. file.directory:
  48. - user: gogs
  49. - group: gogs
  50. - require:
  51. - pkg: gogs