meta:
  schema_version: '<%= @schema_version %>'
providers:
  # for details check https://docs.openstack.org/nova/latest/admin/managing-resource-providers.html
<% @custom_inventories.each do |provider| -%>
  - identification:
  <%- if provider['name'] -%>
      name: '<%= provider['name'] %>'
  <%- elsif provider['uuid'] -%>
      uuid: '<%= provider['uuid'] %>'
  <%- else -%>
      uuid: '$COMPUTE_NODE'
  <%- end -%>
  <%- if !provider['inventories'].nil? -%>
    inventories:
      additional:
    <%- provider['inventories'].sort.each do |inventory| -%>
        - <%= inventory[0] %>:
      <%- inventory[1].sort.each do |resource| -%>
            <%= resource[0] %>: <%= resource[1] %>
      <%- end -%>
    <%- end -%>
  <%- end -%>
  <%- if !provider['traits'].nil? -%>
    traits:
      additional:
    <%- provider['traits'].each do |trait| -%>
        - '<%= trait %>'
    <%- end -%>
  <%- end -%>
<%- end -%>
