I have an instance resource along these lines:
masters:
type: OS::Heat::ResourceGroup
properties:
count: { get_param: num_masters }
resource_def:
type: heat_stack_server.yaml
properties:
name:
str_replace:
template: cluster_id-k8s_type-%index%
params:
cluster_id: { get_param: cluster_id }
k8s_type: master
cluster_env: { get_param: cluster_env }
cluster_id: { get_param: cluster_id }
type: master
image: { get_param: master_image }
flavor: { get_param: master_flavor }
key_name: { get_resource: keypair }
net: { get_resource: net }
subnet: { get_resource: subnet }
secgrp:
- { get_resource: master-secgrp }
- { get_resource: node-secgrp }
floating_network: { get_param: external_net }
net_name:
str_replace:
template: openshift-ansible-cluster_id-net
params:
cluster_id: { get_param: cluster_id }
depends_on:
- interface
It creates num_masters
. Now, I want to guarantee these masters will be created in different availability zones (so that when one of them fails, the other will continue to work).
Say, I have 3 AZ and num_masters == 5
. How to spread them, so that zone1 contains nodes 1 and 4, zone2 - 2 and 5, and so on?
Ansible has that loop.cycle thing where you could pass over a list of options over and over. Any ideas how to do it in OS?