states: Rename openstack, add baremetal_init
[fuel.git] / mcp / reclass / classes / cluster / baremetal-mcp-ocata-common-ha / infra / kvm_init.yml.j2
1 ##############################################################################
2 # Copyright (c) 2017 Mirantis Inc., Enea AB and others.
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Apache License, Version 2.0
5 # which accompanies this distribution, and is available at
6 # http://www.apache.org/licenses/LICENSE-2.0
7 ##############################################################################
8 {# NOTE: br-{mgmt,ctl} are cross-referenced, careful when changing names #}
9 {%- if conf.net_config is defined and conf.idf is defined -%}
10     {#- NOTE: Currently, we assume all cluster nodes use the same mapping -#}
11
12     {#- Determine interface index for each network (plumbing vars) -#}
13     {%- set idx_admin = conf['net_config']['admin']['interface'] -%}
14     {%- set idx_mgmt = conf['net_config']['mgmt']['interface'] -%}
15     {%- set idx_private = conf['net_config']['private']['interface'] -%}
16     {%- set idx_public = conf['net_config']['public']['interface'] -%}
17
18     {#- Physical interface OS name for each network (e.g. em1, enp1s0f1) -#}
19     {%- set node = conf['idf']['fuel']['network']['node'][0] -%}
20     {%- set nic_admin = node['interfaces'][idx_admin] -%}
21     {%- set nic_mgmt = node['interfaces'][idx_mgmt] -%}
22     {%- set nic_private = node['interfaces'][idx_private] -%}
23     {%- set nic_public = node['interfaces'][idx_public] -%}
24
25     {#- PCI addresses (only for DPDK on private) -#}
26     {%- set bus_private = node['busaddr'][idx_private] -%}
27
28     {#- VLAN for each network (only untagged 'admin' is supported by MaaS config!) -#}
29     {%- set vlan_admin = conf['net_config']['admin']['vlan'] -%}
30     {%- set vlan_mgmt = conf['net_config']['mgmt']['vlan'] -%}
31     {%- set vlan_private = conf['net_config']['private']['vlan'] -%}
32     {%- set vlan_public = conf['net_config']['public']['vlan'] -%}
33 {%- else -%}
34     {%- set nic_admin = 'enp6s0' -%}
35     {%- set nic_mgmt = 'enp6s0' -%}
36     {%- set nic_private = None -%}
37     {%- set nic_public = None -%}
38     {%- set vlan_admin = 'native' -%}
39     {%- set vlan_mgmt = '300' -%}
40     {%- set vlan_private = '1000' -%}
41 {%- endif -%}
42
43 {#- Filter-out NIC duplicates by constructing a dict (used NICs only) -#}
44 {%- set nics = { nic_admin: True, nic_mgmt: True, nic_public: True } -%}
45
46 {%- set vlans = { vlan_admin: nic_admin, vlan_mgmt: nic_mgmt, vlan_public: nic_public } -%}
47 ---
48 parameters:
49   linux:
50     network:
51       interface:
52 {%- for nic in nics %}
53         {{ nic }}:
54           enabled: true
55           type: eth
56           proto: manual
57           address: 0.0.0.0
58           netmask: 255.255.255.0
59           name: {{ nic }}
60           noifupdown: true
61 {%- endfor %}
62
63 {%- for vlan in vlans %}
64     {%- if vlan and vlan != 'native' %}
65         {{ vlans[vlan] }}.{{ vlan }}:
66           enabled: true
67           proto: manual
68           type: vlan
69           name: {{ vlans[vlan] }}.{{ vlan }}
70           use_interfaces:
71             - {{ vlans[vlan] }}
72     {%- endif %}
73 {%- endfor %}
74
75         br-mgmt:
76           enabled: true
77           proto: dhcp
78           type: bridge
79           name_servers: ${_param:opnfv_name_servers}
80           use_interfaces:
81             - {{ nic_admin }}{% if vlan_admin and vlan_admin != 'native' %}.{{ vlan_admin }}{% endif %}
82           noifupdown: true
83         br-ctl:
84           enabled: true
85           type: bridge
86           proto: static
87           address: ${_param:single_address}
88           netmask: 255.255.255.0
89           use_interfaces:
90             - {{ nic_mgmt }}{% if vlan_mgmt and vlan_mgmt != 'native' %}.{{ vlan_mgmt }}{% endif %}
91         br-ex:
92           enabled: true
93           proto: manual
94           address: 0.0.0.0
95           netmask: 255.255.255.0
96           type: bridge
97           use_interfaces:
98             - {{ nic_public }}{% if vlan_public and vlan_public != 'native' %}.{{ vlan_public }}{% endif %}
99           noifupdown: true