cut ami_creator_pre into different sls files in folder, made necessary modification:
authorPaul Tonelli <paul.tonelli@logilab.fr>
Fri, 15 Mar 2013 14:58:22 +0100
changeset 78 f964fb1a386a
parent 77 921005892859
child 79 07d85619353a
cut ami_creator_pre into different sls files in folder, made necessary modification: - transformed variables into salt grains when necessary - moved requirements
ami_creator_pre.sls
ami_pre/files.sls
ami_pre/init.sls
ami_pre/mounts.sls
--- a/ami_creator_pre.sls	Thu Mar 14 19:24:46 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-### unarchived files ###
-
-{% if  salt['grains.item']('ami.type') %}
-{% set ami_origin = salt['grains.item']('ami.type') %}
-{% else %}
-{% set ami_origin = 'debian' %}
-{% endif %}
-
-variation_extracted:
-    archive.extracted:
-        - name: /mnt/
-        - source: salt://variation_{{ ami_origin }}.tar.gz
-        - archive_format: tar
-        - tar_options: z
-        - if_missing: variation.img
-
-### Resize the partition ###
-resize_variation:
-    tmp_state.resized:
-        - name: /mnt/variation.img
-        - size: 3G
-        - require:
-            - archive.extracted: variation_extracted
-
-###  Directories ###
-/mnt/variation:
-    file.directory:
-        - user: root
-        - group: root
-        - mode: 755
-        - makedirs: True
-
-### Mounts ###
-mounted_variation:
-    mount.mounted:
-        - device: /mnt/variation.img
-        - name: /mnt/variation
-        - fstype: ext4
-        - mkmnt: False
-        - opts:
-            - loop
-        - require:
-            - file.directory: /mnt/variation
-            - tmp_state.resized: resize_variation
-
-chroot_proc:
-    mount.mounted:
-        - device: none
-        - name: /mnt/variation/proc
-        - fstype: proc
-        - mkmnt: false
-        - require:
-            - mount.mounted: mounted_variation
-
-chroot_devpts:
-    mount.mounted:
-        - device: none
-        - name: /mnt/variation/dev/pts
-        - fstype: devpts
-        - mkmnt: False
-        - require:
-            - mount.mounted: mounted_variation
-
-### Temporary Files ###
-01proxy:
-    file.managed:
-        - name: /mnt/variation/etc/apt/apt.conf.d/01proxy
-        - source: salt://others/01proxy
-        - mode: 644
-        - require:
-            - mount.mounted: mounted_variation
-
-02confold:
-    file.managed:
-        - name: /mnt/variation/etc/apt/apt.conf.d/02confold
-        - source: salt://others/02confold
-        - mode: 644
-        - require:
-            - mount.mounted: mounted_variation
-
-policy-rc.d:
-    file.managed:
-        - name: /mnt/variation/usr/sbin/policy-rc.d
-        - source: salt://others/policy-rc.d
-        - mode: 755
-        - require:
-            - mount.mounted: mounted_variation
-
-{% if ami_origin == 'debian' %}
-unstable.list:
-    file.managed:
-        - name: /mnt/variation/etc/apt/sources.list.d/unstable.list
-        - source: salt://others/unstable.list
-        - mode: 644
-        - require:
-            - mount.mounted: mounted_variation
-
-pinning:
-    file.managed:
-        - name: /mnt/variation/etc/apt/preferences.d/pinning
-        - source: salt://others/pinning
-        - mode: 644
-        - require:
-            - mount.mounted: mounted_variation
-{% endif %}
-
-minion:
-    file.managed:
-        - name: /mnt/variation/etc/salt/minion
-        - source: salt://variation.minion
-        - mode: 644
-        - require:
-            - mount.mounted: mounted_variation
-
-variation.sls:
-    file.managed:
-        - name: /mnt/variation/etc/salt/srv/variation.sls
-        - source: salt://variation.sls
-        - mode: 644
-        - require:
-            - mount.mounted: mounted_variation
-
-variation.top.sls:
-    file.managed:
-        - name: /mnt/variation/etc/salt/srv/top.sls
-        - source: salt://variation.top.sls
-        - mode: 644
-        - 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ami_pre/files.sls	Fri Mar 15 14:58:22 2013 +0100
@@ -0,0 +1,72 @@
+01proxy:
+    file.managed:
+        - name: /mnt/variation/etc/apt/apt.conf.d/01proxy
+        - source: salt://others/01proxy
+        - mode: 644
+        - require:
+            - mount.mounted: mounted_variation
+
+02confold:
+    file.managed:
+        - name: /mnt/variation/etc/apt/apt.conf.d/02confold
+        - source: salt://others/02confold
+        - mode: 644
+        - require:
+            - mount.mounted: mounted_variation
+
+policy-rc.d:
+    file.managed:
+        - name: /mnt/variation/usr/sbin/policy-rc.d
+        - source: salt://others/policy-rc.d
+        - mode: 755
+        - require:
+            - mount.mounted: mounted_variation
+
+{% if grains['ami.type'] == 'debian' %}
+unstable.list:
+    file.managed:
+        - name: /mnt/variation/etc/apt/sources.list.d/unstable.list
+        - source: salt://others/unstable.list
+        - mode: 644
+        - require:
+            - mount.mounted: mounted_variation
+
+pinning:
+    file.managed:
+        - name: /mnt/variation/etc/apt/preferences.d/pinning
+        - source: salt://others/pinning
+        - mode: 644
+        - require:
+            - mount.mounted: mounted_variation
+{% endif %}
+
+minion:
+    file.managed:
+        - name: /mnt/variation/etc/salt/minion
+        - source: salt://variation.minion
+        - mode: 644
+        - require:
+            - mount.mounted: mounted_variation
+
+variation.sls:
+    file.managed:
+        - name: /mnt/variation/etc/salt/srv/variation.sls
+        - source: salt://variation.sls
+        - mode: 644
+        - require:
+            - mount.mounted: mounted_variation
+
+variation.top.sls:
+    file.managed:
+        - name: /mnt/variation/etc/salt/srv/top.sls
+        - source: salt://variation.top.sls
+        - mode: 644
+        - 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ami_pre/init.sls	Fri Mar 15 14:58:22 2013 +0100
@@ -0,0 +1,37 @@
+### unarchived files ###
+
+{% if 'ami.type' not in grains %}
+ami.type:
+    grains.present:
+        - value : debian
+{% endif %}
+
+variation_extracted:
+    archive.extracted:
+        - name: /mnt/
+        - source: salt://variation_{{ grains['ami.type'] }}.tar.gz
+        - archive_format: tar
+        - tar_options: z
+        - if_missing: variation.img
+
+### Resize the partition ###
+resize_variation:
+    tmp_state.resized:
+        - name: /mnt/variation.img
+        - size: 3G
+        - require:
+            - archive.extracted: variation_extracted
+
+###  Directories ###
+/mnt/variation:
+    file.directory:
+        - user: root
+        - group: root
+        - mode: 755
+        - makedirs: True
+
+### Mounts ###
+include:
+    - ami_pre.mounts
+    - ami_pre.files
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ami_pre/mounts.sls	Fri Mar 15 14:58:22 2013 +0100
@@ -0,0 +1,31 @@
+
+mounted_variation:
+    mount.mounted:
+        - device: /mnt/variation.img
+        - name: /mnt/variation
+        - fstype: ext4
+        - mkmnt: False
+        - opts:
+            - loop
+        - require:
+            - file.directory: /mnt/variation
+            - tmp_state.resized: resize_variation
+
+chroot_proc:
+    mount.mounted:
+        - device: none
+        - name: /mnt/variation/proc
+        - fstype: proc
+        - mkmnt: false
+        - require:
+            - mount.mounted: mounted_variation
+
+chroot_devpts:
+    mount.mounted:
+        - device: none
+        - name: /mnt/variation/dev/pts
+        - fstype: devpts
+        - mkmnt: False
+        - require:
+            - mount.mounted: mounted_variation
+