updated and renamed user data options
authorPaul Tonelli <paul.tonelli@logilab.fr>
Mon, 11 Mar 2013 16:31:00 +0100
changeset 59 c062ff185a14
parent 58 987740c53034
child 60 ea9ba2e759fc
updated and renamed user data options
ami_creator.sls
ami_creator_post.sls
ami_creator_pre.sls
readme.txt
--- a/ami_creator.sls	Mon Mar 11 15:46:28 2013 +0100
+++ b/ami_creator.sls	Mon Mar 11 16:31:00 2013 +0100
@@ -10,17 +10,17 @@
       - glance
 
 
-{% if  salt['file.find']('custom_hg_address') %}
-{% set hg_address = salt['file.find']('custom_hg_address') %}
+{% if  salt['file.find']('ami_hg_address') %}
+{% set ami_hg_address = salt['file.find']('ami_hg_address') %}
 {% else %}
-{% set hg_address = 'http://hg.logilab.fr/users/ptonelli/srv_salt' %}
+{% set ami_hg_address = 'http://hg.logilab.fr/users/ptonelli/srv_salt' %}
 {% endif %}
 hg_ami_creation:
     hg.latest:
-        - name: {{ hg_address }}
-{% if  salt['file.find']('custom_hg_revision') %}
-{% set hg_rev = salt['file.find']('custom_hg_revision') %}
-        - rev: {{ hg_rev }}
+        - name: {{ ami_hg_address }}
+{% if  salt['file.find']('ami_hg_revision') %}
+{% set ami_hg_revision = salt['file.find']('ami_hg_revision') %}
+        - rev: {{ ami_hg_revision }}
 {% endif %}
         - target: /etc/salt/srv
         - require:
--- a/ami_creator_post.sls	Mon Mar 11 15:46:28 2013 +0100
+++ b/ami_creator_post.sls	Mon Mar 11 16:31:00 2013 +0100
@@ -2,17 +2,22 @@
 
 ### deletes ###
 
-policy_removed:
+policy:
     file.absent:
         - name: /mnt/variation/usr/sbin/policy-rc.d
 
-resolvconf_removed:
+#01proxy:
+#    file.absent:
+#        - name: /mnt/variation/etc/apt/apt.conf.d/01proxy
+
+02confold:
+    file.absent:
+        - name: /mnt/variation/etc/apt/apt.conf.d/02confold
+
+resolv.conf:
     file.absent:
         - name: /mnt/variation/etc/resolv.conf
 
-01proxy_removed:
-    file.absent:
-        - name: /mnt/variation/etc/apt/apt.conf.d/01proxy
 
 ### Extract necessary files ###
 
@@ -50,7 +55,9 @@
             - tmp_state.local_managed: initrd
             - file.absent: policy_removed
             - file.absent: resolvconf_removed
-            - file.absent: 01proxy_removed
+#            - file.absent: 01proxy_removed
+            - file.absent: 02confold
+            - file.absent: resolv.conf
 
 ### Resize the partition to min ###
 resize_variation:
--- a/ami_creator_pre.sls	Mon Mar 11 15:46:28 2013 +0100
+++ b/ami_creator_pre.sls	Mon Mar 11 16:31:00 2013 +0100
@@ -1,8 +1,15 @@
 ### unarchived files ###
+
+{% if  salt['file.find']('ami_origin') %}
+{% set ami_origin = salt['file.find']('ami_origin') %}
+{% else %}
+{% set ami_origin = 'debian' %}
+{% endif %}
+
 variation_extracted:
     archive.extracted:
         - name: /mnt/
-        - source: salt://variation_debian.tar.gz
+        - source: salt://variation_{{ ami_origin }}.tar.gz
         - archive_format: tar
         - tar_options: z
         - if_missing: variation.img
--- a/readme.txt	Mon Mar 11 15:46:28 2013 +0100
+++ b/readme.txt	Mon Mar 11 16:31:00 2013 +0100
@@ -1,12 +1,45 @@
 
 Objective
-=======
+=========
 
 Automatically create variations of virtual machines depending
 on configuration files availables in repository :
 
   http://hg.logilab.fr/users/ptonelli/srv_salt/states/
 
+Present state
+=============
+
+The first step is to launch an instance of "ami-creation" on openstack. Use at
+least 20Gb of disk
+
+In the userdata, copy something like (if you do not put anything, what will be
+used will be the latest version from repo):
+
+====== START =======
+
+rev: 1b995dc39507
+address: http://hg.logilab.fr/users/ptonelli/srv_salt
+origin: debian #or ubuntu
+
+====== END ========
+
+
+you can add an ip to your instance, ssh to the machine and wait until
+everything in /mnt is unmounted. you can then upload what you want to glance
+with something like (don't forget to change the ids in the last tim):
+
+glance add is_public=false disk_format=aki container_format=aki\
+name=ami-creator-kernel < vmlinuz-3.2.0-4-amd64
+
+glance add is_public=false disk_format=ari container_format=ari\
+name=ami-creator-ramdisk < initrd.img-3.2.0-4-amd64
+
+glance add disk_format=ami container_format=ami name="ami-creator-amd64"\
+kernel_id=278de93c-5276-410f-a221-667cc1443cf8\
+ramdisk_id=b953e40a-2605-402b-8663-c8556a5899f2 < /mnt/ami-creator.img
+
+
 Files
 -----
 
@@ -24,36 +57,6 @@
 variation.top.sls : top file for the chroot
 
 
-Present state
--------------
-
-The first step is to launch an instance of "ami-creation" on openstack. Use at
-least 20Gb of disk
-
-In the userdata, copy something like (if you do not put anything, what will be
-used will be the latest version from repo):
-
-====== START =======
-
-rev: 1b995dc39507
-address: http://hg.logilab.fr/users/ptonelli/srv_salt
-
-====== END ========
-
-you can add an ip to your instance, ssh to the machine and wait until
-everything in /mnt is unmounted. you can then upload what you want to glance
-with something like (don't forget to change the ids in the last tim):
-
-glance add is_public=false disk_format=aki container_format=aki\
-name=ami-creator-kernel < vmlinuz-3.2.0-4-amd64
-
-glance add is_public=false disk_format=ari container_format=ari\
-name=ami-creator-ramdisk < initrd.img-3.2.0-4-amd64
-
-glance add disk_format=ami container_format=ami name="ami-creator-amd64"\
-kernel_id=278de93c-5276-410f-a221-667cc1443cf8\
-ramdisk_id=b953e40a-2605-402b-8663-c8556a5899f2 < /mnt/ami-creator.img
-
 Additionnal Documentation
 ========================