ami_creator.sls
author Paul Tonelli <paul.tonelli@logilab.fr>
Tue, 12 Mar 2013 11:51:26 +0100
changeset 66 23a31e4cbb65
parent 65 0cba5e282f10
child 68 601c145e6326
permissions -rw-r--r--
the scripts now cleans the ssh keys if present as well as the apt cache

# /srv/salt/init_machine.sls
my_pkgs:
  pkg.installed:
    - pkgs:
      - salt-minion
      - python
      - mercurial
      - tar
      - rsync
      - glance


{% if  salt['grains.item']('ami_hg_address') %}
{% set ami_hg_address = salt['grains.item']('ami_hg_address') %}
{% else %}
{% set ami_hg_address = 'http://hg.logilab.fr/users/ptonelli/srv_salt' %}
{% endif %}
hg_ami_creation:
    hg.latest:
        - name: {{ ami_hg_address }}
{% if  salt['grains.item']('ami_hg_revision') %}
{% set ami_hg_revision = salt['grains.item']('ami_hg_revision') %}
        - rev: {{ ami_hg_revision }}
{% endif %}
        - target: /etc/salt/srv
        - require:
            - pkg: my_pkgs