0

I have a Scale Set I provisioned in Azure through Terraform.
(A scale set is an implicit availability set with 5 fault domains and 5 update domains.[ [1]])

I need to find out which Fault Domain each instance is in, so that I can configure my application cluster based on this, for improved redundancy.

So far, I have found only a single post remotely addressing thisenter link description here.

More context:

  • I can switch to regular VMs rather than a scale set if there is absolutely no other way.
  • I use ansible's dynamic inventory (azure_rm.py) which I have already customised to work with Scale Sets. If the solution can leverage this, extra kudos :)
  • My application allows me to define topology (datacentre, rack, etc.) and I am deploying it in a single Azure datacentre. Maybe I have missed a different solution?

Many many thanks, –Jeff

Community
  • 1
  • 1
Jeff Hemmen
  • 181
  • 12

1 Answers1

0

I have solved this by using the 169.254.169.254 'virtual IP' that allows a VM in the could to read its own metadata.

Specifically, I am running:

curl -H Metadata:true --silent "http://169.254.169.254/metadata/instance/compute/platformFaultDomain?api-version=2017-03-01&format=text"

in an Ansible task, and then using Ansible's local facts to make this available as an Ansible variable on the host.

Jeff Hemmen
  • 181
  • 12