Saltstack Official MongoDB Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
911B

  1. {%- from "mongodb/map.jinja" import server with context %}
  2. {%- if server.get('enabled', False) %}
  3. mongodb_packages:
  4. pkg.installed:
  5. - names: {{ server.pkgs }}
  6. /etc/mongodb.conf:
  7. file.managed:
  8. - source: salt://mongodb/files/mongodb.conf
  9. - template: jinja
  10. - require:
  11. - pkg: mongodb_packages
  12. {%- if server.shared_key is defined %}
  13. /etc/mongodb.key:
  14. file.managed:
  15. - contents_pillar: mongodb:server:shared_key
  16. - mode: 600
  17. - user: mongodb
  18. - require:
  19. - pkg: mongodb_packages
  20. - watch_in:
  21. - service: mongodb_service
  22. {%- endif %}
  23. {{ server.lock_dir }}:
  24. file.directory:
  25. - makedirs: true
  26. mongodb_service:
  27. service.running:
  28. - name: {{ server.service }}
  29. - enable: true
  30. {%- if grains.get('noservices') %}
  31. - onlyif: /bin/false
  32. {%- endif %}
  33. - require:
  34. - file: {{ server.lock_dir }}
  35. - pkg: mongodb_packages
  36. - watch:
  37. - file: /etc/mongodb.conf
  38. {%- endif %}