change ami_creator.sls state file to use module.run instead of include, should run sls files independantly and solve template bug.
authorPaul Tonelli <paul.tonelli@logilab.fr>
Thu, 18 Apr 2013 14:31:03 +0200
changeset 116 41ee6c1162be
parent 115 063b9cbe5aa1
child 117 a722452444fc
change ami_creator.sls state file to use module.run instead of include, should run sls files independantly and solve template bug.
ami_creator.sls
others/rc.local
--- a/ami_creator.sls	Thu Apr 18 11:46:37 2013 +0200
+++ b/ami_creator.sls	Thu Apr 18 14:31:03 2013 +0200
@@ -1,35 +1,28 @@
 # /srv/salt/init_machine.sls
 
-#include:
-#    - ami_pre
-#preparation:
-#    sls:
-#        - ami_pre
-#    require:
-#        - hg.latest: hg_code
+preparation:
+    module.run:
+        - name: state.sls
+        - mods: ami_pre
 
 update_variant:
     module.run:
         - name: vm_create.update_image
         - path: /mnt/variation
-#    require:
-#        - ami_pre.mount.mounted: mounted_variation
-#        - ami_pre.mount.mounted: chroot_proc 
-#        - ami_pre.mount.mounted: chroot_devpts
-#        - ami_pre: resolvconf 
+        - require:
+            - module.run: preparation 
 
 variate_variant:
     module.run:
         - name: vm_create.variate_image
         - path: /mnt/variation
-    require:
-        - module.run: vm_create.update_image
+        - require:
+            - module.run: vm_create.update_image
 
-#include:
-#    - ami_post
-#cleaning:
-#    sls:
-#        - ami_post
-#    require:
-#        - vm_create.variate_image
+cleaning:
+    module.run:
+        - name: state.sls
+        - mods: ami_post
+        - require:
+            - module.run: variate_variant 
 
--- a/others/rc.local	Thu Apr 18 11:46:37 2013 +0200
+++ b/others/rc.local	Thu Apr 18 14:31:03 2013 +0200
@@ -16,15 +16,15 @@
 ## parse the user-data for ami related information
 /usr/bin/env python /etc/salt/srv/others/ec2_ami_parser.py
 
-## update host, get updated code 
+## get updated code if necessary 
 /usr/bin/env salt-call state.highstate &> /dev/ttyS0
-## should source everything in /var/salt
+## update host 
+/usr/bin/env salt-call state.highstate &> /dev/ttyS0
+## should source everything up to date in /var/salt
 /usr/bin/env salt-call state.highstate &> /dev/ttyS0
 ## download, untar, resize and mount
-/usr/bin/env salt-call state.sls ami_pre &> /dev/ttyS0
 ## update modify image depending on variation.sls file
 /usr/bin/env salt-call state.sls ami_creator &> /dev/ttyS0
 ## umount, resize and upload if possible
-/usr/bin/env salt-call state.sls ami_post &> /dev/ttyS0
 
 exit 0