init.sls 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #
  2. # mongodb
  3. #
  4. mongodb-repo:
  5. pkgrepo.managed:
  6. - humanname: MongoDB Repo
  7. - file: /etc/apt/sources.list.d/mongodb-org.list
  8. - key_url: https://www.mongodb.org/static/pgp/server-{{ mongodb_version }}.asc
  9. {% if mongodb_version == '4.2' %}
  10. - name: deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main
  11. {% elif mongodb_version == '4.4' %}
  12. - name: deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main
  13. {% elif mongodb_version == '5.0' %}
  14. - name: deb http://repo.mongodb.org/apt/debian {{ grains.oscodename }}/mongodb-org/5.0 main
  15. {% endif %}
  16. mongodb:
  17. pkg.installed:
  18. - name: mongodb-org
  19. service.running:
  20. - name: mongod
  21. - enable: True
  22. # Install cronjob, backup script and corresponding config file
  23. /etc/cron.d/mongodb_backup:
  24. file.managed:
  25. - source: salt://mongodb/mongodb_backup.cron
  26. /usr/local/sbin/mongodb_backup:
  27. file.managed:
  28. - source: salt://mongodb/mongodb_backup
  29. - mode: 755
  30. /etc/mongodb_backup.conf:
  31. file.managed:
  32. - source: salt://mongodb/mongodb_backup.conf
  33. - mode: 600
  34. - user: root
  35. - group: root