[instances] configure extra apt source if present in pillar
authorArthur Lutz <arthur.lutz@logilab.fr>
Thu, 13 Nov 2014 15:31:59 +0100
changeset 11 25876e1446db
parent 10 f0ac4b0af639
child 12 8eb0088192b5
[instances] configure extra apt source if present in pillar
cubicweb/instances.sls
--- a/cubicweb/instances.sls	Thu Oct 23 17:05:05 2014 +0200
+++ b/cubicweb/instances.sls	Thu Nov 13 15:31:59 2014 +0100
@@ -1,6 +1,23 @@
 include:
   - cubicweb
 
+{% if salt['pillar.get']('extra_source') %}
+{% if 'https' in  pillar['extra_source'] %}
+apt-transport-https:
+    pkg:
+        - installed
+{% endif %}
+
+cubicweb extra source: 
+    pkgrepo.managed:
+        - name : {{ pillar['extra_source'] }}
+        - file: /etc/apt/sources.list.d/extra_source.list
+{% if pillar['extra_source'].startswith('https') %}
+        - require:
+            - pkg : apt-transport-https
+{% endif %}
+{% endif %}
+
 {% for vhostname, vhost in pillar['cubicweb_apps'].iteritems() %}
  {% for name, config in vhost.iteritems() %}
 
@@ -25,6 +42,9 @@
         {% endfor %}
     - require:
       - pkg: cw-web
+{% if salt['pillar.get']('extra_source') %}
+      - pkgrepo: cubicweb extra source
+{% endif %}
 
 cw-{{vhostname}}-{{name}}-running:
   cubicweb_instance.running: