ami_creator.sls
author Paul Tonelli <paul.tonelli@logilab.fr>
Fri, 15 Mar 2013 10:28:04 +0100
changeset 84 40a8790380af
parent 79 07d85619353a
child 96 077e05a2ce8e
permissions -rw-r--r--
passed the main function from vmcreate to ami_creation.sls file: - added multiple steps in ami_create.sls - added return values (True) to functions in vm_create so that they can fill grains - changed rc.local (which should be on ami_creator image) to call the state instead of the function (commented until functionnal)

# /srv/salt/init_machine.sls
preparation:
    sls:
        - ami_pre
    require:
        - hg.latest: hg_code

update_variant:
    grains.present: 
        - value: {{ salt['vm_create.update_image']('/mnt/variation') }}
    require:
        - preparation

variate_variant:
    grains.present: 
        - value: {{ salt['vm_create.variate_image']('/mnt/variation') }}
    require:
        - update_variant

cleaning:
    sls:
        - ami_post
    require:
        - variate_variant

{% if  grains['keystone.user'] %}
upload_variant:
    grains.present: 
        - value: {{ salt['vm_create.upload_to_glance']('/mnt/variation') }}
    require:
        - cleaning
{% endif %}