Skip to content

Instantly share code, notes, and snippets.

@baniobloom
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baniobloom/5167cddf53d08b5c21b7 to your computer and use it in GitHub Desktop.
Save baniobloom/5167cddf53d08b5c21b7 to your computer and use it in GitHub Desktop.
# pull in the reactor payload data
{% set target = salt['pillar.get']('target_server') %}
{% set grains_dict = salt['pillar.get']('grains_dict') %}
common_setup:
salt.state:
- tgt: {{ target }}
- sls:
- common.commonstate
{% if 'ebs_volumes' in grains_dict %}
{% for volume in grains_dict['ebs_volumes'] %}
mkdir_{{ grains_dict['ebs_volumes'][volume]['mount_point'] }}:
salt.function:
- tgt: {{ target }}
- name: file.mkdir
- arg:
- {{ grains_dict['ebs_volumes'][volume]['mount_point'] }}
attach_{{volume}}:
salt.function:
- tgt: 'role:saltmaster'
- tgt_type: grain
- name: cmd.run
- arg:
- /usr/local/bin/ebsattach.py -i {{ grains_dict['ec2']['instance_id'] }} -l {{ grains_dict['ebs_volumes'][volume]['lineage_tag'] }} -s {{ grains_dict['ebs_volumes'][volume]['default_size'] }} -a {{ grains_dict['ec2']['placement']['availability_zone'] }} -d {{ grains_dict['ebs_volumes'][volume]['device'] }}
- require:
- salt: common_setup
- salt: mkdir_{{ grains_dict['ebs_volumes'][volume]['mount_point'] }}
mount_{{ grains_dict['ebs_volumes'][volume]['mount_point'] }}:
salt.state:
- tgt: {{ target }}
- sls:
- common.mount
- arg:
- volume: volume
{% endfor %}
{% endif %}
highstate_setup:
salt.state:
- tgt: {{ target }}
- highstate: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment