modified syntax to go from salt['grains.present']('...') to grains['...'] whichi is MUCH cleaner and removed use of vriables to have only grains
authorPaul Tonelli <paul.tonelli@logilab.fr>
Fri, 15 Mar 2013 09:43:42 +0100
changeset 79 07d85619353a
parent 78 f964fb1a386a
child 80 8b298d36c41b
modified syntax to go from salt['grains.present']('...') to grains['...'] whichi is MUCH cleaner and removed use of vriables to have only grains
ami_creator.sls
--- a/ami_creator.sls	Fri Mar 15 14:58:22 2013 +0100
+++ b/ami_creator.sls	Fri Mar 15 09:43:42 2013 +0100
@@ -9,18 +9,17 @@
       - rsync
       - glance
 
+{% if 'ami.hg_address' not in grains %}
+ami.hg_address:
+    grains.present:
+        - value : http://hg.logilab.fr/users/ptonelli/srv_salt
+{% endif %}
 
-{% if  salt['grains.item']('ami_hg_address') %}
-{% set ami_hg_address = salt['grains.item']('ami.hg_address') %}
-{% else %}
-{% set ami_hg_address = 'http://hg.logilab.fr/users/ptonelli/srv_salt' %}
-{% endif %}
 hg_ami_creation:
     hg.latest:
-        - name: {{ ami_hg_address }}
-{% if  salt['grains.item']('ami.hg_rev') %}
-{% set ami_hg_revision = salt['grains.item']('ami.hg_rev') %}
-        - rev: {{ ami_hg_revision }}
+        - name: {{ grains['ami.hg_address'] }}
+{% if  grains['ami.hg_rev'] %}
+        - rev: {{ grains['ami.hg_rev'] }}
 {% endif %}
         - target: /etc/salt/srv
         - require: