changed the procedure to have two repos:
authorPaul Tonelli <paul.tonelli@logilab.fr>
Thu, 21 Mar 2013 17:48:07 +0100
changeset 89 d6f5473f3dc1
parent 88 6d331521b68f
child 90 e3d6302bcff4
changed the procedure to have two repos: - the first one to host all the code : http://hg.logilab.org/users/ptonelli/ami_creator/server/ - a second one to host only the variation files: http://hg.logilab.org/users/ptonelli/ami_creator/variation/ and changed everything accordingly: - requires additionnal highstate to work - updated readme
ami_pre/files.sls
others/rc.local
readme.rst
update.sls
variation.sls
--- a/ami_pre/files.sls	Thu Mar 21 15:37:51 2013 +0100
+++ b/ami_pre/files.sls	Thu Mar 21 17:48:07 2013 +0100
@@ -48,11 +48,13 @@
         - require:
             - mount.mounted: mounted_variation
 
-variation.sls:
-    file.managed:
-        - name: /mnt/variation/etc/salt/srv/variation.sls
-        - source: salt://variation.sls
-        - mode: 644
+hg_variation:
+    hg.latest:
+        - name: {{ grains['ami.hg_address_variation'] }}
+{% if 'ami.hg_rev_variation' in grains %}
+        - rev: {{ grains['ami.hg_rev_variation'] }}
+{% endif %}
+        - target: /mnt/variation/etc/salt/srv/variation
         - require:
             - mount.mounted: mounted_variation
 
--- a/others/rc.local	Thu Mar 21 15:37:51 2013 +0100
+++ b/others/rc.local	Thu Mar 21 17:48:07 2013 +0100
@@ -13,7 +13,9 @@
 
 ### Specific to salt-call machine creation
 
-## should get everything up to date
+## fills the missing grains 
+/usr/bin/env salt-call state.highstate
+## updates hg 
 /usr/bin/env salt-call state.highstate
 ## should source everything in /var/salt 
 /usr/bin/env salt-call state.highstate
--- a/readme.rst	Thu Mar 21 15:37:51 2013 +0100
+++ b/readme.rst	Thu Mar 21 17:48:07 2013 +0100
@@ -5,7 +5,12 @@
 Automatically create variations of virtual machines depending
 on configuration files availables in repository :
 
-  http://hg.logilab.fr/users/ptonelli/srv_salt/states/
+  http://hg.logilab.org/users/ptonelli/ami_creator/variation
+
+
+it also automatically gets the correct scripts from while doing so: 
+
+  http://hg.logilab.org/users/ptonelli/ami_creator/server
 
 Present state
 =============
@@ -28,8 +33,8 @@
 
 ====== START =======
 
-ami.hg_rev: 249:9ed741a55f17
-ami.hg_address: http://hg.logilab.fr/users/ptonelli/srv_salt
+ami.hg_rev_variation: 249:9ed741a55f17
+ami.hg_address_variation: http://hg.logilab.org/users/ptonelli/ami_creator/variation
 ami.name: my_variation 
 ami.type: debian #or ubuntu
 
--- a/update.sls	Thu Mar 21 15:37:51 2013 +0100
+++ b/update.sls	Thu Mar 21 17:48:07 2013 +0100
@@ -8,17 +8,26 @@
       - rsync
       - glance
 
+
+
 {% if 'ami.hg_address' not in grains %}
-ami.hg_address:
+ami.hg_address_server:
     present:
-        - value: {{ salt['state.single']('grains.present', 'ami.hg_address', value='http://hg.logilab.fr/users/ptonelli/srv_salt') }}
+        - value: {{ salt['state.single']('grains.present', 'ami.hg_address_server', value='http://hg.logilab.org/users/ptonelli/ami_creator/server') }}
 {% endif %}
 
+{% if 'ami.hg_address' not in grains %}
+ami.hg_address_variation:
+    present:
+        - value: {{ salt['state.single']('grains.present', 'ami.hg_address_variation', value='http://hg.logilab.org/users/ptonelli/ami_creator/variation') }}
+{% endif %}
+
+
 hg_code:
     hg.latest:
-        - name: {{ grains['ami.hg_address'] }}
-{% if 'ami.hg_rev' in grains %}
-        - rev: {{ grains['ami.hg_rev'] }}
+        - name: {{ grains['ami.hg_address_server'] }}
+{% if 'ami.hg_rev_server' in grains %}
+        - rev: {{ grains['ami.hg_rev_server'] }}
 {% endif %}
         - target: /etc/salt/srv
         - require:
--- a/variation.sls	Thu Mar 21 15:37:51 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-# /srv/salt/init_machine.sls
-ami-packages:
-  pkg.installed:
-    - pkgs:
-      - salt-minion
-      - python
-      - mercurial
-      - less
-      - sl
-
-#http://hg.logilab.fr/users/ptonelli/srv_salt:
-#   hg.latest:
-#     - target: /mnt
-
-#salt.states.file.absent(name)