Skip to content

Instantly share code, notes, and snippets.

@willthames
Created November 27, 2018 03:31
Show Gist options
  • Save willthames/0f1402f8ccff822cc4792f7b287ae8fe to your computer and use it in GitHub Desktop.
Save willthames/0f1402f8ccff822cc4792f7b287ae8fe to your computer and use it in GitHub Desktop.
# This is untested, and only really works if number of zones evenly divides number of instances
- name: create number_of_instances across a list of zones
ec2:
desired_count: "{{ number_of_instances / (zones | length) }}"
az: "{{ item % (zones | length) }}"
loop: "{{ number_of_instances | range }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment