Files
toallab-automation/roles/ahuffman.sat6_create_hosts/templates/new_host_virtual.json.j2
2020-08-17 12:04:20 -04:00

48 lines
1.3 KiB
Django/Jinja

{"host": {
"name": "{{ host_fqdn }}",
"organization_id": "{{ organization_id }}",
"location_id": "{{ location_id }}",
{% if host.ipv4 is defined %}
"ip": "{{ host.ipv4 }}",
{% endif %}
{% if domain_id != "" %}
"domain_id": "{{ domain_id }}",
{% endif %}
{% if subnet_id != "" %}
"subnet_id": "{{ subnet_id }}",
{% endif %}
{% if partition_table_id != "" %}
"ptable_id": "{{ partition_table_id }}",
{% endif %}
"hostgroup_id": "{{ host_grp_id }}",
{% if host.parameters is defined %}
{% if host.parameters | length > 0 %}
"host_parameters_attributes": [
{% for param in host.parameters %}
{
"name": "{{ param.name }}", "value": "{{ param.value }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
],
{% endif %}
{% endif %}
"comment": "{{ host.comment | default('') }}",
"compute_resource_id": "{{ compute_resource_id }}",
"compute_profile_id": "{{ compute_profile_id }}",
"build": "true",
"provision_method": "{{ host.provision_method | default('build') }}",
"managed": "true",
"enabled": "true",
"compute_attributes": {
"start": "1"
},
"interfaces_attributes": [{
"ip": "{{ host.ipv4 }}",
"identifier": "eth0",
"type": "interface",
"managed": "true",
"domain_id": "{{ domain_id }}",
"subnet_id": "{{ subnet_id }}"
}]
}
}