ami_pre/files.sls
author Paul Tonelli <paul.tonelli@logilab.fr>
Wed, 27 Mar 2013 17:57:05 +0100
changeset 102 c7a8e6075a8a
parent 89 d6f5473f3dc1
child 107 bbbd2e0ec71b
permissions -rw-r--r--
- 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

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

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
        - 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

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 %}
        - target: /mnt/variation/etc/salt/srv/variation
        - 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