- convert to behavior with no default grains
authorPaul Tonelli <paul.tonelli@logilab.fr>
Wed, 27 Mar 2013 17:57:05 +0100
changeset 102 c7a8e6075a8a
parent 101 8b47c42308c4
child 103 212c35d66dcc
- convert to behavior with no default grains - moved resolv.conf code block for state to run in order - add a custom ppa for ubuntu instances where salt is not available
ami_pre/files.sls
--- a/ami_pre/files.sls	Tue Mar 26 09:29:53 2013 +0100
+++ b/ami_pre/files.sls	Wed Mar 27 17:57:05 2013 +0100
@@ -22,7 +22,25 @@
         - require:
             - mount.mounted: mounted_variation
 
-{% if grains['ami.type'] == 'debian' %}
+resolv.conf:
+    tmp_state.local_managed:
+        - name: /mnt/variation/etc/resolv.conf
+        - source: /etc/resolv.conf
+        - require:
+            - mount.mounted: mounted_variation
+
+{% if 'ami.type' not in grains or grains['ami.type'] == 'ubuntu' %}
+salt_ppa:
+    cmd.run:
+        - name: chroot /mnt/variation add-apt-repository ppa:saltstack/salt -y
+        - require:
+            - mount.mounted: mounted_variation
+            - mount.mounted: chroot_proc 
+            - mount.mounted: chroot_devpts
+            - tmp_state.local_managed: resolv.conf
+{% endif %}
+
+{% if 'ami.type' in grains and grains['ami.type'] == 'debian' %}
 unstable.list:
     file.managed:
         - name: /mnt/variation/etc/apt/sources.list.d/unstable.list
@@ -50,7 +68,11 @@
 
 hg_variation:
     hg.latest:
+{% if 'ami.hg_address_variation' in grains %}
         - name: {{ grains['ami.hg_address_variation'] }}
+{% else %}
+        - name: http://hg.logilab.org/users/ptonelli/ami_creator/variation
+{% endif %}
 {% if 'ami.hg_rev_variation' in grains %}
         - rev: {{ grains['ami.hg_rev_variation'] }}
 {% endif %}
@@ -66,9 +88,3 @@
         - require:
             - mount.mounted: mounted_variation
 
-resolv.conf:
-    tmp_state.local_managed:
-        - name: /mnt/variation/etc/resolv.conf
-        - source: /etc/resolv.conf
-        - require:
-            - mount.mounted: mounted_variation