spyglass/spyglass/examples/templates/baremetal/nodes.yaml.j2

52 lines
1.5 KiB
Django/Jinja

{% set control_count = [1] %}
{% for rack in data['baremetal'].keys() %}
{% for host in data['baremetal'][rack].keys()%}
{% if data['baremetal'][rack][host]['type'] != 'genesis' %}
---
schema: 'drydock/BaremetalNode/v1'
metadata:
schema: 'metadata/Document/v1'
name: {{ host }}
layeringDefinition:
abstract: false
layer: site
storagePolicy: cleartext
data:
oob:
account: 'root'
{% if data['baremetal'][rack][host]['host_profile'] == 'cp' %}
{% if control_count.append(control_count.pop()+1) %} {% endif %}
{% if control_count[0] < 4 %}
host_profile: nc-{{data['baremetal'][rack][host]['host_profile']}}-primary
{% else %}
host_profile: nc-{{data['baremetal'][rack][host]['host_profile']}}-secondary
{% endif %}
{% else %}
host_profile: nc-{{data['baremetal'][rack][host]['host_profile']}}
{% endif %}
addressing:
- network: oob
address: {{ data['baremetal'][rack][host]['ip']['oob'] }}
- network: oam
address: {{ data['baremetal'][rack][host]['ip']['oam'] }}
- network: pxe
address: {{ data['baremetal'][rack][host]['ip']['pxe'] }}
- network: storage
address: {{ data['baremetal'][rack][host]['ip']['storage'] }}
- network: calico
address: {{ data['baremetal'][rack][host]['ip']['calico'] }}
- network: overlay
address: {{ data['baremetal'][rack][host]['ip']['overlay'] }}
metadata:
rack: RACK{{rack[-2:] }}
tags:
{% if data['baremetal'][rack][host]['type'] == 'compute' %}
- 'workers'
{% else %}
- 'masters'
{% endif %}
...
{% endif %}
{%endfor%}
{%endfor%}