Browse Source

mongodb: Set repo version by variable

Philipp Fromme 1 year ago
parent
commit
efcc12bfd4
2 changed files with 11 additions and 4 deletions
  1. 2 1
      graylog/init.sls
  2. 9 3
      mongodb/init.sls

+ 2 - 1
graylog/init.sls

@@ -3,9 +3,10 @@
 #
 #
 
 
 {% set graylog_config = salt['pillar.get']('logging:graylog') %}
 {% set graylog_config = salt['pillar.get']('logging:graylog') %}
+{% set mongodb_version = '4.2' %}
+{% include '../mongodb/init.sls' %}
 
 
 include:
 include:
-  - mongodb
   - elasticsearch
   - elasticsearch
 
 
 graylog-repo:
 graylog-repo:

+ 9 - 3
mongodb/init.sls

@@ -2,12 +2,18 @@
 # mongodb
 # mongodb
 #
 #
 
 
-mongodb-repo-4.2:
+mongodb-repo:
   pkgrepo.managed:
   pkgrepo.managed:
     - humanname: MongoDB Repo
     - humanname: MongoDB Repo
+    - file: /etc/apt/sources.list.d/mongodb-org.list
+    - key_url: https://www.mongodb.org/static/pgp/server-{{ mongodb_version }}.asc
+    {% if mongodb_version == '4.2' %}
     - name: deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main
     - name: deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main
-    - file: /etc/apt/sources.list.d/mongodb-org-4.2.list
-    - key_url: https://www.mongodb.org/static/pgp/server-4.2.asc
+    {% elif mongodb_version == '4.4' %}
+    - name: deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main
+    {% elif mongodb_version == '5.0' %}
+    - name: deb http://repo.mongodb.org/apt/debian {{ grains.oscodename }}/mongodb-org/5.0 main
+    {% endif %}
 
 
 mongodb:
 mongodb:
   pkg.installed:
   pkg.installed: