021f0cd34a3ec5587abb321fd0a44d81f2f3dfb1
[icn.git] / deploy / metal3-vm / vm-setup / roles / libvirt / templates / ironic_nodes.json.j2
1 {% set lvars = { 'host_ip' : '192.168.122.1', 'pxe_network' : False} %}
2 {% for network in networks %}
3 {% if (not (network.forward_mode is defined and network.forward_mode == 'nat') and lvars['pxe_network'] == False) %}
4 {% if lvars.update({'pxe_network' : network.name}) %}{% endif %}
5 {% endif %}
6 {% if network.address is defined and lvars['host_ip'] == '192.168.122.1' %}
7 {% if lvars.update({'host_ip' : network.address}) %}{% endif %}
8 {% endif %}
9 {% endfor %}
10 {
11   "nodes": [
12   {% for node in vm_nodes %}
13     {
14       "name": "{{ node.name|replace('_', '-') }}",
15       "driver": "ipmi",
16       "resource_class": "baremetal",
17       "driver_info": {
18         "ipmi_username": "admin",
19         "ipmi_password": "password",
20         "ipmi_address": "{{ lvars['host_ip'] }}",
21         "ipmi_port": "{{ node.virtualbmc_port }}",
22         "deploy_kernel": "http://172.22.0.1/images/ironic-python-agent.kernel",
23         "deploy_ramdisk": "http://172.22.0.1/images/ironic-python-agent.initramfs"
24       },
25       "ports": [{
26         "address": "{{ node_mac_map.get(node.name).get(lvars['pxe_network']) }}",
27         "pxe_enabled": true
28       }],
29       "properties": {
30         "local_gb": "{{ flavors[node.flavor].disk }}",
31         "cpu_arch": "{{ libvirt_arch }}"
32       },
33       "net": {
34         "links": [
35         {% for network in networks %}
36           {
37             "id": "{{ network.name }}_nic",
38             "ethernet_mac_address": "{{ node_mac_map.get(node.name).get(network.name) }}",
39             "type": "phy"
40           }{% if not loop.last %},{% endif %}
41         {% endfor %}
42         ],
43         "networks": [
44         {% for network in networks %}
45           {
46             "id": "{{ network.name }}",
47             "link": "{{ network.name }}_nic",
48             "type": "ipv4_dhcp"
49           }{% if not loop.last %},{% endif %}
50         {% endfor %}
51         ],
52         "services": []
53       }
54     }{% if not loop.last %},{% endif %}
55   {% endfor %}
56   ]
57 }